1 | ////////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File : mwmr_channel.h |
---|
3 | // Date : 01/04/2012 |
---|
4 | // Author : alain greiner |
---|
5 | // Copyright (c) UPMC-LIP6 |
---|
6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
7 | |
---|
8 | #ifndef _MWMR_CHANNEL_H_ |
---|
9 | #define _MWMR_CHANNEL_H_ |
---|
10 | |
---|
11 | /////////////////////////////////////////////////////////////////////////////////// |
---|
12 | // MWMR channel structure |
---|
13 | // The data array size is defined to obtain sizeof(mwmr_channel_t) = 4096 bytes. |
---|
14 | // The actual size can be redefined in the mapping info data structure. |
---|
15 | /////////////////////////////////////////////////////////////////////////////////// |
---|
16 | |
---|
17 | typedef struct mwmr_channel_s |
---|
18 | { |
---|
19 | unsigned int ptr; // index of the first valid data word |
---|
20 | unsigned int ptw; // index of the first empty slot |
---|
21 | unsigned int sts; // number of words available |
---|
22 | unsigned int lock; // exclusive access lock |
---|
23 | unsigned int depth; // max number of words in the channel |
---|
24 | unsigned int width; // number of words in an item |
---|
25 | unsigned int data[1018]; // circular buffer |
---|
26 | } mwmr_channel_t; |
---|
27 | |
---|
28 | ////////////////////////////////////////////////////////////////////////////// |
---|
29 | // MWMR access functions |
---|
30 | ////////////////////////////////////////////////////////////////////////////// |
---|
31 | |
---|
32 | void mwmr_write( mwmr_channel_t* mwmr, |
---|
33 | unsigned int* buffer, |
---|
34 | unsigned int nitems ); |
---|
35 | |
---|
36 | void mwmr_read( mwmr_channel_t* mwmr, |
---|
37 | unsigned int* buffer, |
---|
38 | unsigned int nitems ); |
---|
39 | |
---|
40 | unsigned int nb_mwmr_read ( mwmr_channel_t * mwmr, |
---|
41 | unsigned int * buffer, |
---|
42 | unsigned int nitems ); |
---|
43 | |
---|
44 | |
---|
45 | unsigned int nb_mwmr_write( mwmr_channel_t * mwmr, |
---|
46 | unsigned int * buffer, |
---|
47 | unsigned int nitems ); |
---|
48 | |
---|
49 | #endif |
---|
50 | |
---|
51 | // Local Variables: |
---|
52 | // tab-width: 4 |
---|
53 | // c-basic-offset: 4 |
---|
54 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
55 | // indent-tabs-mode: nil |
---|
56 | // End: |
---|
57 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
58 | |
---|