Changes between Version 3 and Version 4 of library_mwmr
- Timestamp:
- Nov 6, 2014, 6:03:30 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
library_mwmr
v3 v4 3 3 The [source:soft/giet_vm/giet_libs/mwmr_channel.c mwmr_channel.c] and [source:soft/giet_vm/giet_libs/mwmr_channel.h mwmr_channel.h] files define an user-level communication middleware. 4 4 5 This middlewaresupports channelized communications in a parallel multi-tasks application, where the communication scheme can be explicitely and statically described by a Task and Communication Graph.5 It supports channelized communications in a parallel multi-tasks application, where the communication scheme can be explicitely and statically described by a Task and Communication Graph. 6 6 Each MWMR (Multi-Writer Multi-Reader) channel can be accessed concurently by one or several writer(s) and by one or several reader(s). It is implemented as a software FIFO, protected by a build-in lock. 7 8 This software FIFO can be directly accessed by an hardware coprocessor, thanks to the vc_mwmr_controller, but be describe here the the software API that can be used by a software application. 7 9 8 10 An MWMR transaction transfer an integer number of items, and an item is an integer number of unsigned int (32 bits words). The max number of words that can be stored in a MWMR channel is defined by the"depth" parameter. The "width" parameter define the minimal number of words contained in an atomic item. Therefore, the "depth" parameter must be a multiple of the "width" parameter. … … 22 24 * '''mwmr''' : MWMR channel virtual base address. 23 25 * '''nitems''' : number of items to be transfered. 24 * '''buffer''' : virtual base address of local buffer 26 * '''buffer''' : virtual base address of local buffer. 25 27 It takes the lock for exclusive access before testing the channel state. If there is not enough space in mwmr channel to write nitems, it writes as many items as possible, releases the lock, and retry after a random delay. 26 28 27 === void '''mwmr_read'''( mwmr_channel_t* mwmr, unsigned int* buffer, unsigned int 29 === void '''mwmr_read'''( mwmr_channel_t* mwmr, unsigned int* buffer, unsigned int nitems ) === 28 30 This function transfer (nitems * width) 32 bits words from the MWMR channel to a task private buffer. 29 31 * '''mwmr''' : MWMR channel virtual base address. 30 32 * '''nitems''' : number of items to be transfered. 31 * '''buffer''' : virtual base address of local buffer 33 * '''buffer''' : virtual base address of local buffer. 32 34 It takes the lock for exclusive access before testing the channel state. If there is not enough space in mwmr channel to write nitems, it writes as many items as possible, releases the lock, and retry after a random delay. 33 35 … … 37 39 The ''nb_mwmr_read()'' and ''nb_mwmr_write()'' functions are non-blocking functions. 38 40 39 === unsigned int '''nb_mwmr_write'''() === 40 // This is a non-blocking function. 41 // The nitems parameter is the number of items to be transfered. 42 // The requested transfer is therefore (nitems * width) words. 43 // It takes the lock for exclusive access before testing the channel state. 44 // If there is not enough data in mwmr channel to read nitems, 45 // it reads as many items as possible, releases the lock, and returns 46 // the number of read items (it can be 0). 47 /////////////////////////////////////////////////////////////////////////////////// 41 === unsigned int '''nb_mwmr_write'''( mwmr_channel_t* mwmr, unsigned int* buffer, unsigned int nitems ) === 42 This function request to transfer (nitems * width) 32 bits words from a task private buffer tot he MWMR channel. 43 * '''mwmr''' : MWMR channel virtual base address. 44 * '''nitems''' : number of items to be transfered. 45 * '''buffer''' : virtual base address of local buffer. 46 It takes the lock for exclusive access before testing the channel state. If there is not enough free space in the channel, it transfer as many items as possible, releases the lock, and returns the number of actually transfered items (it can be 0). 47 48 === unsigned int '''nb_mwmr_write'''( mwmr_channel_t* mwmr, unsigned int* buffer, unsigned int nitems ) === 49 This function request to transfer (nitems * width) 32 bits words from the MWMR channel to a task private buffer. 50 * '''mwmr''' : MWMR channel virtual base address. 51 * '''nitems''' : number of items to be transfered. 52 * '''buffer''' : virtual base address of local buffer. 53 It takes the lock for exclusive access before testing the channel state. If there is not enough data in the channel, it transfer as many items as possible, releases the lock, and returns the number of actually transfered items (it can be 0). 54