Changes between Version 11 and Version 12 of ioc_device_api


Ignore:
Timestamp:
Jan 21, 2020, 8:06:19 PM (5 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ioc_device_api

    v11 v12  
    55== __A) General principles__ ==
    66
    7 This device allows the kernel to access various external mass storage peripherals such as a magnetic hard disk, or a SD card, that can store blocks of data in a linear array of sectors indexed by a simple ''lba'' (logic block address).
     7This device allows the kernel to access external mass storage peripherals such as a magnetic hard disk, or a SD card, that can store blocks of data in a linear array of sectors indexed by a simple ''lba'' (logic block address).
    88
    99The block size is supposed to be 512 bytes.
     
    3636== __C) User API__ ==
    3737
    38 The '''void dev_ioc_move_data()''' blocking function moves <count> contiguous blocks of data between the block device,
    39 indexed by the <lba> argument, and a kernel buffer, identified by the <buffer_xp> argument.
    40 * The '''cmd_type''' argument defines the operation type.
    41 * The '''buffer_xp''' argument is an extended pointer on the kernel buffer.
    42 * The '''lba''' argument is the first block index in block device.
    43 * The '''count''' argument is the number of blocks to move.
     38* The '''dev_ioc_read( xptr_t buffer_xp , uint32_t lba , uint32_t count )''' blocking function moves <count> contiguous blocks from the block device, starting from block defined by the <lba> argument, to a kernel buffer defined by the <buffer_xp> argument. It register the request in the IOC device waiting queue. Then it blocks and deschedules.
     39* The '''dev_ioc_write( xptr_t buffer_xp , uint32_t lba , uint32_t count )''' blocking function moves <count> contiguous blocks from a kernel buffer defined by the <buffer_xp> argument to the block device, starting from block defined by the <lba> argument. It register the request in the IOC device waiting queue. Then it blocks and deschedules.
     40* The '''dev_ioc_sync_read( xptr_t buffer_xp , uint32_t lba , uint32_t count )''' blocking function moves <count> contiguous blocks from the block device, starting from block defined by the <lba> argument, to a kernel buffer defined by the <buffer_xp> argument. It calls directly the IOC driver without rescheduling, and without using the IOC device waiting queue and the server thread.
     41* The '''dev_ioc_sync_write( xptr_t buffer_xp , uint32_t lba , uint32_t count )''' blocking function moves <count> contiguous blocks from a kernel buffer defined by the <buffer_xp> argument to the block device, starting from block defined by the <lba> argument. It calls directly the IOC driver without rescheduling, and without using the IOC device waiting queue and the server thread.
    4442
    4543The I/O operation is always blocking for the calling thread, but the blocking policy depends on the operation type.
     
    5048 1. When a client thread request an I/O operation, the request is registered in the ''ioc_command_t'' structure embedded in the client thread descriptor, and the client thread registers itself in the waiting queue rooted in the IOC chdev. Then the client thread blocks on the THREAD_BLOCKED_IO condition, and deschedules.
    5149 1. The DEV server thread attached to the IOC device descriptor handles all commands registered in the IOC device waiting queue. For each pending request, it calls the IOC driver CMD (command) function to ask the hardware device to do the transfer. Then, the server thread blocks on the THREAD_BLOCKED_ISR condition, and deschedules. 
    52  1. When the I/O operation completed, the IOC driver ISR (Interrupt Service Routine) signaling completion reactivates the server thread.
    53  1. The server thread reactivates the client thread, and handle the next request in the IOC waiting queue, or reschedules if the queue is empty.
     50 1. When the I/O operation completed, the IOC driver reactivates the server thread.
     51 1. The server thread reactivates the client thread, and handle the next request in the IOC waiting queue, or deschedules if the queue is empty.
    5452
    5553Note : According to the scheduler policy, the DEV thread has an higher priority than any user thread, but it is not selected when the associated waiting queue is empty.