Changeset 189 for soft/giet_vm/libs
- Timestamp:
- Aug 7, 2012, 6:37:49 PM (12 years ago)
- Location:
- soft/giet_vm/libs
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/libs/mwmr_channel.c
r178 r189 33 33 #include <mwmr_channel.h> 34 34 #include <stdio.h> 35 #include <common.h>36 35 37 36 ////////////////////////////////////////////////////////////////////////////// … … 74 73 // after a random delay. 75 74 ////////////////////////////////////////////////////////////////////////////// 76 void mwmr_write( mwmr_channel_t* 77 const unsigned int*buffer,78 unsigned int 75 void mwmr_write( mwmr_channel_t* mwmr, 76 unsigned int* buffer, 77 unsigned int nitems ) 79 78 { 80 79 unsigned int x; … … 86 85 unsigned int ptw; // channel ptw 87 86 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"); 92 91 93 92 while(1) … … 163 162 unsigned int ptr; // channel ptw 164 163 165 if(nitems == 0) 166 return; 167 164 if(nitems == 0) return; 165 166 // address virtuelle 0 is illegal... 168 167 assert(buffer && "mwmr read: Empty buffer"); 169 168 -
soft/giet_vm/libs/mwmr_channel.h
r179 r189 20 20 unsigned int sts; // number of words available 21 21 unsigned int depth; // max number of words in the channel 22 unsigned int width; // number of word in an item22 unsigned int width; // number of words in an item 23 23 unsigned int lock; // exclusive access lock 24 unsigned int data[1 ]; // circular buffer24 unsigned int data[1018]; // circular buffer 25 25 } mwmr_channel_t; 26 26 … … 29 29 ////////////////////////////////////////////////////////////////////////////// 30 30 31 void mwmr_write( mwmr_channel_t* 32 const unsigned int*buffer,33 unsigned int 31 void mwmr_write( mwmr_channel_t* mwmr, 32 unsigned int* buffer, 33 unsigned int nitems ); 34 34 35 35 void mwmr_read( mwmr_channel_t* mwmr, -
soft/giet_vm/libs/spin_lock.c
r178 r189 10 10 // It is a simple binary lock, without waiting queue. 11 11 // 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. 14 15 // 15 16 // ALL locks must be defined in the mapping_info data structure, 16 17 // to be initialised by the GIET in the boot phase. 17 18 // 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 fro mit's name.19 // can be used to get the virtual base address of the lock fro it's name. 19 20 /////////////////////////////////////////////////////////////////////////////////// 20 21 … … 64 65 } 65 66 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_lock75 "bnez $2, _lock_done \n" // exitif busy76 "li $3, 1 \n" // prepare argument for sc77 "sc $3, 0(%1) \n" // try to set _locks_busy78 "xori %0, $3, 1 \n" // ret = !$379 "_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 27 27 void lock_release( giet_lock_t* lock ); 28 28 29 // return 0 if success30 int lock_try_acquire( giet_lock_t* lock );31 32 29 #endif 33 30 -
soft/giet_vm/libs/srl.h
r178 r189 19 19 #include "libsrl/srl_hw_helpers.h" 20 20 21 #include "libsrl/srl_args.h"22 23 21 //kernel use! 24 22 //#include "libsrl/srl_mwmr_sys.h" 25 23 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 }) 26 38 27 39 #endif -
soft/giet_vm/libs/stdio.h
r178 r189 8 8 #ifndef _STDIO_H 9 9 #define _STDIO_H 10 11 #include <mapping_info.h>12 #include <common.h>13 10 14 11 /* MIPS32 related functions */ … … 64 61 void giet_exit(); 65 62 unsigned int giet_rand(); 66 unsigned int ctx_switch();63 unsigned int giet_ctx_switch(); 67 64 unsigned int giet_procnumber(); 68 65 66 #endif 69 67 70 #endif
Note: See TracChangeset
for help on using the changeset viewer.