Changes between Version 115 and Version 116 of library_stdio
- Timestamp:
- Sep 25, 2015, 11:09:08 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
library_stdio
v115 v116 14 14 15 15 === 1) void '''giet_proc_xyp'''( unsigned int* cluster_x, unsigned int* cluster_y unsigned int* p )=== 16 This function returns the processor identifiers (x,y,p) from the wired global processor index in CP0_PROCID. 16 Each thread is statically allocated to one processor P[x,y,p] in the boot phase, and there is no thread migration. 17 This function returns the processor identifiers (x,y,p) for the processor running the calling thread. It access the wired global processor index stored in the CP0_PROCID register. 17 18 The <x> and <y> arguments are the the cluster coordinates. The <p> argument is the processor local index. 18 19 The format is CP0_PROCID = ( ( cluster_x << Y_WIDTH + cluster_y ) << P_WIDTH ) + lpid 19 20 20 21 === 2) unsigned int '''giet_proctime'''() === 21 This function returns the local processor time from the CP0_TIME register (number of cycles from reset) .22 Th e processor implements a 32 bits wrapping register.22 This function returns the local processor time from the CP0_TIME register (number of cycles from reset), 23 This register is a 32 bits wrapping register 23 24 24 25 === 3) unsigned int '''giet_rand'''() === … … 29 30 == __Thread related system calls__ == 30 31 31 The GIET-VM support a subset of the POSIX Threads .32 The GIET-VM support a subset of the POSIX Threads API. 32 33 The ''pthread_t'' and ''pthread_attr_t'' types are defined in the [source:soft/giet_vm/giet_libs/stdio.h stdio.h] file. 33 34 … … 38 39 The thread identifier stored in the ''buffer'' argument by the kernel is unique in a given space: It is actually build from the 4 following informations : [x,y,p,ltid], where x,y,p are the processor coordinates, and ltid is the thread index in the scheduler. 39 40 * buffer : pointer on a buffer that will contain the activated thread identifier. 40 * attr : not supported in the current implementation andmust be set to NULL.41 * attr : not supported in the current implementation / must be set to NULL. 41 42 * function : pointer on function 42 * arg : not supported 43 * arg : not supported in the current implementation / must be set to NULL. 43 44 Return 0 if success. 44 45 Return -1 if no matching thread. … … 46 47 47 48 === 2) void '''giet_pthread_exit'''( void* string ) === 48 This function desactivates the calling thread.49 The 'string' argument is a (user defined) log message displayed on the kernelTTY0.49 This function send a KILL signal to the calling thread, that is immediately desactivated, and goes to the ''blocked'' state. All resources dynamically allocated to the thread, such as private peripheral channels are released. An user defined message is displayed on the kernel terminal TTY0. 50 * '''string''': message on TTY0. 50 51 51 52 === 3) int '''giet_pthread_join'''( pthread_t trdid , void** ptr ) === 52 This blocking function can be used to detect completion of a thread activated by a giet_pthread_create().53 It returns only when the thread identified by the ''traded''argument is desactivated.54 The ''ptr''argument is not supported, and should be set to NULL.53 This blocking function can be used to detect completion of a thread previously activated by a giet_pthread_create(). 54 It returns only when the thread identified by the <trdid> argument is desactivated. 55 The <ptr> argument is not supported, and should be set to NULL. 55 56 * trdid : unique thread identifier in vspace. 56 57 * ptr : not supported. … … 59 60 Return -2 if ptr not NULL 60 61 61 === 4) int '''giet_pthread_kill'''( pthread_ idtrdid , int signal ) ===62 This function send a KILL signal to the thread identified by the ''trdid'' argument when the ''signal'' argument is non zero,63 and thethread will be deactivated at the next context switch.64 If the ''signal''argument is zero, the thread existence is checked, but the KILL signal it is not sent.65 * trdid : uniquethread identifier in vspace.66 * signal: deactivation if non zero.62 === 4) int '''giet_pthread_kill'''( pthread_t trdid , int signal ) === 63 This function send a KILL signal to the thread identified by the <trdid> argument, in the same space as the calling thread. 64 If the <signal> argument has a non zero value, the target thread will be deactivated at the next context switch. 65 If the <signal> argument is zero, the thread existence is checked, but the KILL signal it is not sent. 66 * '''trdid''' : thread identifier in vspace. 67 * '''signal''' : deactivation if non zero. 67 68 Return 0 if success. 68 69 Return -1 if no matching thread. 69 70 70 71 === 5) void '''giet_pthreadt_yield'''() === 71 The thread calling this function is descheduled and the processor is allocated to another thread. 72 The thread calling this function is descheduled and the processor is allocated to another thread. The calling thread is not deactivated and keep in the ''runable'' state. 73 74 The following functions define GIET specific extensions to the POSIX threads API. 72 75 73 76 === 6) void '''giet_pthread_assert'''( unsigned int condition, char* string ) === 74 This non standard function stops execution of the calling thread with a TTY0 message if the condition is 0. 75 * condition : thread exit if condition value is 0. 76 * string : message displayed on TTY0. 77 This function is an extension to the POSIX standard. It send a KILL signal and deactivates immediately the calling thread (as does the giet_pthread_exit() function), with a TTY0 message defined by the <string> argument if the <condition> argument has a zero value. 78 * '''condition''' : thread exit if condition value is 0. 79 * '''string''' : message displayed on TTY0. 80 81 === 7) int '''giet_pthread_pause'''( char* vspace , pthread_t trdid ) === 82 This function is an extension to the POSIX standard. It deschedules and deactivates immediately the thread identified by the <vspace> and <trdid> arguments. The target thread goes to the ''blocked'' state, and will not be scheduled until the thread is reactivated by the giet_pthread_resume() function. The thread context (including the resources dynamically allocated to the thread) is not modified. 83 * '''vspace''' : vspace name. 84 * '''trdid''' : thread identifier in vspace. 85 Return 0 if success. 86 Return -1 if no matching thread. 87 88 === 8) int '''get_pthread_resume'''( char* vspace , pthread_t trdid ) === 89 This function is an extension to the POSIX standard. It reactivates a thread identified by the <vspace> and <trdid> arguments, that was descheduled by the gift_pthread_pause() function. The target thread goes to the ''runable'' state, and can be rescheduled at the next context switch to resume execution. 90 * '''vspace''' : vspace name. 91 * '''trdid''' : thread identifier in vspace. 92 Return 0 if success. 93 Return -1 if no matching thread. 77 94 78 95 … … 447 464 This function returns through the <px> and <py> arguments the coordinates of the cluster containing the physical address associated to the <ptr> argument containing a virtual address. In case of error (unmapped virtual address), the calling thread exit. 448 465 449