Changes between Version 14 and Version 15 of library_stdio
- Timestamp:
- Oct 23, 2014, 3:04:48 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
library_stdio
v14 v15 10 10 == __1) Processor related system calls__ == 11 11 12 === int giet_procid()===12 === int '''giet_procid'''()=== 13 13 This function returns the global processor identifier gpid, depending on (X,Y,L) where X,Y are the cluster coordinates, and L is the local processor index. 14 14 The format is gpid = X<<Y_WIDTH + Y) * NB_PROCS_MAX) + L 15 15 16 === int giet_proctime() ===16 === int '''giet_proctime'''() === 17 17 This function returns the local processor time (number of cycles from reset. 18 18 19 === int giet_rand() ===19 === int '''giet_rand'''() === 20 20 This function returns a pseudo-random value derived from both the processor 21 21 cycle count and the processor index. This value is comprised between 0 & 65535. … … 23 23 == __2) Task related system calls__ == 24 24 25 === int giet_proc_task_id() ===25 === int '''giet_proc_task_id'''() === 26 26 This functions returns the local task index, identifying the task amongst all task 27 27 running on the same processor. … … 37 37 === void giet_tty_printf( char* format, ... ) === 38 38 This function print formated text on a private terminal that must have been allocated to the calling task in the mapping (''use_tty'' argument). Therefore, it does not take the TTY lock. In case or error, it makes a giet_exit(). 39 40 39 Only a limited number of formats are supported: 41 40 * %d : signed decimal … … 46 45 * %s : string 47 46 48 === void giet_shr_printf( char* format, ... ) ===47 === void '''giet_shr_printf'''( char* format, ... ) === 49 48 This function print formated text on the shared terminal arbitrarily allocated by the kernel, taking the TTY lock 50 49 for exclusive access. It supports the same formats as the giet_tty_printf() function. In case or error, it makes a giet_exit(). 51 50 52 === void giet_tty_getc( char* byte ) ===51 === void '''giet_tty_getc'''( char* byte ) === 53 52 This blocking function fetches a single character from the private terminal that must have been allocated to the calling task in the application mapping. It uses the TTY_RX_IRQ interrupt, and the associated kernel buffer. In case or error (such as TTY index not defined), it makes a giet_exit(). 54 53 55 === void giet_tty_getw( unsigned int* val ) ===54 === void '''giet_tty_getw'''( unsigned int* val ) === 56 55 This blocking function fetches a string of decimal characters (most significant digit first) to build a 32-bits unsigned integer from the private TTY terminal that must have been allocated to the calling task in the application mapping. It uses the TTY_RX_IRQ interrupt, and the associated kernel buffer. 57 56 The non-blocking system function _tty_read is called several times, and the decimal characters are written in a 32 characters buffer until a <LF> character is read. It ignores non-decimal characters, and displays an echo … … 59 58 In case or error (such as TTY index not defined), it makes a giet_exit(). 60 59 61 === void giet_tty_gets( char* buf, unsigned int bufsize ) ===60 === void '''giet_tty_gets'''( char* buf, unsigned int bufsize ) === 62 61 This blocking function fetches a string from the private terminal that must have been allocated to the calling task in the application mapping. It writes the string to a fixed length buffer. 63 62 It uses the TTY_RX_IRQ interrupt, and the associated kernel buffer. … … 69 68 The Giet-VM supports a FAT32 file system. 70 69 71 === int giet_fat_open( const char* pathname, unsigned int flags ) ===70 === int '''giet_fat_open'''( const char* pathname, unsigned int flags ) === 72 71 Open a file identified by the ''pathname'' argument. The read/write ''flags'' are not supported yet: no effect. 73 72 Return -1 in case or error. 74 73 75 === void giet_fat_read( unsigned int fd, void* buffer, unsigned int count, unsigned int offset ) ===74 === void '''giet_fat_read'''( unsigned int fd, void* buffer, unsigned int count, unsigned int offset ) === 76 75 Read ''count'' sectors from a file identified by the ''fd'' argument, skipping ''offset'' sectors in file, and writing into the user memory ''buffer''. The user buffer base address should be 64 bytes aligned. 77 76 In case or error, it makes a giet_exit(). 78 77 79 === void giet_fat_write( unsigned int fd, void* buffer, unsigned int count, unsigned int offset ) ===78 === void '''giet_fat_write'''( unsigned int fd, void* buffer, unsigned int count, unsigned int offset ) === 80 79 Write ''count'' sectors into a file identified by the ''fd'' argument, skipping ''offset'' sectors in file, and reading from the user memory ''buffer''. The user buffer base address should be 64 bytes aligned. 81 80 In case or error, it makes a giet_exit(). 82 81 83 === void giet_fat_close( unsigned int fd ) ===82 === void '''giet_fat_close'''( unsigned int fd ) === 84 83 Close a file identified by the ''fd'' file descriptor. 85 84 … … 119 118 == __7) Miscelaneous system calls__ == 120 119 121 === void giet_exit( char* string ) ===120 === void '''giet_exit'''( char* string ) === 122 121 This function stops execution of the calling task with a TTY message explaining the cause. The user task is descheduled and becomes not runable: it does not consume processor cycles anymore. 123 122 124 === void giet_assert( unsigned int condition, char* string ) ===123 === void '''giet_assert'''( unsigned int condition, char* string ) === 125 124 This function uses the giet_exit() system call to kill the calling task if the condition is false. 126 125 127 === void giet_context_switch() ===126 === void '''giet_context_switch'''() === 128 127 The user task calling this function is descheduled and the processor is allocated to another task. 129 128 130 === void giet_procnumber( unsigned int cluster_xy, unsigned int buffer ) ===129 === void '''giet_procnumber'''( unsigned int cluster_xy, unsigned int buffer ) === 131 130 This function returns in the ''buffer'' argument the number of processors in the cluster specified by the ''cluster_xy'' argument. In case or error (such as illegal cluster index), it makes a giet_exit(). 132 131 133 === void giet_vobj_get_vbase( char* vspace_name, char* vobj_name, unsigned int* vobj_vaddr) ===132 === void '''giet_vobj_get_vbase'''( char* vspace_name, char* vobj_name, unsigned int* vobj_vaddr) === 134 133 This function returns in argument ''vobj_vaddr'' the virtual base address of a vobj defined in the mapping_info data structure. The vobj is identified by the two arguments ''vspace_name'' and ''vobj_name''. In case of error (such as undefined vspace or undefined vobj), it makes a giet_exit(). 135 134 136 === void giet_heap_info( unsigned int* vaddr, unsigned int* length, unsigned int x, unsigned int y );135 === void '''giet_heap_info'''( unsigned int* vaddr, unsigned int* length, unsigned int x, unsigned int y ); 137 136 This function supports access to the running task's heap or to a remote heap. If (x < X_SIZE) and (y < Y_SIZE), it returns the base address and length of the heap associated to any task running on cluster(x,y). Otherwise, it returns the base address and length of the heap associated to the calling task. In case of error (such as undefined heap segment in the selected cluster, it returns heap_size = 0). 138 137 139 === void giet_get_xy( void* ptr, unsigned int* px, unsigned int* py ) ===138 === void '''giet_get_xy'''( void* ptr, unsigned int* px, unsigned int* py ) === 140 139 This function takes as input a virtual address (''ptr'' argument), and returns through the ''px,py'' arguments the coordinates of the cluster containing the physical address associated to ''ptr''. In case of error (unmapped virtual address), it makes a giet_exit(). 141 140