| 1 | = GIET-VM / TTY0 access functions = |
| 2 | |
| 3 | [[PageOutline]] |
| 4 | |
| 5 | The [source:soft/giet_vm/giet_common/utils.c utils.c] and [source:soft/giet_vm/giet_common/utils.h util.h] files define the functions used to access the kernel terminal TTY[0]. The ''_put'' functions do not take the lock protecting exclusive access. The ''_printf''s function takes the lock protecting exclusive access. |
| 6 | |
| 7 | They are prefixed by "_" to remind that they can only be executed by a processor in kernel mode. |
| 8 | |
| 9 | === void _puts( char* string ) === |
| 10 | Displays a ''string'' on kernel TTY0. This function does NOT take the TTY0 lock. |
| 11 | |
| 12 | === void _putx( unsigned int value ) === |
| 13 | Displays a 32 bits word as an hexadecimal string on kernel TTY0. This function does NOT take the TTY0 lock. |
| 14 | |
| 15 | === void _putl( unsigned long long value ) === |
| 16 | Displays a 64 bits word as an hexadecimal string on kernel TTY0. This function does NOT take the TTY0 lock. |
| 17 | |
| 18 | === void _putd( unsigned int value ) === |
| 19 | Displays a 32 bits word as an decimal string on kernel TTY0. This function does NOT take the TTY0 lock. |
| 20 | |
| 21 | === void _printf( char* format, ... ) === |
| 22 | Display a format on kernel TTY0. To provide an atomic display, this function takes the lock protecting |
| 23 | exclusive access to TTY0, entering a critical section until the lock is released. |
| 24 | Only a limited number of formats are supported: |
| 25 | * %d : 32 bits signed decimal |
| 26 | * %u : 32 bits unsigned decimal |
| 27 | * %x : 32 bits unsigned hexa |
| 28 | * %l : 64 bits unsigned hexa |
| 29 | * %c : char |
| 30 | * %s : string |
| 31 | |
| 32 | === void _getc( char* byte ) === |
| 33 | This blocking function uses a polling strategy on the TTY0 status register to get a single character. |
| 34 | |
| 35 | |