Changeset 178 for soft/giet_vm/libs/libsrl
- Timestamp:
- Jul 22, 2012, 12:06:11 PM (13 years ago)
- Location:
- soft/giet_vm/libs/libsrl
- Files:
-
- 1 added
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/libs/libsrl/srl_barrier.h
r160 r178 6 6 * License. 7 7 * 8 * Copyright (c) 2006, Nicolas Pouillon, <nipo@ssji.net>9 8 * Laboratoire d'informatique de Paris 6 / ASIM, France 10 9 * … … 21 20 */ 22 21 23 #include "stdio.h" 24 #include "srl_log.h" 25 #include "srl_sched_wait.h" 22 #include "barrier.h" 26 23 27 24 28 typedef struct srl_abstract_barrier_s 29 { 30 unsigned int init_val; 31 unsigned int count; 32 33 } srl_barrier_s; 25 typedef giet_barrier_t *srl_barrier_t; 34 26 35 # define SRL_BARRIER_INITIALIZER(n){ .init_val=(n) , .count =(n)} 36 37 typedef srl_barrier_s *srl_barrier_t; 38 39 void srl_barrier_wait( srl_barrier_t barrier ); 40 27 #define srl_barrier_wait(bar) barrier_wait(bar) 41 28 42 29 #endif -
soft/giet_vm/libs/libsrl/srl_hw_helpers.h
r175 r178 9 9 10 10 #include "stdio.h" 11 12 typedef struct __ldscript_symbol_s __ldscript_symbol_t;13 14 #define BASE_ADDR_OF(id) \15 ({ \16 extern __ldscript_symbol_t _dsx_##id##_region_begin; \17 (void*)&_dsx_##id##_region_begin; \18 })19 11 20 12 … … 62 54 @return Cycles from the initialization of the system 63 55 */ 64 65 //static: to avoid multiple definition error66 56 static inline unsigned int srl_cycle_count() 67 57 { -
soft/giet_vm/libs/libsrl/srl_lock.h
r160 r178 21 21 */ 22 22 23 #include "srl_public_types.h" 24 #include "stdio.h" 23 #include "spin_lock.h" 25 24 26 typedef struct { 27 unsigned int lock; 28 }srl_lock_t; 29 30 #define SRL_LOCK_INITIALIZER { 0 } 25 typedef giet_lock_t* srl_lock_t; 31 26 32 27 /** … … 35 30 @param lock The lock object 36 31 */ 37 int srl_lock_lock( srl_lock_t lock);32 #define srl_lock_lock(lock) lock_acquire(lock); 38 33 39 34 /** 40 @this releases a l -ock.35 @this releases a lock. 41 36 42 37 @param lock The lock object 43 38 */ 44 void srl_lock_unlock( srl_lock_t lock);39 #define srl_lock_unlock( lock ) lock_release(lock); 45 40 46 41 /** … … 51 46 @return 0 if the lock was taken successfully 52 47 */ 53 int srl_lock_try_lock( srl_lock_tlock );48 #define srl_lock_try_lock( lock ) lock_try_acquire( lock ); 54 49 55 50 #endif -
soft/giet_vm/libs/libsrl/srl_memspace.h
r160 r178 8 8 */ 9 9 10 /**11 @internal12 */13 typedef struct srl_memspace_s {14 void *buffer;15 uint32_t size;16 } srl_memspace_s;17 10 18 11 /** 19 12 The memspace abstract type. 20 13 */ 21 typedef struct srl_memspace_s *srl_memspace_t; 22 23 #define SRL_MEMSPACE_INITIALIZER( b, s ) \ 24 {\ 25 .buffer = b,\ 26 .size = s,\ 27 } 28 29 /** 30 @this retrieves the base address of a memspace 31 32 @param memsp The memspace 33 @return the base address of the memspace 34 */ 35 #define SRL_MEMSPACE_ADDR(memsp) ((memsp)->buffer) 14 typedef void* srl_memspace_t; 36 15 37 16 /** -
soft/giet_vm/libs/libsrl/srl_mwmr.h
r175 r178 6 6 typedef mwmr_channel_t* srl_mwmr_t; 7 7 8 #define srl_mwmr_write mwmr_write 9 #define srl_mwmr_read mwmr_read 10 11 12 13 14 15 16 17 18 19 8 #define srl_mwmr_write(a, b, c) mwmr_write(a, b, c) 9 #define srl_mwmr_read(a, b, c) mwmr_read(a, b, c) 20 10 21 11 -
soft/giet_vm/libs/libsrl/srl_private_types.h
r160 r178 8 8 */ 9 9 10 #include "stdio.h"11 #include "srl_barrier.h"12 #include "srl_public_types.h"13 10 14 #define TTY_INC 1615 16 /**17 A numeric constant holder18 */19 typedef unsigned int srl_const_t;20 #define SRL_CONST_INITIALIZER(x) x21 22 typedef void srl_task_func_t( void* );23 24 typedef struct srl_abstract_task_s {25 srl_task_func_t *bootstrap;26 srl_task_func_t *func;27 void *args;28 void *stack;29 size_t stack_size;30 const char *name;31 // uint32_t context[CONTEXT_WSIZE];32 sint32_t wait_val;33 void *wait_addr;34 size_t tty_addr;35 }srl_task_s;36 37 #define SRL_TASK_INITIALIZER(b, f, ss, s, a, n, ttyc, ttyn) \38 { \39 .bootstrap = (srl_task_func_t *)b, \40 .func = (srl_task_func_t *)f, \41 .args = (void*)a, \42 .stack = (void*)s, \43 .stack_size = ss, \44 .name = n, \45 .tty_addr = (size_t)ttyc + (ttyn * TTY_INC), \46 }47 48 49 typedef struct srl_abstract_cpudesc_s srl_cpudesc_s;50 struct srl_abstract_cpudesc_s {51 const size_t ntasks;52 const srl_task_s * const *task_list;53 size_t tty_addr;54 };55 56 #define SRL_CPUDESC_INITIALIZER(nt, tl, ttyc, ttyn) \57 { \58 .ntasks = nt, \59 .task_list = tl, \60 .tty_addr = (size_t)ttyc + (ttyn * TTY_INC),\61 }62 63 typedef struct srl_abstract_appdesc_s srl_appdesc_s;64 struct srl_abstract_appdesc_s {65 const size_t ntasks;66 srl_barrier_s *start;67 const struct srl_mwmr_s * const *mwmr;68 const srl_cpudesc_s * const *cpu;69 const srl_task_s * const *task;70 size_t tty_addr;71 };72 73 #define SRL_APPDESC_INITIALIZER(nt, cl, ml, tl, sb, ttyc, ttyn) \74 { \75 .ntasks = nt, \76 .cpu = cl, \77 .mwmr = ml, \78 .task = tl, \79 .start = sb, \80 .tty_addr = (size_t)ttyc + (ttyn * TTY_INC), \81 }82 83 //needed by gcc84 void *memcpy(void *_dst, const void *_src, unsigned int size);85 void * memset(void *dst, int data, size_t size);86 87 88 /**89 * All function needed by kmain has to be tagged with in_srl_main90 * typically: srl_mwmw_sys91 */92 #define in_srl_main __attribute__((section (".srl_main")))93 11 94 12 /** … … 97 15 #define cpu_mem_write_32(addr, data) *((volatile uint32_t*)(addr)) = data 98 16 99 #define uintptr_t unsigned int100 101 17 #endif -
soft/giet_vm/libs/libsrl/srl_sched_wait.c
r160 r178 17 17 * 18 18 * Copyright (c) UPMC, Lip6, SoC 19 * Nicolas Pouillon <nipo@ssji.net>, 200820 19 */ 21 20 … … 27 26 #define endian_cpu32(x) (x) 28 27 29 #define DECLARE_WAIT(name, cmp) 30 31 void srl_sched_wait_##name( void *addr, sint32_t val ) 32 { 33 dcache_flush(addr, sizeof(addr));\34 if ( ((sint32_t)*((unsigned int *)addr)) cmp val ) 35 return; 36 do { 37 context_switch();\38 dcache_flush(addr, sizeof(addr));\39 } while (((sint32_t)*((unsigned int*)addr)) cmp val ); 28 #define DECLARE_WAIT(name, cmp) \ 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 ); \ 40 39 } 41 40 … … 54 53 DECLARE_WAIT(gt, >) 55 54 55 //TODO 56 56 void srl_sched_wait_priv(uint32_t date ) 57 57 {
Note: See TracChangeset
for help on using the changeset viewer.