Changes between Version 2 and Version 3 of library_stdio


Ignore:
Timestamp:
Aug 6, 2014, 3:44:28 PM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • library_stdio

    v2 v3  
    11= The stdio Library =
    22
    3 The [source:soft/giet_vm/giet_libs/stdio.c stdio.c] and [source:soft/giet_vm/giet_libs/stdio.h stdio.h] files contains all system calls provided to user applications by the GIET-VM.
     3The [source:soft/giet_vm/giet_libs/stdio.c stdio.c] and [source:soft/giet_vm/giet_libs/stdio.h stdio.h] files contains all system calls provided to user applications by the GIET-VM. They are generally prefixed by ''giet_''.
    44
    5  == Processor protected registers ==
     5 == Processor protected register ==
    66
    77 * '''int giet_procid()'''
     
    1212This function returns the local processor time (number of cycles from reset.
    1313
    14  * '''int giet_rand()
     14 * '''int giet_rand()'''
    1515This function returns a pseudo-random value derived from both the processor
    1616cycle count and the processor index. This value is comprised between 0 & 65535.
     
    1818 == Informations stored in the running task context ==
    1919
    20  * int giet_proc_task_id();
     20 * '''int giet_proc_task_id()''';
    2121This functions returns the local task index, identifying the task amongst all task
    2222running on the same processor.
     
    2828This functions returns the thread index, identiying the task in a given vspace.
    2929
     30 == TTY terminal access ==
     31
     32 * '''void giet_tty_printf( char* format, ... )'''
     33This 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.
     34Only a limited number of formats are supported:
     35   * %d : signed decimal
     36   * %u : unsigned decimal
     37   * %x : 32 bits hexadecimal
     38   * %l : 64 bits hexadecimal
     39   * %c : char
     40   * %s : string
     41In case or error, it makes a giet_exit().
     42
     43 * '''void giet_shr_printf( char* format, ... )'''
     44This function print formated text on the shared terminal arbitrarily allocated by the kernel, taking the TTY lock
     45 for exclusive access. It supports the same formats as the giet_tty_printf() function.
     46In case or error, it makes a giet_exit().
     47
     48 * '''void giet_tty_getc( char* byte )
     49This 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.
     50In case or error, it makes a giet_exit().
     51
     52 * '''void giet_tty_getw( unsigned int* val )'''
     53This 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.
     54The 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
     55system 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.
     56In case or error, it makes a giet_exit().
     57
     58 * '''giet_tty_gets( char* buf, unsigned int bufsize )'''
     59This 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.
     60It uses the TTY_RX_IRQ interrupt, and the associated kernel buffer.
     61Up 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.
     62In case or error, it makes a giet_exit().
     63
     64
     65
     66