Changeset 228 for soft/giet_vm/libs/libsrl
- Timestamp:
- Feb 12, 2013, 6:33:31 PM (12 years ago)
- Location:
- soft/giet_vm/libs/libsrl
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/libs/libsrl/srl_args.h
r215 r228 4 4 5 5 6 #define SRL_GET_MWMR(port) (srl_mwmr_t) APP_GET_ARG(port, VOBJ_TYPE_MWMR)7 #define SRL_GET_BARRIER(port) APP_GET_ARG(port, VOBJ_TYPE_BARRIER)8 #define SRL_GET_LOCK(port) APP_GET_ARG(port, VOBJ_TYPE_LOCK)9 //#define SRL_GET_MEMSPACE(port) APP_GET_ARG(port, VOBJ_TYPE_BUFFER) TODO 10 #define SRL_GET_MEMSPACE #error "SRL_GET_MEMSPACE is not implemented"//6 #define SRL_GET_MWMR(port) (srl_mwmr_t) APP_GET_ARG(port, VOBJ_TYPE_MWMR) 7 #define SRL_GET_BARRIER(port) (srl_barrier_t) APP_GET_ARG(port, VOBJ_TYPE_BARRIER) 8 #define SRL_GET_LOCK(port) APP_GET_ARG(port, VOBJ_TYPE_LOCK) 9 #define SRL_GET_CONST(port) APP_GET_ARG(port, VOBJ_TYPE_CONST) 10 #define SRL_GET_MEMSPACE(port) (srl_memspace_t) APP_GET_ARG(port, VOBJ_TYPE_MEMSPACE) 11 11 12 12 … … 14 14 ({ \ 15 15 unsigned int vbase; \ 16 if ( giet_vobj_get_vbase( APP_NAME , alias_##task_name.port, type, &vbase ) )\16 if (giet_vobj_get_vbase(APP_NAME , alias_##task_name.port, type, &vbase)) \ 17 17 { \ 18 srl_log_printf( NONE, "\n[ERROR] in "#task_name" task :\n");\19 srl_log_printf( NONE, " undefined port <"#port"> for channel(%s): %d\n",\20 alias_##task_name.port, vbase);\21 srl_log_printf( TRACE, "*** &"#port" = %x\n\n", vbase );\18 srl_log_printf(NONE, "\n[ERROR] in "#task_name" task :\n"); \ 19 srl_log_printf(NONE, " undefined port <"#port"> for channel \"%s\": %x\n", \ 20 alias_##task_name.port, vbase); \ 21 srl_log_printf(TRACE, "*** &"#port" = %x\n\n", vbase); \ 22 22 srl_exit(); \ 23 }else \ 24 srl_log_printf( TRACE, "%s:%d: arg of %s for %s,from %s; &"#port" = %x\n\n", \ 25 __FILE__, __LINE__, APP_NAME, #task_name,#port, vbase ); \ 26 vbase;\ 23 } \ 24 else \ 25 srl_log_printf(TRACE, "%s:%d: arg of %s for %s, from %s; &"#port" = %x\n\n", \ 26 __FILE__, __LINE__, APP_NAME, #task_name, #port, vbase); \ 27 vbase; \ 27 28 }) 28 29 -
soft/giet_vm/libs/libsrl/srl_barrier.h
r178 r228 23 23 24 24 25 typedef giet_barrier_t * srl_barrier_t;25 typedef giet_barrier_t * srl_barrier_t; 26 26 27 27 #define srl_barrier_wait(bar) barrier_wait(bar) 28 28 29 29 #endif 30 31 32 // Local Variables: 33 // tab-width: 4 34 // c-basic-offset: 4 35 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 36 // indent-tabs-mode: nil 37 // End: 38 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 39 -
soft/giet_vm/libs/libsrl/srl_endianness.h
r160 r228 5 5 6 6 /** @this reads a big endian 16 bits value */ 7 # define endian_le16(x) 7 # define endian_le16(x) (x) 8 8 /** @this reads a big endian 32 bits value */ 9 # define endian_le32(x) 9 # define endian_le32(x) (x) 10 10 /** @this reads a big endian 64 bits value */ 11 //# define endian_le64(x) 11 //# define endian_le64(x) (x) 12 12 /** @this reads a little endian 16 bits value */ 13 # define endian_be16(x) 13 # define endian_be16(x) endian_swap16(x) 14 14 /** @this reads a little endian 32 bits value */ 15 # define endian_be32(x) 15 # define endian_be32(x) endian_swap32(x) 16 16 /** @this reads a little endian 64 bits value */ 17 //# define endian_be64(x) 17 //# define endian_be64(x) endian_swap64(x) 18 18 19 19 /** @internal */ 20 static inline uint16_t endian_swap16(uint16_t x) 21 { 22 return (x >> 8) | (x << 8); 20 static inline uint16_t endian_swap16(uint16_t x) { 21 return (x >> 8) | (x << 8); 23 22 } 24 23 24 25 25 /** @internal */ 26 static inline uint32_t endian_swap32(uint32_t x) 27 { 28 return (((x >> 24) & 0x000000ff) | 29 ((x >> 8 ) & 0x0000ff00) | 30 ((x << 8 ) & 0x00ff0000) | 31 ((x << 24) & 0xff000000)); 26 static inline uint32_t endian_swap32(uint32_t x) { 27 return (((x >> 24) & 0x000000ff) | 28 ((x >> 8 ) & 0x0000ff00) | 29 ((x << 8 ) & 0x00ff0000) | 30 ((x << 24) & 0xff000000)); 32 31 } 33 32 33 34 34 /** @internal *//* 35 static inline uint64_t __endian_swap64(uint64_t x)36 {37 return (((uint64_t)endian_swap32(x ) << 32) |38 39 }*/35 static inline uint64_t __endian_swap64(uint64_t x) 36 { 37 return (((uint64_t)endian_swap32(x ) << 32) | 38 ((uint64_t)endian_swap32(x >> 32) )); 39 }*/ 40 40 41 static inline uint32_t srl_uint32_le_to_machine(uint32_t x) 42 { 43 return endian_le32(x); 41 static inline uint32_t srl_uint32_le_to_machine(uint32_t x) { 42 return endian_le32(x); 44 43 } 45 44 46 static inline uint32_t srl_uint32_machine_to_le(uint32_t x) 47 {48 45 46 static inline uint32_t srl_uint32_machine_to_le(uint32_t x) { 47 return endian_le32(x); 49 48 } 50 49 51 static inline uint32_t srl_uint32_be_to_machine(uint32_t x) 52 {53 50 51 static inline uint32_t srl_uint32_be_to_machine(uint32_t x) { 52 return endian_be32(x); 54 53 } 55 54 56 static inline uint32_t srl_uint32_machine_to_be(uint32_t x) 57 {58 55 56 static inline uint32_t srl_uint32_machine_to_be(uint32_t x) { 57 return endian_be32(x); 59 58 } 60 59 61 static inline uint16_t srl_uint16_le_to_machine(uint16_t x) 62 {63 60 61 static inline uint16_t srl_uint16_le_to_machine(uint16_t x) { 62 return endian_le16(x); 64 63 } 65 64 66 static inline uint16_t srl_uint16_machine_to_le(uint16_t x) 67 {68 65 66 static inline uint16_t srl_uint16_machine_to_le(uint16_t x) { 67 return endian_le16(x); 69 68 } 70 69 71 static inline uint16_t srl_uint16_be_to_machine(uint16_t x) 72 {73 70 71 static inline uint16_t srl_uint16_be_to_machine(uint16_t x) { 72 return endian_be16(x); 74 73 } 75 74 76 static inline uint16_t srl_uint16_machine_to_be(uint16_t x) 77 {78 75 76 static inline uint16_t srl_uint16_machine_to_be(uint16_t x) { 77 return endian_be16(x); 79 78 } 80 79 81 80 82 81 #endif 82 83 84 // Local Variables: 85 // tab-width: 4 86 // c-basic-offset: 4 87 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 88 // indent-tabs-mode: nil 89 // End: 90 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 91 -
soft/giet_vm/libs/libsrl/srl_hw_helpers.h
r178 r228 12 12 13 13 /** 14 15 */14 Standard API call, expands to nothing for this implementation. 15 */ 16 16 #define srl_busy_cycles(n) do{}while(0) 17 17 18 18 //void useless(void *pointless,...){} 19 19 /** 20 21 */20 @this flushes the cache line containing the address. 21 */ 22 22 //TODO 23 23 #define srl_dcache_flush_addr 0 24 24 25 25 /* 26 static inline cpu_dcache_invld(void *ptr){27 asm volatile ( 28 " cache %0, %1"29 : : "i" (0x11) , "R" (*(uint8_t*)(ptr))30 : "memory"31 );32 }33 */26 static inline cpu_dcache_invld(void *ptr){ 27 asm volatile ( 28 " cache %0, %1" 29 : : "i" (0x11) , "R" (*(uint8_t*)(ptr)) 30 : "memory" 31 ); 32 } 33 */ 34 34 35 35 /** 36 37 */36 @this flushes a memory zone from cache. 37 */ 38 38 //TODO 39 39 //void dcache_flush(const void * addr, size_t size) … … 41 41 42 42 /** 43 44 43 @this waits for at least the given time (in cycles). The actual 44 time spent in this call is not predictable. 45 45 46 47 */48 void srl_sleep_cycles( unsigned int time);46 @param time Number of cycles to wait for 47 */ 48 void srl_sleep_cycles(unsigned int time); 49 49 50 50 /** 51 52 51 @this returns the absolute timestamp counter from the 52 initialization of the platform. 53 53 54 @return Cycles from the initialization of the system 55 */ 56 static inline unsigned int srl_cycle_count() 57 { 58 return giet_proctime(); 54 @return Cycles from the initialization of the system 55 */ 56 static inline unsigned int srl_cycle_count() { 57 return giet_proctime(); 59 58 } 60 59 60 61 61 /** 62 @this aborts the current execution. On most systems, @this will 63 simply hang. 64 */ 65 static inline void srl_abort() 66 { 67 asm volatile ("break 0"); 68 while(1); 62 @this aborts the current execution. On most systems, @this will 63 simply hang. 64 */ 65 static inline void srl_abort() { 66 asm volatile ("break 0"); 67 while (1); 69 68 } 69 70 70 71 71 /** 72 72 * 73 73 */ 74 static inline void srl_exit() 75 { 74 static inline void srl_exit() { 76 75 giet_exit(); 77 76 } 78 77 79 78 #endif 79 80 // Local Variables: 81 // tab-width: 4 82 // c-basic-offset: 4 83 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 84 // indent-tabs-mode: nil 85 // End: 86 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 87 -
soft/giet_vm/libs/libsrl/srl_lock.h
r178 r228 23 23 #include "spin_lock.h" 24 24 25 typedef giet_lock_t * srl_lock_t;25 typedef giet_lock_t * srl_lock_t; 26 26 27 27 /** … … 49 49 50 50 #endif 51 52 53 // Local Variables: 54 // tab-width: 4 55 // c-basic-offset: 4 56 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 57 // indent-tabs-mode: nil 58 // End: 59 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 60 -
soft/giet_vm/libs/libsrl/srl_memspace.h
r178 r228 1 1 #ifndef SRL_MEMSPACE_H 2 2 #define SRL_MEMSPACE_H 3 4 #include "srl_public_types.h" 5 6 #include <memspace.h> 3 7 4 8 /** … … 12 16 The memspace abstract type. 13 17 */ 14 typedef void* srl_memspace_t; 18 19 20 typedef giet_memspace_t * srl_memspace_t; 15 21 16 22 /** … … 21 27 */ 22 28 #define SRL_MEMSPACE_SIZE(memsp) ((memsp)->size) 29 #define SRL_MEMSPACE_ADDR(memsp) ((memsp)->buffer) 30 23 31 24 32 #endif 33 34 // Local Variables: 35 // tab-width: 4 36 // c-basic-offset: 4 37 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 38 // indent-tabs-mode: nil 39 // End: 40 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 41 -
soft/giet_vm/libs/libsrl/srl_mwmr.h
r213 r228 4 4 #include "mwmr_channel.h" 5 5 6 typedef mwmr_channel_t * srl_mwmr_t;6 typedef mwmr_channel_t * srl_mwmr_t; 7 7 8 #define srl_mwmr_write(a, b, c) mwmr_write(a, (unsigned int *) b, (unsigned int)c)9 #define srl_mwmr_read(a, b, c) mwmr_read(a, (unsigned int *) b, (unsigned int)c)8 #define srl_mwmr_write(a, b, c) mwmr_write(a, (unsigned int *) b, (unsigned int) c) 9 #define srl_mwmr_read(a, b, c) mwmr_read(a, (unsigned int *) b, (unsigned int) c) 10 10 11 11 12 12 #endif //fin de SRL_MWMR_H_ 13 14 // Local Variables: 15 // tab-width: 4 16 // c-basic-offset: 4 17 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 18 // indent-tabs-mode: nil 19 // End: 20 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 21 -
soft/giet_vm/libs/libsrl/srl_private_types.c
r160 r228 1 1 2 #include "srl_private_types.h" 2 3 … … 6 7 // GCC requires this function. Taken from MutekH. 7 8 //////////////////////////////////////////////////////////////////////////////////////// 8 void *memcpy(void *_dst, const void *_src, unsigned int size) 9 { 10 unsigned int *dst = _dst; 11 const unsigned int *src = _src; 12 if ( ! ((unsigned int)dst & 3) && ! ((unsigned int)src & 3) ) 9 void * memcpy(void *_dst, const void * _src, unsigned int size) { 10 unsigned int * dst = _dst; 11 const unsigned int * src = _src; 12 if (!((unsigned int) dst & 3) && !((unsigned int) src & 3) ) 13 13 while (size > 3) { 14 14 *dst++ = *src++; … … 25 25 } 26 26 27 27 28 //////////////////////////////////////////////////////////////////////////////////////// 28 29 // mempcy() 29 30 // GCC requires this function. Taken from MutekH. 30 31 //////////////////////////////////////////////////////////////////////////////////////// 31 inline void * memset(void * dst, int s, size_t count)32 { 33 /* 34 int8_t s = _s;35 const reg_t v = (uint8_t)s * (reg_t)0x0101010101010101LL;36 int8_t *a =dst;37 reg_t *r; 32 inline void * memset(void * dst, int s, size_t count) { 33 char * a = (char *) dst; 34 while (count--){ 35 *a++ = (char)s; 36 } 37 return dst; 38 } 38 39 39 // align40 while ( ((uintptr_t *)a & reg_t_log2_m1) && count )41 count--, *a++ = s;42 40 43 size_t ucount = count & reg_t_log2_m1; 44 count &= ~reg_t_log2_m1; 41 // Local Variables: 42 // tab-width: 4 43 // c-basic-offset: 4 44 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 45 // indent-tabs-mode: nil 46 // End: 47 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 45 48 46 for (r = (reg_t*)a; count; count -= sizeof(reg_t))47 *r++ = v;48 49 for (a = (int8_t*)r; ucount; ucount--)50 *a++ = s;51 52 */53 char *a = (char *) dst;54 while (count--){55 *a++ = (char)s;56 }57 58 return dst;59 } -
soft/giet_vm/libs/libsrl/srl_sched_wait.c
r178 r228 28 28 #define DECLARE_WAIT(name, cmp) \ 29 29 \ 30 void srl_sched_wait_##name( void *addr, sint32_t val ) \ 31 { \ 32 srl_dcache_flush_addr(addr); \ 33 if ( ((sint32_t)*((unsigned int *)addr)) cmp val ) \ 34 return; \ 35 do { \ 36 srl_sched_wait_priv(100);?? \ 37 srl_dcache_flush_addr(addr); \ 38 } while (((sint32_t)*((unsigned int*)addr)) cmp val ); \ 39 } 30 void srl_sched_wait_##name(void * addr, sint32_t val) { \ 31 srl_dcache_flush_addr(addr); \ 32 if (((sint32_t) * ((unsigned int *) addr)) cmp val) \ 33 return; \ 34 do { \ 35 srl_sched_wait_priv(100);?? \ 36 srl_dcache_flush_addr(addr); \ 37 } while (((sint32_t) * ((unsigned int *) addr)) cmp val); \ 38 } 40 39 41 40 … … 53 52 DECLARE_WAIT(gt, >) 54 53 55 //TODO 56 void srl_sched_wait_priv(uint32_t date ) 57 { 58 do{ 59 context_switch(); 60 }while (srl_cycle_count() > date); 54 //TODO 55 void srl_sched_wait_priv(uint32_t date) { 56 do { 57 context_switch(); 58 } while (srl_cycle_count() > date); 61 59 } 62 60 63 void srl_sleep_cycles( uint32_t n ) 64 { 65 uint32_t next_run_to = srl_cycle_count()+n; 61 void srl_sleep_cycles(uint32_t n) { 62 uint32_t next_run_to = srl_cycle_count() + n; 66 63 67 while(srl_cycle_count() < next_run_to) 68 srl_sched_wait_priv(next_run_to); 64 while (srl_cycle_count() < next_run_to) { 65 srl_sched_wait_priv(next_run_to); 66 } 69 67 } 70 68 69 70 // Local Variables: 71 // tab-width: 4 72 // c-basic-offset: 4 73 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 74 // indent-tabs-mode: nil 75 // End: 76 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 77 -
soft/giet_vm/libs/libsrl/srl_sched_wait.h
r160 r228 35 35 36 36 37 void srl_sleep_cycles( unsigned int n);37 void srl_sleep_cycles(unsigned int n); 38 38 39 39 #endif 40 41 42 // Local Variables: 43 // tab-width: 4 44 // c-basic-offset: 4 45 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 46 // indent-tabs-mode: nil 47 // End: 48 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 49
Note: See TracChangeset
for help on using the changeset viewer.