source: soft/giet_vm/giet_libs/user_lock.h @ 508

Last change on this file since 508 was 461, checked in by alain, 10 years ago

1) replace the "giet_locks.c" library by the "user_lock.c" library (the new library uses a ticket allocator).
2) introduce new syscalls in the stdio.c file, to support the NIC peripheral.
3) modify the MWMR library to use the lock with ticket allocator, and to separate the fifo descriptor and the data buffer.

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1//////////////////////////////////////////////////////////////////////////////////
2// File     : user_lock.h         
3// Date     : 01/12/2014
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7// The file_lock.c and file_lock.h files are part of the GIET-VM nano-kernel.
8///////////////////////////////////////////////////////////////////////////////////
9
10#ifndef _GIET_FILE_LOCK_H_
11#define _GIET_FILE_LOCK_H_
12
13///////////////////////////////////////////////////////////////////////////////////
14//  lock structure
15///////////////////////////////////////////////////////////////////////////////////
16
17typedef struct user_lock_s
18{
19    unsigned int current;        // current slot index
20    unsigned int free;           // next free slot index
21    unsigned int padding[14];    // for 64 bytes alignment
22} user_lock_t;
23
24///////////////////////////////////////////////////////////////////////////////////
25//  access functions
26///////////////////////////////////////////////////////////////////////////////////
27
28extern unsigned int atomic_increment( unsigned int* ptr,
29                                      unsigned int  increment );
30
31extern void lock_acquire( user_lock_t * lock );
32
33extern void lock_release( user_lock_t * lock );
34
35extern void lock_init( user_lock_t * lock );
36
37#endif
38
39// Local Variables:
40// tab-width: 4
41// c-basic-offset: 4
42// c-file-offsets:((innamespace . 0)(inline-open . 0))
43// indent-tabs-mode: nil
44// End:
45// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
46
Note: See TracBrowser for help on using the repository browser.