Changes between Version 17 and Version 18 of library_stdio
- Timestamp:
- Oct 25, 2014, 2:35:58 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
library_stdio
v17 v18 5 5 [[PageOutline]] 6 6 7 8 7 All these functions use a ''syscall'' instruction to enter the system. 8 In case of system call failure (illegal arguments), the syscall return value is -1 (0xFFFFFFFF), and the calling task 9 is killed with a ''giet_exit()'', Therefore, for all these functions, the return value has not to be tested by the calling task. 9 10 10 11 == __1) Processor related system calls__ == 11 12 12 === int '''giet_procid'''()=== 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 The format is gpid = X<<Y_WIDTH + Y) * NB_PROCS_MAX) + L 13 === void '''giet_proc_xyp'''( unsigned int* cluster_x, unsigned int* cluster_y unsigned int* lpid )=== 14 This function returns the processor identifiers (X,Y,P) from the wired global processor index in CP0_PROCID. 15 * cluster_x : X cluster coordinate 16 * cluster_y : Y cluster coordinate 17 * lpid : local processor index 18 No error possible, as the fixed format is gpid = ( ( cluster_x << Y_WIDTH + cluster_y ) << P_WIDTH ) + lpid 15 19 16 === int '''giet_proctime'''() === 17 This function returns the local processor time (number of cycles from reset. 18 19 === int '''giet_rand'''() === 20 This function returns a pseudo-random value derived from both the processor 21 cycle count and the processor index. This value is comprised between 0 & 65535. 20 === unsigned int '''giet_proctime'''() === 21 This function returns the local processor time from the CP0_TIME register (number of cycles from reset). 22 No error possible, as the processor implements a 32 bits wrapping register. 23 24 === unsigned int '''giet_rand'''() === 25 This function returns a pseudo-random value derived from both the CP0_PROCID and CP0_TIME registers. 26 No error possible, as the return value is always between 0 & 65535. 22 27 23 28 == __2) Task related system calls__ == 24 29 25 === int '''giet_proc_task_id'''() ===26 This functions returns the local task index, identifying the task amongst all task27 running on the same processor. 30 === unsigned int '''giet_proc_task_id'''() === 31 This functions returns (from the calling task context) the local task index, identifying the task amongst all task 32 running on the same processor. 28 33 29 === int '''giet_global_task_id'''() === 30 This functions returns the global task id, unique in the system. 34 No error possible. 31 35 32 === int '''giet_thread_id'''() === 33 This functions returns the thread index, identiying the task in a given vspace. 36 === unsigned int '''giet_global_task_id'''() === 37 This functions returns (from the calling task context) the global task id, unique in the system. 38 39 No error possible. 40 41 === unsigned int '''giet_thread_id'''() === 42 This functions returns (from the calling task context) the thread index, identiying the task in a given vspace. 43 44 No error possible. 34 45 35 46 == __3) TTY related system calls__ == 36 47 37 === void'''giet_tty_printf'''( char* format, ... ) ===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().48 === unsigned int '''giet_tty_printf'''( char* format, ... ) === 49 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. 39 50 Only a limited number of formats are supported: 40 51 * %d : signed decimal … … 45 56 * %s : string 46 57 47 === void '''giet_shr_printf'''( char* format, ... ) === 48 This function print formated text on the shared terminal arbitrarily allocated by the kernel, taking the TTY lock 49 for exclusive access. It supports the same formats as the giet_tty_printf() function. In case or error, it makes a giet_exit(). 58 Exit in case of illegal format. 50 59 51 === void '''giet_tty_getc'''( char* byte ) === 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(). 60 === unsigned int '''giet_shr_printf'''( char* format, ... ) === 61 This function print formated text on the shared terminal arbitrarily allocated by the kernel. It takes the TTY lock 62 for exclusive access. It supports the same formats as the giet_tty_printf() function. 53 63 54 === void '''giet_tty_getw'''( unsigned int* val ) === 64 Exit in case of illegal format. 65 66 === unsigned int '''giet_tty_getc'''( char* byte ) === 67 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. 68 69 Exit if private TTY index not defined. 70 71 === unsigned int '''giet_tty_getw'''( unsigned int* val ) === 55 72 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. 56 73 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 57 74 system function) for each decimal character. The <DEL> character is interpreted, and previous characters can be cancelled. When the <LF> character is received, the string is converted to an unsigned int value. If the number of decimal digit is too large for the 32 bits range, the zero value is returned. 58 In case or error (such as TTY index not defined), it makes a giet_exit(). 75 76 Exit if private TTY index not defined. 59 77 60 78 === void '''giet_tty_gets'''( char* buf, unsigned int bufsize ) === … … 62 80 It uses the TTY_RX_IRQ interrupt, and the associated kernel buffer. 63 81 Up to (bufsize - 1) characters (including the non printable characters) are copied into buffer, and the string is completed by a NUL character. The <LF> character is interpreted, and the function close the string with a NUL character if <LF> is read. The <DEL> character is interpreted, and the corresponding character(s) are removed from the target buffer. It does not provide an echo. 64 In case or error (such as TTY index not defined), it makes a giet_exit(). 82 83 Exit if private TTY index not defined. 65 84 66 85 == __4) File system related system calls__ ==