Changes between Version 16 and Version 17 of kernel_syscalls


Ignore:
Timestamp:
Nov 11, 2014, 3:01:05 PM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_syscalls

    v16 v17  
    88
    99
    10 == __TTY related syscall handlers__ ==
     10== TTY related syscall handlers ==
    1111
    12 === int '''_sys_tty_alloc'''() ===
     12=== 1) int '''_sys_tty_alloc'''() ===
    1313This function allocates a private TTY terminal to the calling task, and registers the TTY index in the task context.
    1414Returns 0 if success, returns -1 if not enough terminals.
    1515
    16 === int '''_sys_tty_write'''( const char*  buffer,  unsigned int length,  unsigned int channel ) === 
     16=== 2) int '''_sys_tty_write'''( const char*  buffer,  unsigned int length,  unsigned int channel ) === 
    1717This 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.
    1818It is non blocking: it tests the TTY_STATUS register, and stops the transfer as soon as the TTY_STATUS[WRITE] bit is set. Returns -1 if no TTT terminal allocated to the calling task. Returns  the number of characters that have been written if a terminal is allocated.
    1919
    20 === int '''_sys_tty_read'''(  char* buffer,  unsigned int length,  unsigned int channel ) ===
     20=== 3) int '''_sys_tty_read'''(  char* buffer,  unsigned int length,  unsigned int channel ) ===
    2121This non-blocking function fetches one character from the terminal identified by the ''channel'' argument. If the ''channel'' argument is 0xFFFFFFFF, the TTY index is obtained from the current task context.
    2222It uses the TTY_GET_IRQ[tty_id] interrupt and the buffer must have been filled by the TTY_ISR.
     
    2424Returns -1 if no TTY terminal allocated to the calling task. Returns  the number of characters that have been read if a terminal is allocated (can be 0 or 1).
    2525
    26 === int '''_sys_tty_get_lock'''( unsigned int  channel,   unsigned int* save_sr_ptr ) ===
     26=== 4) int '''_sys_tty_get_lock'''( unsigned int  channel,   unsigned int* save_sr_ptr ) ===
    2727This blocking function try to take the lock protecting exclusive access to TTY terminal identified by the "channel" argument. It enters a critical section before taking the lock, and save the SR value at address defined by the ''save_sr_ptr'' argument. Returns -1 if no TTY terminal allocated to the calling task. If a TTY terminal is allocated, it returns only when the lock has been successfully taken.
    2828
    29 === int '''_sys_tty_release_lock'''( unsigned int  channel,  unsigned int* save_sr_ptr ) ===
     29=== 5) int '''_sys_tty_release_lock'''( unsigned int  channel,  unsigned int* save_sr_ptr ) ===
    3030This function releases the lock protecting exclusive access to TTY terminal identified by the ''channel'' argument.
    3131It exit the critical section after lock release, and restore SR value from address defined by the ''save_sr_ptr'' argument. Returns -1 if no TTY terminal allocated to the calling task.
     
    3333
    3434
    35 == __TIM retated syscall handlers__ ==
     35== TIM retated syscall handlers ==
    3636
    37 === int '''_sys_tim_alloc'''() ===
     37=== 1) int '''_sys_tim_alloc'''() ===
    3838This function allocates a private timer to the calling task, and register the timer index in the task context.
    3939Return -1 if no timer available.
    4040
    41 === int '''_sys_tim_start'''( unsigned int period ) ===
     41=== 2) int '''_sys_tim_start'''( unsigned int period ) ===
    4242This function starts the user timer channel allocated to the calling task.
    4343Returns 0 if success. Returns -1 if no allocated timer.
    4444
    45 === int '''_sys_tim_stop'''() ===
     45=== 3) int '''_sys_tim_stop'''() ===
    4646This function stops the user timer channel allocated to the calling task.
    4747Returns 0 if success. Returns -1 if no allocated timer.
     
    4949
    5050
    51 == __NIC related syscall handlers__ ==
     51== NIC related syscall handlers ==
    5252
    53 These '4 functions can be used for both a NIC_RX or NIC_TX channel, depending on the '''is_rx''' argument.
     53These 4 functions can be used for both a NIC_RX or NIC_TX channel, depending on the '''is_rx''' argument.
    5454
    55 === int '''_sys_nic_alloc'''( unsigned int is_rx ) ===
     55=== 1) int '''_sys_nic_alloc'''( unsigned int is_rx, unsigned int mac4, unsigned int mac2 ) ===
    5656This function allocates a private NIC_RX or NIC_TX channel, the associated chbuf, and a private CMA channel to the calling task, and register these channel indexes in the task context.
     57 * '''is_isr''' : boolean (RX transfer if non zero)
    5758Returns 0 if success. Return -1 if no NIC channel available, or if no CMA channel available.
    5859
    59 === int '''_sys_nic_start'''( unsigned int is_rx ) ===
    60 This function starts the NIC and the CMA channels allocated to the calling task.
     60=== 2) int '''_sys_nic_start'''( unsigned int is_rx ) ===
     61This function starts the NIC channel allocated to the calling task, and starts the CMA transfer between the internal NIC chbuf and the kernel chbuf allocated to the calling task.
     62 * '''is_isr''' : boolean (RX transfer if non zero)
     63 * '''mac4''' : 32 LSB bits of the MAC address
     64 * '''mac4''' : 16 MSB bits of the MAC address
    6165Returns 0 if success. Returns -1 if no NIC channel or no CMA channel allocated to the calling task.
    6266
    63 === int '''_sys_nic_move'''(  unsigned int is_rx,  void* buffer ) ===
     67=== 3) int '''_sys_nic_move'''(  unsigned int is_rx,  void* buffer ) ===
    6468This function moves one 4kbytes container between the kernel chbuf allocated to the calling task, and an user buffer.
    65  * '''is_rx''' defines the transfer direction (user -> kernel for TX / kernel -> user for RX)
     69 * '''is_isr''' : boolean (RX transfer if non zero)
    6670 * '''buffer''' is the user buffer virtual base address.
    6771It is blocking if the kernel chbuf is empty (for an RX transfer) or full (for a TX transfer). The bloking situation
     
    6973Returns 0 if success, returns -1 if the user buffer address is illegal, or if there is no  NIC_RX channel allocated to the calling task, or if the timeout is elapsed.
    7074
    71 === int '''_sys_nic_stop'''( unsigned int is_rx ) ===
     75=== 4) int '''_sys_nic_stop'''( unsigned int is_rx ) ===
    7276This function stops the NIC and the CMA channels allocated to the calling task.
     77 * '''is_isr''' : boolean (RX transfer if non zero)
    7378Returns 0 if success. Returns -1 if no NIC channel or no CMA channel allocated to the calling task.
    7479
    7580
    7681
    77 == __ FBF related syscall handlers__==
     82== FBF related syscall handlers ==
    7883
    7984There exist two methods to access the ''vci_framebuffer'':
     
    8186 * The _sys_fbf_cma_alloc(), _sys_fbf_cma_start(),  _sys_fbf_cma_display(), and _sys_fbf_cma_stop() functions use the ''vci_chbuf_dma'' component to transfer a stream of images from an user space chained buffer (two buffers) to the frame buffer.
    8287 
    83  === int '''_sys_fbf_sync_write'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
    84 This function transfer data from an user buffer to the frame_buffer device using a memcpy.
    85  * '''offset''' : offset (in bytes) in the frame buffer.
    86  * '''buffer''' : base address of the memory buffer.
    87  * '''length''' : number of bytes to be transfered.
    88 
    89  === int '''_sys_fbf_sync_read'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
    90 This function transfer data from the frame_buffer device to anuser buffer using a memcpy.
    91  * '''offset''' : offset (in bytes) in the frame buffer.
    92  * '''buffer''' : base address of the memory buffer.
    93  * '''length''' : number of bytes to be transfered.
    94 
    95  === int '''_sys_fbf_cma_alloc'''() ===
     88 === 1) int '''_sys_fbf_cma_alloc'''() ===
    9689This function allocates a private CMA channel to the calling task, and register the channel index in the task context.
    9790Return -1 if no CMA channel available.
    9891 
    99  === int '''_sys_fbf_cma_start'''( void* vbase0,  void* vbase1,  unsigned int length ) ===
     92 === 2) int '''_sys_fbf_cma_start'''( void* vbase0,  void* vbase1,  unsigned int length ) ===
    10093This function initializes the CMA channel to start the transfer of a stream of images from an user chbuf (two buffers) to the frame buffer chbuf (one single buffer). The user buffers must be aligned on a word boundary.
    10194 * '''vbase0''' : virtual base address of the first user buffer.
     
    110103Return -1 if no CMA channel allocated to the calling task, or if user buffers not aligned on a word boundary.
    111104
    112  === int '''_sys_fbf_cma_display'''( unsigned int index ) ===
     105 === 3) int '''_sys_fbf_cma_display'''( unsigned int index ) ===
    113106This function is used in conjunction with the _fbf_cma_start() function, and must be called each time a new user buffer is available for display, to set the user buffer status in the chbuf descriptor.
    114107The '''buffer'''  argument define the user buffer index (0 => buf0 / not 0 => buf1).
     
    120113Return -1 if no CMA channel allocated to the calling task.
    121114
    122  === int '''_sys_fbf_cma_stop'''() ===
     115 === 4) int '''_sys_fbf_cma_stop'''() ===
    123116This function  desactivares the CMA channel  allocated to the calling task.
    124117Return 0 in case of success.
    125118Return -1 if no CMA channel allocated to the calling task.
    126119
     120 === 5) int '''_sys_fbf_sync_write'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
     121This function transfer data from an user buffer to the frame_buffer device using a memcpy.
     122 * '''offset''' : offset (in bytes) in the frame buffer.
     123 * '''buffer''' : base address of the memory buffer.
     124 * '''length''' : number of bytes to be transfered.
    127125
     126 === 6) int '''_sys_fbf_sync_read'''( unsigned int offset,  void* buffer,   unsigned int length ) ===
     127This function transfer data from the frame_buffer device to anuser buffer using a memcpy.
     128 * '''offset''' : offset (in bytes) in the frame buffer.
     129 * '''buffer''' : base address of the memory buffer.
     130 * '''length''' : number of bytes to be transfered.
    128131
    129132
    130133== __Miscelaneous syscall handlers__ ==
    131134
    132 === int '''_sys_ukn'''() ===
    133 Function executed in case of undefined syscall
     135=== 1) int '''_sys_ukn'''() ===
     136This function executed in case of undefined syscall. It just display an error message on TTY0.
    134137
    135 === int '''_sys_proc_xyp'''( unsigned int* x,  unsigned int*,   unsigned int* p ) ===
     138=== 2) int '''_sys_proc_xyp'''( unsigned int* x,  unsigned int*,   unsigned int* p ) ===
    136139This function returns the processor (x,y,p) identifiers.
    137140
    138 === int '''_sys_task_exit'''() ===
     141=== 3) int '''_sys_task_exit'''() ===
    139142The calling task goes to sleeping state, after printing an exit message.
    140143It is descheduled and enters the "not runable" mode.
    141144
    142  === int '''_context_switch'''() ===
     145 === 4) int '''_context_switch'''() ===
    143146This function deschedules the calling task. It mask interrupts before calling the _ctx_switch, and restore it when the task is rescheduled.
    144147
    145  === int '''_sys_local_task_id'''() ===
     148 === 5) int '''_sys_local_task_id'''() ===
    146149This function returns the current task local index (amongst tasks running on a given processor).
    147150
    148  === int '''_sys_global_task_id'''() ===
     151 === 6) int '''_sys_global_task_id'''() ===
    149152This function returns the current task global index (amongst all tasks running on all processors).
    150153
    151  === int '''_sys_thread_id'''() ===
     154 === 7) int '''_sys_thread_id'''() ===
    152155This function returns the current task thread index (amongst all tasks in a given multi-tasks application).
    153156
    154  === int '''_sys_procs_number'''( unsigned int  x,  unsigned int y,  unsigned int* number ) ===
     157 === 8) int '''_sys_procs_number'''( unsigned int  x,  unsigned int y,  unsigned int* number ) ===
    155158Returns in the ''number'' argument the number of processors in cluster[x,y].
    156159
    157  === int '''_sys_vobj_get_vbase'''( char* vspace_name,  char* vobj_name,  unsigned int* vbase ) ===
     160 === 9) int '''_sys_vobj_get_vbase'''( char* vspace_name,  char* vobj_name,  unsigned int* vbase ) ===
    158161This function returns in the ''vbase'' argument the virtual base address of the vobj identified by the (vspace_name / vobj_name ) couple. Returns 0 if success, -1 if vobj not found.
    159162
    160  === int '''_sys_vobj_get_length'''( char* vspace_name,  char* vobj_name,  unsigned int* length ) ===
     163 === 10) int '''_sys_vobj_get_length'''( char* vspace_name,  char* vobj_name,  unsigned int* length ) ===
    161164This function returns in the ''length'' argument the length of the vobj identified by the (vspace_name / vobj_name ) couple. Returns 0 if success, -1 if vobj not found
    162165
    163  === int '''_sys_xy_from_ptr'''( void* ptr,  unsigned int*  x,  unsigned int*  y ) ===
     166 === 11) int '''_sys_xy_from_ptr'''( void* ptr,  unsigned int*  x,  unsigned int*  y ) ===
    164167This function returns in the (x,y) arguments the coordinates of the  cluster where is mapped the ptr virtual address. It use the _get_context_slot() function to get the calling task page table, and uses the _v2p_translate() function to obtain the physical address. Returns 0 if success, -1 if ptr not mapped in the calling task vspace.
    165168
    166  === int '''_sys_heap_info'''( unsigned int* vaddr,   unsigned int* length,   unsigned int  x,  unsigned int  y ) ===
     169 === 12) int '''_sys_heap_info'''( unsigned int* vaddr,   unsigned int* length,   unsigned int  x,  unsigned int  y ) ===
    167170This function returns the information associated to a heap : vaddr and length.
    168171 * If (x < X_SIZE) and (y < Y_SIZE), it return the heap associated to any task running in cluster(x,y).