RTEMS CPU Kit with SuperCore  4.11.2
Data Structures | Macros | Typedefs | Functions
flashdisk.c File Reference

Flash 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/flashdisk.h"
Include dependency graph for flashdisk.c:

Data Structures

struct  rtems_fdisk_page_desc
 The start of a segment has a segment control table. More...
 
struct  rtems_fdisk_segment_ctl
 Flash Segment Control holds the pointer to the segment, number of pages, various page stats and the memory copy of the page descriptors. More...
 
struct  rtems_fdisk_segment_ctl_queue
 Segment control table queue. More...
 
struct  rtems_fdisk_device_ctl
 Flash Device Control holds the segment controls. More...
 
struct  rtems_fdisk_block_ctl
 The Block control holds the segment and page with the data. More...
 
struct  rtems_flashdisk
 The virtual block table holds the mapping for blocks as seen by the disk drivers to the device, segment and page numbers of the physical device. More...
 

Macros

#define RTEMS_FDISK_TRACE   1
 Control tracing. More...
 
#define RTEMS_FDISK_PAGE_ACTIVE   (1 << 0)
 Flag the page as active.
 
#define RTEMS_FDISK_PAGE_USED   (1 << 1)
 Flag the page as used.
 
#define rtems_fdisk_calc_crc16(_b, _c)   rtems_fdisk_crc16_factor[((_b) ^ ((_c) & 0xff)) & 0xff] ^ (((_c) >> 8) & 0xff)
 Calculate the CRC16 checksum. More...
 

Typedefs

typedef struct rtems_fdisk_page_desc rtems_fdisk_page_desc
 The start of a segment has a segment control table. More...
 
typedef struct rtems_fdisk_segment_ctl rtems_fdisk_segment_ctl
 Flash Segment Control holds the pointer to the segment, number of pages, various page stats and the memory copy of the page descriptors.
 
typedef struct rtems_fdisk_segment_ctl_queue rtems_fdisk_segment_ctl_queue
 Segment control table queue.
 
typedef struct rtems_fdisk_device_ctl rtems_fdisk_device_ctl
 Flash Device Control holds the segment controls.
 
typedef struct rtems_fdisk_block_ctl rtems_fdisk_block_ctl
 The Block control holds the segment and page with the data.
 
typedef struct rtems_flashdisk rtems_flashdisk
 The virtual block table holds the mapping for blocks as seen by the disk drivers to the device, segment and page numbers of the physical device.
 

Functions

rtems_device_driver rtems_fdisk_initialize (rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
 Flash disk device driver initialization. More...
 

Detailed Description

Flash Disk Block Device Implementation.

Macro Definition Documentation

◆ rtems_fdisk_calc_crc16

#define rtems_fdisk_calc_crc16 (   _b,
  _c 
)    rtems_fdisk_crc16_factor[((_b) ^ ((_c) & 0xff)) & 0xff] ^ (((_c) >> 8) & 0xff)

Calculate the CRC16 checksum.

Parameters
_bThe byte to checksum.
_cThe current checksum.

◆ RTEMS_FDISK_TRACE

#define RTEMS_FDISK_TRACE   1

Control tracing.

It can be compiled out of the code for small footprint targets. Leave in by default.

Typedef Documentation

◆ rtems_fdisk_page_desc

The start of a segment has a segment control table.

This hold the CRC and block number for the page.

Todo:
A sequence number for the block could be added. This would mean a larger descriptor size. Need to make the sequence large like 20+ bits so a large file system would not have more blocks available than the sequence number.