source: soft/giet_vm/giet_libs/user_sqt_lock.h @ 595

Last change on this file since 595 was 581, checked in by laurent, 10 years ago

Adding ocean application, some mathematics functions and distributed locks

File size: 1.2 KB
Line 
1
2#ifndef USER_LOCKS_H
3#define USER_LOCKS_H
4
5#include "hard_config.h"
6
7/////////////////////////////////////////////////////////////////////////////
8//      SQT lock structures and access functions
9/////////////////////////////////////////////////////////////////////////////
10
11typedef struct sqt_lock_node_s
12{
13    unsigned int            current;         // current ticket index
14    unsigned int            free;            // next free ticket index
15    unsigned int            level;           // hierarchical level (0 is bottom)
16    struct sqt_lock_node_s* parent;          // parent node (NULL for root)
17    struct sqt_lock_node_s* child[4];        // children node
18    unsigned int            padding[8];      // for 64 bytes alignment         
19} sqt_lock_node_t;
20
21typedef struct sqt_lock_s
22{
23    sqt_lock_node_t* node[X_SIZE][Y_SIZE][5];  // array of pointers on SBT nodes
24} sqt_lock_t;
25
26extern void sqt_lock_init( sqt_lock_t*  lock,
27                       unsigned int         x_size,
28                       unsigned int         y_size,
29                       unsigned int         ntasks );
30
31extern void sqt_lock_acquire( sqt_lock_t*  lock );
32
33extern void sqt_lock_release( sqt_lock_t*  lock );
34
35
36#endif
Note: See TracBrowser for help on using the repository browser.