RTEMS
5.0.0
|
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/nvdisk.h>
#include <rtems/thread.h>
Data Structures | |
struct | rtems_nvdisk_device_ctl |
struct | rtems_nvdisk |
Macros | |
#define | RTEMS_NVDISK_TRACE 0 |
#define | rtems_nvdisk_calc_crc16(_b, _c) rtems_nvdisk_crc16_factor[((_b) ^ ((_c) & 0xff)) & 0xff] ^ (((_c) >> 8) & 0xff) |
Typedefs | |
typedef struct rtems_nvdisk_device_ctl | rtems_nvdisk_device_ctl |
Functions | |
rtems_device_driver | rtems_nvdisk_initialize (rtems_device_major_number major RTEMS_UNUSED, rtems_device_minor_number minor RTEMS_UNUSED, void *arg RTEMS_UNUSED) |
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 |
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. Control tracing. It can be compiled out of the code for small footprint targets. Leave in by default.
typedef struct rtems_nvdisk_device_ctl rtems_nvdisk_device_ctl |
NV Device Control holds the segment controls
rtems_device_driver rtems_nvdisk_initialize | ( | rtems_device_major_number major | RTEMS_UNUSED, |
rtems_device_minor_number minor | RTEMS_UNUSED, | ||
void *arg | RTEMS_UNUSED | ||
) |
NV disk device driver initialization.
major | NV disk major device number. |
minor | Minor device number, not applicable. |
arg | Initialization argument, not applicable. |