Changeset 189 for soft/giet_vm/libs


Ignore:
Timestamp:
Aug 7, 2012, 6:37:49 PM (12 years ago)
Author:
alain
Message:

Introducing a new release where all initialisation
is done in the boot code.

Location:
soft/giet_vm/libs
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/libs/mwmr_channel.c

    r178 r189  
    3333#include <mwmr_channel.h>
    3434#include <stdio.h>
    35 #include <common.h>
    3635
    3736//////////////////////////////////////////////////////////////////////////////
     
    7473// after a random delay.
    7574//////////////////////////////////////////////////////////////////////////////
    76 void mwmr_write( mwmr_channel_t*            mwmr,
    77                  const unsigned int*    buffer,
    78                  unsigned int               nitems )
     75void mwmr_write( mwmr_channel_t*        mwmr,
     76                 unsigned int*          buffer,
     77                 unsigned int           nitems )
    7978{
    8079    unsigned int        x;
     
    8685    unsigned int    ptw;        // channel ptw
    8786
    88     if(nitems == 0)
    89         return;
    90 
    91     assert(buffer && "mwmr write: Empty buffer");
     87    if(nitems == 0) return;
     88
     89    // address virtuelle 0 is illegal...
     90    assert(buffer && "mwmr read: Empty buffer");
    9291
    9392    while(1)
     
    163162    unsigned int    ptr;        // channel ptw
    164163
    165     if(nitems == 0)
    166         return;
    167 
     164    if(nitems == 0) return;
     165
     166    // address virtuelle 0 is illegal...
    168167    assert(buffer && "mwmr read: Empty buffer");
    169168
  • soft/giet_vm/libs/mwmr_channel.h

    r179 r189  
    2020    unsigned int        sts;                    // number of words available
    2121    unsigned int        depth;                  // max number of words in the channel
    22     unsigned int        width;                  // number of word in an item   
     22    unsigned int        width;                  // number of words in an item   
    2323    unsigned int        lock;                   // exclusive access lock
    24     unsigned int        data[1];                // circular buffer
     24    unsigned int        data[1018];             // circular buffer
    2525} mwmr_channel_t;
    2626
     
    2929//////////////////////////////////////////////////////////////////////////////
    3030
    31 void mwmr_write( mwmr_channel_t*            mwmr,
    32                  const unsigned int*    buffer,
    33                  unsigned int               nitems );
     31void mwmr_write( mwmr_channel_t*        mwmr,
     32                 unsigned int*          buffer,
     33                 unsigned int           nitems );
    3434
    3535void mwmr_read( mwmr_channel_t*         mwmr,
  • soft/giet_vm/libs/spin_lock.c

    r178 r189  
    1010// It is a simple binary lock, without waiting queue.
    1111//
    12 // The lock_acquire(), lock_try_acquire() and lock_release() functions do
    13 // not require a system call.
     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.
    1415//
    1516// ALL locks must be defined in the mapping_info data structure,
    1617// to be initialised by the GIET in the boot phase.
    1718// The vobj_get_vbase() system call (defined in stdio.c and stdio.h files)
    18 // can be used to get the virtual base address of the lock from it's name.
     19// can be used to get the virtual base address of the lock fro it's name.
    1920///////////////////////////////////////////////////////////////////////////////////
    2021
     
    6465}
    6566
    66 //////////////////////////////////////////////////////////////////////////////
    67 // lock_try_acquire()
    68 //////////////////////////////////////////////////////////////////////////////
    69 int lock_try_acquire( giet_lock_t* lock )
    70 {
    71         register int ret = 0;   
    72     register unsigned int*      plock = &lock->value;
    73 
    74         asm volatile ("ll   $2,    0(%1)                    \n" // $2 <= _locks_lock
    75                   "bnez $2,    _lock_done           \n" // exitif busy
    76                   "li   $3,    1                            \n" // prepare argument for sc 
    77                   "sc   $3,    0(%1)                \n" // try to set _locks_busy
    78                   "xori %0, $3, 1                   \n" // ret = !$3
    79                   "_lock_done:                          \n"
    80                   :"=r"(ret)
    81                   :"r"(plock)
    82                   :"$2","$3");
    83     return ret;
    84 }
  • soft/giet_vm/libs/spin_lock.h

    r178 r189  
    2727void lock_release( giet_lock_t* lock );
    2828
    29 // return 0 if success
    30 int lock_try_acquire( giet_lock_t* lock );
    31 
    3229#endif
    3330
  • soft/giet_vm/libs/srl.h

    r178 r189  
    1919#include "libsrl/srl_hw_helpers.h"
    2020
    21 #include "libsrl/srl_args.h"
    22 
    2321//kernel use!
    2422//#include "libsrl/srl_mwmr_sys.h"
    2523
     24/* port, APP_NAME, TASK */
     25# define GET_MWMR(port)                                                                       \
     26({                                                                                            \
     27    srl_mwmr_t  _mwmr;                                                                      \
     28    if( vobj_get_vbase( APP_NAME , #port, MWMR, (unsigned int*)&_mwmr ) )                   \
     29    {                                                                                         \
     30        srl_log_printf( NONE, "\n[ERROR] in "TASK" task :\n");                              \
     31        srl_log_printf( NONE, "          undefined <"#port"> channel: %d\n", _mwmr);           \
     32        srl_log_printf( TRACE, "*** &"#port" = %x\n\n", (unsigned int)_mwmr );                 \
     33        exit();/*srl?*/                                                                     \
     34    }else                                                                                         \
     35        srl_log_printf( TRACE, "%s:%d: arg of %s for %s,from %s; &"#port" = %x\n\n", __FILE__, __LINE__, APP_NAME, TASK,#port, (unsigned int)_mwmr ); \
     36    _mwmr;\
     37})
    2638
    2739#endif
  • soft/giet_vm/libs/stdio.h

    r178 r189  
    88#ifndef _STDIO_H
    99#define _STDIO_H
    10 
    11 #include <mapping_info.h>
    12 #include <common.h>
    1310
    1411/* MIPS32 related functions */
     
    6461void         giet_exit();
    6562unsigned int giet_rand();
    66 unsigned int ctx_switch();
     63unsigned int giet_ctx_switch();
    6764unsigned int giet_procnumber();
    6865
     66#endif
    6967
    70 #endif
Note: See TracChangeset for help on using the changeset viewer.