Changeset 368 for soft/giet_vm/giet_libs/spin_lock.c
- Timestamp:
- Jul 31, 2014, 8:47:14 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/spin_lock.c
r266 r368 4 4 // Author : alain greiner 5 5 // Copyright (c) UPMC-LIP6 6 ///////////////////////////////////////////////////////////////////////////////////7 // The spin_lock.c and spin_lock.h files are part of the GIET nano-kernel.8 // This middlewre implements a user-level lock (busy waiting mechanism,9 // because the GIET does not support task scheduling / descheduling).10 // It is a simple binary lock, without waiting queue.11 //12 // The lock_acquire() and lock_release() functions do not require a system call.13 // The barrier itself must have been allocated in a non cacheable segment,14 // if the platform does not provide hardwate cache coherence.15 //16 // ALL locks must be defined in the mapping_info data structure,17 // to be initialised by the GIET in the boot phase.18 // The vobj_get_vbase() system call (defined in stdio.c and stdio.h files)19 // can be used to get the virtual base address of the lock fro it's name.20 6 /////////////////////////////////////////////////////////////////////////////////// 21 7 … … 28 14 // If the lock is already taken a random delay is introduced before retry. 29 15 /////////////////////////////////////////////////////////////////////////////////// 30 void lock_acquire(giet_lock_t * lock) { 16 void lock_acquire(giet_lock_t * lock) 17 { 31 18 unsigned int * plock = &lock->value; 32 19 unsigned int delay = giet_rand(); … … 62 49 // lock_release() 63 50 ////////////////////////////////////////////////////////////////////////////// 64 void lock_release(giet_lock_t * lock) { 51 void lock_release(giet_lock_t * lock) 52 { 65 53 unsigned int * plock = &lock->value; 66 54
Note: See TracChangeset
for help on using the changeset viewer.