Changeset 521 for soft/giet_vm/giet_libs
- Timestamp:
- Mar 10, 2015, 3:14:52 PM (10 years ago)
- Location:
- soft/giet_vm/giet_libs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/mwmr_channel.h
r479 r521 32 32 /////////////////////////////////////////////////////////////////////////////////// 33 33 // MWMR channel structure 34 // The data buffer size is defined to obtain sizeof(mwmr_channel_t) = 4096 bytes.35 // The actual buffer size cannot be larger than 4072 bytes (1018 words).36 34 /////////////////////////////////////////////////////////////////////////////////// 37 35 38 36 typedef struct mwmr_channel_s 39 37 { 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 38 user_lock_t lock; // exclusive access lock 39 unsigned int sts; // number of words available 40 unsigned int ptr; // index of the first valid data word 41 unsigned int ptw; // index of the first empty slot 42 unsigned int depth; // max number of words in the channel 43 unsigned int width; // number of words in an item 44 unsigned int* data; // circular buffer base address 45 unsigned int padding[10]; // for 64 bytes alignment 47 46 } mwmr_channel_t; 48 47 -
soft/giet_vm/giet_libs/stdio.c
r501 r521 1 ////////////////////////////////////////////////////////////////////////////// ////1 ////////////////////////////////////////////////////////////////////////////// 2 2 // File : stdio.c 3 3 // Date : 01/04/2010 4 4 // Author : alain greiner & Joel Porquet 5 5 // Copyright (c) UPMC-LIP6 6 ////////////////////////////////////////////////////////////////////////////// /////6 ////////////////////////////////////////////////////////////////////////////// 7 7 8 8 #include <stdarg.h> … … 10 10 #include <giet_config.h> 11 11 12 ////////////////////////////////////////////////////////////////////////////// //////13 ///////////////////// MIPS32 related system calls /////////////////////// //////14 ////////////////////////////////////////////////////////////////////////////// //////12 ////////////////////////////////////////////////////////////////////////////// 13 ///////////////////// MIPS32 related system calls /////////////////////// 14 ////////////////////////////////////////////////////////////////////////////// 15 15 16 16 //////////////////////////////////////////// … … 48 48 } 49 49 50 ////////////////////////////////////////////////////////////////////////////// ////51 ///////////////////// Task context system calls ///////////////////////////// ////52 ////////////////////////////////////////////////////////////////////////////// ////50 ////////////////////////////////////////////////////////////////////////////// 51 ///////////////////// Task context system calls ///////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////// 53 53 54 54 //////////////////////////////// … … 74 74 75 75 76 //////////////////////////////////////////////////////////////////////////////////// 77 ///////////////////// TTY device related system calls ///////////////////////////// 78 //////////////////////////////////////////////////////////////////////////////////// 76 ////////////////////////////////////////////////////////////////////////////// 77 ///////////////////// Coprocessors system calls //////////////////////////// 78 ////////////////////////////////////////////////////////////////////////////// 79 80 /////////////////////////////////////////////////// 81 void giet_coproc_alloc( unsigned int coproc_type, 82 unsigned int* coproc_info, 83 unsigned int* cluster_xy ) 84 { 85 if ( sys_call( SYSCALL_COPROC_ALLOC, 86 coproc_type, 87 (unsigned int)coproc_info, 88 (unsigned int)cluster_xy, 89 0 ) ) 90 giet_exit("error in giet_coproc_alloc()"); 91 } 92 93 /////////////////////////////////////////////////// 94 void giet_coproc_release( unsigned int cluster_xy ) 95 { 96 if ( sys_call( SYSCALL_COPROC_RELEASE, 97 cluster_xy, 98 0, 0, 0 ) ) 99 giet_exit("error in giet_coproc_release()"); 100 } 101 102 ////////////////////////////////////////////////////////////////// 103 void giet_coproc_channel_init( unsigned int cluster_xy, 104 unsigned int channel, 105 giet_coproc_channel_t* desc ) 106 { 107 if ( sys_call( SYSCALL_COPROC_CHANNEL_INIT, 108 cluster_xy, 109 channel, 110 (unsigned int)desc, 111 0 ) ) 112 giet_exit("error in giet_coproc_channel_init"); 113 } 114 115 //////////////////////////////////////////////////////////// 116 void giet_coproc_channel_start( unsigned int cluster_xy, 117 unsigned int channel ) 118 { 119 if ( sys_call( SYSCALL_COPROC_CHANNEL_START, 120 cluster_xy, 121 channel, 122 0, 0 ) ) 123 giet_exit("error in giet_coproc_channel_start"); 124 } 125 126 /////////////////////////////////////////////////////////// 127 void giet_coproc_channel_stop( unsigned int cluster_xy, 128 unsigned int channel ) 129 { 130 if ( sys_call( SYSCALL_COPROC_CHANNEL_STOP, 131 cluster_xy, 132 channel, 133 0, 0 ) ) 134 giet_exit("error in giet_coproc_channel_stop"); 135 } 136 137 ///////////////////////////////////////////////////////// 138 void giet_coproc_completed( unsigned int cluster_xy ) 139 { 140 if ( sys_call( SYSCALL_COPROC_COMPLETED, 141 cluster_xy, 142 0, 0, 0 ) ) 143 giet_exit("error in giet_coproc_completed"); 144 } 145 146 /////////////////////////////////////////////////////////// 147 void giet_coproc_register_set( unsigned int cluster_xy, 148 unsigned int index, 149 unsigned int value ) 150 { 151 if ( sys_call( SYSCALL_COPROC_REGISTER_SET, 152 cluster_xy, 153 index, 154 value, 155 0 ) ) 156 giet_exit("error in giet_coproc_register_set"); 157 } 158 159 /////////////////////////////////////////////////////////// 160 void giet_coproc_register_get( unsigned int cluster_xy, 161 unsigned int index, 162 unsigned int* value ) 163 { 164 if ( sys_call( SYSCALL_COPROC_REGISTER_SET, 165 cluster_xy, 166 index, 167 (unsigned int)value, 168 0 ) ) 169 giet_exit("error in giet_coproc_register_get"); 170 } 171 172 173 ////////////////////////////////////////////////////////////////////////////// 174 ///////////////////// TTY device related system calls /////////////////////// 175 ////////////////////////////////////////////////////////////////////////////// 79 176 80 177 ///////////////////// 81 178 void giet_tty_alloc() 82 179 { 83 sys_call( SYSCALL_TTY_ALLOC, 0, 0 ,0 ,0 ); 180 if ( sys_call( SYSCALL_TTY_ALLOC, 181 0, 0, 0, 0 ) ) giet_exit("error in giet_tty_alloc()"); 84 182 } 85 183 -
soft/giet_vm/giet_libs/stdio.h
r501 r521 1 ///////////////////////////////////////////////////////////////////////////// /////1 ///////////////////////////////////////////////////////////////////////////// 2 2 // File : stdio.h 3 3 // Date : 01/04/2010 4 4 // Author : alain greiner & Joel Porquet 5 5 // Copyright (c) UPMC-LIP6 6 ///////////////////////////////////////////////////////////////////////////// //////6 ///////////////////////////////////////////////////////////////////////////// 7 7 // The stdio.c and stdio.h files are part of the GIET_VM nano-kernel. 8 8 // This library contains all user-level functions that contain a system call 9 9 // to access protected or shared ressources. 10 ///////////////////////////////////////////////////////////////////////////// //////10 ///////////////////////////////////////////////////////////////////////////// 11 11 12 12 #ifndef _STDIO_H … … 16 16 // the _syscall_vector defined in file sys_handler.c 17 17 18 #define SYSCALL_PROC_XYP 0x0019 #define SYSCALL_PROC_TIME 0x0120 #define SYSCALL_TTY_WRITE 0x0221 #define SYSCALL_TTY_READ 0x0322 #define SYSCALL_TTY_ALLOC 0x0423 #define SYSCALL_TTY_GET_LOCK 0x0524 #define SYSCALL_TTY_RELEASE_LOCK 0x0625 #define SYSCALL_HEAP_INFO 0x0726 #define SYSCALL_LOCAL_TASK_ID 0x0827 #define SYSCALL_GLOBAL_TASK_ID 0x0928 #define SYSCALL_FBF_CMA_ALLOC 0x0A29 #define SYSCALL_FBF_CMA_START 0x0B30 #define SYSCALL_FBF_CMA_DISPLAY 0x0C31 #define SYSCALL_FBF_CMA_STOP 0x0D32 #define SYSCALL_EXIT 0x0E33 #define SYSCALL_PROCS_NUMBER 0x0F34 35 #define SYSCALL_FBF_SYNC_WRITE 0x1036 #define SYSCALL_FBF_SYNC_READ 0x1137 #define SYSCALL_THREAD_ID 0x1238 // 0x1339 #define SYSCALL_TIM_ALLOC 0x1440 #define SYSCALL_TIM_START 0x1541 #define SYSCALL_TIM_STOP 0x1642 // 0x1743 // 0x1844 #define SYSCALL_CTX_SWITCH 0x1945 #define SYSCALL_VOBJ_GET_VBASE 0x1A46 #define SYSCALL_VOBJ_GET_LENGTH 0x1B47 #define SYSCALL_GET_XY 0x1C48 // 0x1D49 // 0x1E50 // 0x1F51 52 #define SYSCALL_FAT_OPEN 0x2053 #define SYSCALL_FAT_READ 0x2154 #define SYSCALL_FAT_WRITE 0x2255 #define SYSCALL_FAT_LSEEK 0x2356 #define SYSCALL_FAT_FSTAT 0x2457 #define SYSCALL_FAT_CLOSE 0x2558 // 0x2659 // 0x2760 // 0x2861 // 0x2962 // 0x2A63 // 0x2B64 // 0x2C65 // 0x2D66 // 0x2E67 // 0x2F68 69 #define SYSCALL_NIC_ALLOC 0x3070 #define SYSCALL_NIC_START 0x3171 #define SYSCALL_NIC_MOVE 0x3272 #define SYSCALL_NIC_STOP 0x3373 #define SYSCALL_NIC_STATS 0x3474 #define SYSCALL_NIC_CLEAR 0x3575 // 0x3676 // 0x3777 //0x3878 //0x3979 //0x3A80 //0x3B81 //0x3C82 //0x3D83 //0x3E84 //0x3F85 86 //////////////////////////////////////////////////////////////////////////// //////18 #define SYSCALL_PROC_XYP 0x00 19 #define SYSCALL_PROC_TIME 0x01 20 #define SYSCALL_TTY_WRITE 0x02 21 #define SYSCALL_TTY_READ 0x03 22 #define SYSCALL_TTY_ALLOC 0x04 23 #define SYSCALL_TTY_GET_LOCK 0x05 24 #define SYSCALL_TTY_RELEASE_LOCK 0x06 25 #define SYSCALL_HEAP_INFO 0x07 26 #define SYSCALL_LOCAL_TASK_ID 0x08 27 #define SYSCALL_GLOBAL_TASK_ID 0x09 28 #define SYSCALL_FBF_CMA_ALLOC 0x0A 29 #define SYSCALL_FBF_CMA_START 0x0B 30 #define SYSCALL_FBF_CMA_DISPLAY 0x0C 31 #define SYSCALL_FBF_CMA_STOP 0x0D 32 #define SYSCALL_EXIT 0x0E 33 #define SYSCALL_PROCS_NUMBER 0x0F 34 35 #define SYSCALL_FBF_SYNC_WRITE 0x10 36 #define SYSCALL_FBF_SYNC_READ 0x11 37 #define SYSCALL_THREAD_ID 0x12 38 // 0x13 39 #define SYSCALL_TIM_ALLOC 0x14 40 #define SYSCALL_TIM_START 0x15 41 #define SYSCALL_TIM_STOP 0x16 42 // 0x17 43 // 0x18 44 #define SYSCALL_CTX_SWITCH 0x19 45 #define SYSCALL_VOBJ_GET_VBASE 0x1A 46 #define SYSCALL_VOBJ_GET_LENGTH 0x1B 47 #define SYSCALL_GET_XY 0x1C 48 // 0x1D 49 // 0x1E 50 // 0x1F 51 52 #define SYSCALL_FAT_OPEN 0x20 53 #define SYSCALL_FAT_READ 0x21 54 #define SYSCALL_FAT_WRITE 0x22 55 #define SYSCALL_FAT_LSEEK 0x23 56 #define SYSCALL_FAT_FSTAT 0x24 57 #define SYSCALL_FAT_CLOSE 0x25 58 // 0x26 59 // 0x27 60 // 0x28 61 // 0x29 62 // 0x2A 63 // 0x2B 64 // 0x2C 65 // 0x2D 66 // 0x2E 67 // 0x2F 68 69 #define SYSCALL_NIC_ALLOC 0x30 70 #define SYSCALL_NIC_START 0x31 71 #define SYSCALL_NIC_MOVE 0x32 72 #define SYSCALL_NIC_STOP 0x33 73 #define SYSCALL_NIC_STATS 0x34 74 #define SYSCALL_NIC_CLEAR 0x35 75 // 0x36 76 // 0x37 77 #define SYSCALL_COPROC_REGISTER_GET 0x38 78 #define SYSCALL_COPROC_REGISTER_SET 0x39 79 #define SYSCALL_COPROC_RELEASE 0x3A 80 #define SYSCALL_COPROC_COMPLETED 0x3B 81 #define SYSCALL_COPROC_ALLOC 0x3C 82 #define SYSCALL_COPROC_CHANNEL_INIT 0x3D 83 #define SYSCALL_COPROC_CHANNEL_START 0x3E 84 #define SYSCALL_COPROC_CHANNEL_STOP 0x3F 85 86 //////////////////////////////////////////////////////////////////////////// 87 87 // NULL pointer definition 88 //////////////////////////////////////////////////////////////////////////// //////88 //////////////////////////////////////////////////////////////////////////// 89 89 90 90 #define NULL (void *)0 91 91 92 //////////////////////////////////////////////////////////////////////////// //////92 //////////////////////////////////////////////////////////////////////////// 93 93 // This generic C function is used to implement all system calls. 94 94 // It writes the system call arguments in the proper registers, 95 95 // and tells GCC what has been modified by system call execution. 96 96 // Returns -1 to signal an error. 97 //////////////////////////////////////////////////////////////////////////// //////97 //////////////////////////////////////////////////////////////////////////// 98 98 static inline int sys_call( int call_no, 99 99 int arg_0, … … 141 141 ////////////////////////////////////////////////////////////////////////// 142 142 143 //////////////////////////////////////////////////////////////////////////144 143 extern void giet_proc_xyp( unsigned int* cluster_x, 145 144 unsigned int* cluster_y, … … 159 158 160 159 extern unsigned int giet_thread_id(); 160 161 ////////////////////////////////////////////////////////////////////////// 162 // Coprocessors related system calls 163 ////////////////////////////////////////////////////////////////////////// 164 165 // this structure is used by the giet_coproc_channel_init() 166 // system call to specify the communication channel parameters. 167 typedef struct giet_coproc_channel 168 { 169 unsigned int channel_mode; // MWMR / DMA_IRQ / DMA_NO_IRQ 170 unsigned int buffer_size; // memory buffer size 171 unsigned int buffer_vaddr; // memory buffer virtual address 172 unsigned int mwmr_vaddr; // MWMR descriptor virtual address 173 unsigned int lock_vaddr; // lock for MWMR virtual address 174 } giet_coproc_channel_t; 175 176 extern void giet_coproc_alloc( unsigned int coproc_type, 177 unsigned int* coproc_info, 178 unsigned int* cluster_xy ); 179 180 extern void giet_coproc_release( unsigned int cluster_xy ); 181 182 extern void giet_coproc_channel_init( unsigned int cluster_xy, 183 unsigned int channel, 184 giet_coproc_channel_t* desc ); 185 186 extern void giet_coproc_channel_start( unsigned int cluster_xy, 187 unsigned int channel ); 188 189 extern void giet_coproc_channel_stop ( unsigned int cluster_xy, 190 unsigned int channel ); 191 192 extern void giet_coproc_completed( unsigned int cluster_xy ); 193 194 extern void giet_coproc_register_set( unsigned int cluster_xy, 195 unsigned int reg_index, 196 unsigned int value ); 197 198 extern void giet_coproc_register_get( unsigned int cluster_xy, 199 unsigned int reg_index, 200 unsigned int* buffer ); 161 201 162 202 //////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.