wiki:rdk_driver

Version 2 (modified by alain, 10 years ago) (diff)

--

GIET-VM / RDK Driver

The rdk_driver.c and rdk_driver.h files define the RDK driver.

This driver supports a virtual disk implemented as a memory segment, in the physical address space. This ramdisk vseg must be defined in the mapping.

It is one of the physical disk driver that can be called by the generic IOC driver.

The _rdk_read() and _rdk_write() blocking functions use a software memcpy, whatever the selected mode (BOOT / KERNEL / USER). These blocking functions return only when the transfer is completed. As the number of concurrent accesses is not bounded, these functions don't use the _ioc_lock variable.

The SEG_RDK_BASE virtual address must be defined in the hard_config.h file when the USE_RAMDISK flag is set.

#ifndef _GIET_RDK_DRIVERS_H_ #define _GIET_RDK_DRIVERS_H_

unsigned int _rdk_init()

This function does nothing, but is required by the generic IOC API.

unsigned int _rdk_read( unsigned int lba, unsigned int buffer, unsigned int count )

This function transfer data from the RAMDISK to a memory buffer.

  • mode : BOOT / KERNEL / USER (unused)
  • lba : first block index on the block device
  • buffer : virtual base address of the memory buffer
  • count : number of blocks to be transfered.

Returns 0 if success, > 0 if error.

unsigned int _rdk_write( unsigned int lba, unsigned int buffer, unsigned int count )

This function transfer data from a memory buffer to the RAMDISK.

  • mode : BOOT / KERNEL / USER (unused)
  • lba : first block index on the block device
  • buffer : virtual base address of the memory buffer
  • count : number of blocks to be transfered.

Returns 0 if success, > 0 if error.

unsigned int _rdk_get_block_size()

This function returns the block size.

unsigned int _rdk_get_status()

This function returns always 0, but is required bi the generic IOC API.