RTEMS CPU Kit with SuperCore
|
Non-Volatile Disk Block Device Implementation. More...
#include <rtems.h>
#include <rtems/libio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "rtems/blkdev.h"
#include "rtems/diskdevs.h"
#include "rtems/nvdisk.h"
Data Structures | |
struct | rtems_nvdisk_device_ctl |
NV Device Control holds the segment controls. More... | |
struct | rtems_mvdisk |
The NV disk control structure for a single disk. More... | |
Macros | |
#define | RTEMS_NVDISK_TRACE 0 |
Control tracing. More... | |
#define | rtems_nvdisk_calc_crc16(_b, _c) rtems_nvdisk_crc16_factor[((_b) ^ ((_c) & 0xff)) & 0xff] ^ (((_c) >> 8) & 0xff) |
Calculate the CRC16 checksum. More... | |
Typedefs | |
typedef struct rtems_nvdisk_device_ctl | rtems_nvdisk_device_ctl |
NV Device Control holds the segment controls. | |
typedef struct rtems_mvdisk | rtems_nvdisk |
The NV disk control structure for a single disk. More... | |
Functions | |
rtems_device_driver | rtems_nvdisk_initialize (rtems_device_major_number major, rtems_device_minor_number minor, void *arg) |
NV disk device driver initialization. More... | |
Non-Volatile Disk Block Device Implementation.
#define rtems_nvdisk_calc_crc16 | ( | _b, | |
_c | |||
) | rtems_nvdisk_crc16_factor[((_b) ^ ((_c) & 0xff)) & 0xff] ^ (((_c) >> 8) & 0xff) |
Calculate the CRC16 checksum.
_b | The byte to checksum. |
_c | The current checksum. |
#define RTEMS_NVDISK_TRACE 0 |
Control tracing.
The use of pages can vary. The rtems_nvdisk_*_page set routines use an absolute page number relative to the segment while all other page numbera are relative to the number of page descriptor pages a segment has. You need to add the number of page descriptor pages (pages_desc) to the page number when call the rtems_nvdisk_*_page functions.
You must always show the page number as relative in any trace or error message as device-page and if you have to the page number as absolute use device~page. This can be seen in the page copy routine.
The code is like this to avoid needing the pass the pages_desc value around. It is only used in selected places and so the extra parameter was avoided. It can be compiled out of the code for small footprint targets. Leave in by default.
typedef struct rtems_mvdisk rtems_nvdisk |
The NV disk control structure for a single disk.
There is one for each minor disk in the system.
rtems_device_driver rtems_nvdisk_initialize | ( | rtems_device_major_number | major, |
rtems_device_minor_number | minor, | ||
void * | arg | ||
) |
NV disk device driver initialization.
Non-volatile disk device driver initialization.
major | NV disk major device number. |
minor | Minor device number, not applicable. |
arg | Initialization argument, not applicable. |