Ignore:
Timestamp:
Dec 5, 2014, 4:02:27 PM (10 years ago)
Author:
alain
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/mwmr_channel.h

    r450 r461  
    1111//
    1212// The mwmr_read() and mwmr_write() functions do not require a system call.
    13 // The channel itself must have been allocated in a non cacheable segment,
     13// The channel must have been allocated in a non cacheable segment,
    1414// if the platform does not provide hardware cache coherence.
    15 //
    16 // WARNING : ALL MWMR channels must be defined in the mapping,
    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 channel from it's name.
    2015//
    2116// An MWMR transaction transfer an integer number of items, and an item is
     
    2722//
    2823// Both the mwmr_read() and mwmr_write() functions are blocking functions.
    29 // A private lock provides exclusive access to the MWMR channel, that can have
    30 // a variable number of producers and a variable number of consumers.
     24// A private file_lock provides exclusive access to the MWMR channel.
    3125///////////////////////////////////////////////////////////////////////////////////
    3226
    3327#ifndef _MWMR_CHANNEL_H_
    3428#define _MWMR_CHANNEL_H_
     29
     30#include "user_lock.h"
    3531
    3632///////////////////////////////////////////////////////////////////////////////////
     
    4238typedef struct mwmr_channel_s
    4339{
    44     unsigned int ptr;        // index of the first valid data word
    45     unsigned int ptw;        // index of the first empty slot
    46     unsigned int sts;        // number of words available
    47     unsigned int lock;       // exclusive access lock
    48     unsigned int depth;      // max number of words in the channel
    49     unsigned int width;      // number of words in an item     
    50     unsigned int data[1018]; // circular buffer
     40    user_lock_t    lock;       // exclusive access lock
     41    unsigned int   ptr;        // index of the first valid data word
     42    unsigned int   ptw;        // index of the first empty slot
     43    unsigned int   sts;        // number of words available
     44    unsigned int   depth;      // max number of words in the channel
     45    unsigned int   width;      // number of words in an item     
     46    unsigned int*  data;       // circular buffer base address
    5147} mwmr_channel_t;
    5248
     
    5652
    5753void mwmr_init(  mwmr_channel_t* mwmr,
     54                 unsigned int*   buffer,    // data buffer base address
    5855                 unsigned int    width,     // number of words per item
    59                  unsigned int    items );   // max number of items
     56                 unsigned int    nitems );  // max number of items
    6057
    61 void mwmr_write( mwmr_channel_t* mwmr,
    62                  unsigned int*   buffer,    // user buffer vbase address
    63                  unsigned int    nitems );  // number of items to transfer
     58void mwmr_read(  mwmr_channel_t* mwmr,
     59                 unsigned int*   buffer,
     60                 unsigned int    items );
    6461
    65 void mwmr_write( mwmr_channel_t* mwmr, 
    66                  unsigned int*   buffer,    // user buffer vbase address
    67                  unsigned int    nitems );  // number of items to transfer
     62void mwmr_write( mwmr_channel_t* mwmr,
     63                 unsigned int*   buffer,
     64                 unsigned int    items );
    6865
    6966unsigned int nb_mwmr_read ( mwmr_channel_t * mwmr,
    7067                            unsigned int * buffer,
    71                             unsigned int nitems );
     68                            unsigned int items );
    7269
    7370unsigned int nb_mwmr_write( mwmr_channel_t * mwmr,
    7471                            unsigned int * buffer,
    75                             unsigned int nitems );
     72                            unsigned int items );
    7673
    7774#endif
Note: See TracChangeset for help on using the changeset viewer.