Changes between Version 17 and Version 18 of library_stdio


Ignore:
Timestamp:
Oct 25, 2014, 2:35:58 PM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • library_stdio

    v17 v18  
    55[[PageOutline]]
    66
    7 
    8 
     7All these functions use a ''syscall'' instruction to enter the system.
     8In  case of system call failure (illegal arguments), the syscall return value is -1 (0xFFFFFFFF), and the calling task
     9is killed with a ''giet_exit()'', Therefore, for all these functions, the return value has not to be tested by the calling task.
    910
    1011 == __1) Processor related system calls__ ==
    1112
    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 )===
     14This 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
     18No error possible, as the fixed format is  gpid = ( ( cluster_x << Y_WIDTH + cluster_y ) << P_WIDTH ) + lpid
    1519
    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'''() ===
     21This function returns the local processor time from the CP0_TIME register (number of cycles from reset).
     22No error possible, as the processor implements a 32 bits wrapping register.
     23 
     24 === unsigned int '''giet_rand'''() ===
     25This function returns a pseudo-random value derived from both the CP0_PROCID and CP0_TIME registers.
     26No error possible, as the return value is always between 0 & 65535.
    2227
    2328 == __2) Task related system calls__ ==
    2429
    25  === int '''giet_proc_task_id'''() ===
    26 This functions returns the local task index, identifying the task amongst all task
    27 running on the same processor.
     30 === unsigned int '''giet_proc_task_id'''() ===
     31This functions returns (from the calling task context) the local task index, identifying the task amongst all task
     32running on the same processor. 
    2833
    29  === int '''giet_global_task_id'''() ===
    30 This functions returns the global task id, unique in the system.
     34No error possible.
    3135
    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'''() ===
     37This functions returns (from the calling task context) the global task id, unique in the system.
     38
     39No error possible.
     40
     41 === unsigned int '''giet_thread_id'''() ===
     42This functions returns (from the calling task context) the thread index, identiying the task in a given vspace.
     43
     44No error possible.
    3445
    3546 == __3) TTY related system calls__ ==
    3647
    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, ... ) ===
     49This 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.
    3950Only a limited number of formats are supported:
    4051   * %d : signed decimal
     
    4556   * %s : string
    4657
    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().
     58Exit in case of illegal format.
    5059
    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, ... ) ===
     61This function print formated text on the shared terminal arbitrarily allocated by the kernel. It takes the TTY lock
     62for exclusive access. It supports the same formats as the giet_tty_printf() function.
    5363
    54  === void '''giet_tty_getw'''( unsigned int* val ) ===
     64Exit in case of illegal format.
     65
     66 === unsigned int '''giet_tty_getc'''( char* byte ) ===
     67This 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
     69Exit if private TTY index not defined.
     70
     71 === unsigned int '''giet_tty_getw'''( unsigned int* val ) ===
    5572This 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.
    5673The 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
    5774system 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
     76Exit if private TTY index not defined.
    5977
    6078 === void '''giet_tty_gets'''( char* buf, unsigned int bufsize ) ===
     
    6280It uses the TTY_RX_IRQ interrupt, and the associated kernel buffer.
    6381Up 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
     83Exit if private TTY index not defined.
    6584
    6685 == __4) File system related system calls__ ==