16 | | === int '''_call_timer_start'''( unsigned int period ) === |
| 17 | == __TTY related syscall handlers__ == |
| 18 | |
| 19 | === int '''_sys_tty_alloc'''() === |
| 20 | |
| 21 | === int '''_sys_tty_write'''( const char* buffer, unsigned int length, unsigned int channel ) === |
| 22 | This non-blocking function writes a character string from a fixed-length buffer to a TTY terminal identified by the channel argument. If channel argument is 0xFFFFFFFF, the TTY index is found in the task context. |
| 23 | It is non blocking: it tests the TTY_STATUS register, and stops the transfer as soon as the TTY_STATUS[WRITE] bit is set. Returns the number of characters that have been written. |
| 24 | |
| 25 | === int '''_sys_tty_read'''( char* buffer, unsigned int length, unsigned int channel ) === |
| 26 | This non-blocking function fetches one character from the terminal identified by the channel argument. If the channel argument is 0xFFFFFFFF, the channel index is obtained from the current task context. |
| 27 | It uses the TTY_GET_IRQ[tty_id] interrupt and the buffer must have been filled by the TTY_ISR. |
| 28 | It test the _tty_rx_full[tty_id] variable, read the _tty_rx_buf[tty_id] buffer, writes this character to the target buffer, and resets the_tty_rx_full[tty_id] register. The length argument is not used. |
| 29 | Returns the number of characters that have been read (0/1). |
| 30 | |
| 31 | === void '''_sys_tty_get_lock'''( unsigned int channel, unsigned int* save_sr_ptr ) === |
| 32 | This blocking function try to take the lock protecting exclusive access to TTY terminal identified by the "channel" argument. |
| 33 | It enters a critical section before taking the lock, and save the SR value at address defined by the ''save_sr_ptr'' argument. |
| 34 | It returns only when the lock has been successfully taken. |
| 35 | |
| 36 | === void '''_sys_tty_release_lock'''( unsigned int channel, unsigned int* save_sr_ptr ) === |
| 37 | This function releases the lock protecting exclusive access to TTY terminal identified by the channel argument. |
| 38 | It exit the critical section after lock release, and restore SR value from address defined by the ''save_sr_ptr'' argument. |
| 39 | |
| 40 | == __TIM retated syscall handlers__ == |
| 41 | |
| 42 | === int '''_sys_timer_alloc'''() === |
| 43 | This function allocates a private timer to the calling task, and register the timer index in the task context. |
| 44 | Return -1 if no timer available. |
| 45 | |
| 46 | === int '''_sys_timer_start'''( unsigned int period ) === |