|
RTEMS CPU Kit with SuperCore
4.10.99.0
|
00001 00011 /* 00012 * Copyright (C) 2007 Chris Johns 00013 * 00014 * The license and distribution terms for this file may be 00015 * found in the file LICENSE in this distribution or at 00016 * http://www.rtems.com/license/LICENSE. 00017 */ 00018 00019 #if !defined (_RTEMS_FLASHDISK_H_) 00020 #define _RTEMS_FLASHDISK_H_ 00021 00022 #include <stdint.h> 00023 #include <sys/ioctl.h> 00024 00025 #include <rtems.h> 00026 00127 #define RTEMS_FLASHDISK_DEVICE_BASE_NAME "/dev/fdd" 00128 00129 #define RTEMS_FDISK_IOCTL_ERASE_DISK _IO('B', 128) 00130 #define RTEMS_FDISK_IOCTL_COMPACT _IO('B', 129) 00131 #define RTEMS_FDISK_IOCTL_ERASE_USED _IO('B', 130) 00132 #define RTEMS_FDISK_IOCTL_MONITORING _IO('B', 131) 00133 #define RTEMS_FDISK_IOCTL_INFO_LEVEL _IO('B', 132) 00134 #define RTEMS_FDISK_IOCTL_PRINT_STATUS _IO('B', 133) 00135 00140 typedef struct rtems_fdisk_monitor_data 00141 { 00142 uint32_t block_size; 00143 uint32_t block_count; 00144 uint32_t unavail_blocks; 00145 uint32_t device_count; 00146 uint32_t segment_count; 00147 uint32_t page_count; 00148 uint32_t blocks_used; 00149 uint32_t segs_available; 00150 uint32_t segs_used; 00151 uint32_t segs_failed; 00152 uint32_t seg_erases; 00153 uint32_t pages_desc; 00154 uint32_t pages_active; 00155 uint32_t pages_used; 00156 uint32_t pages_bad; 00157 uint32_t info_level; 00158 } rtems_fdisk_monitor_data; 00159 00170 typedef struct rtems_fdisk_segment_desc 00171 { 00172 uint16_t count; 00173 uint16_t segment; 00174 uint32_t offset; 00175 uint32_t size; 00176 } rtems_fdisk_segment_desc; 00177 00181 #define RTEMS_FDISK_KBYTES(_k) (UINT32_C(1024) * (_k)) 00182 00186 struct rtems_fdisk_device_desc; 00187 00196 typedef struct rtems_fdisk_driver_handlers 00197 { 00216 int (*read) (const rtems_fdisk_segment_desc* sd, 00217 uint32_t device, 00218 uint32_t segment, 00219 uint32_t offset, 00220 void* buffer, 00221 uint32_t size); 00222 00241 int (*write) (const rtems_fdisk_segment_desc* sd, 00242 uint32_t device, 00243 uint32_t segment, 00244 uint32_t offset, 00245 const void* buffer, 00246 uint32_t size); 00247 00265 int (*blank) (const rtems_fdisk_segment_desc* sd, 00266 uint32_t device, 00267 uint32_t segment, 00268 uint32_t offset, 00269 uint32_t size); 00270 00289 int (*verify) (const rtems_fdisk_segment_desc* sd, 00290 uint32_t device, 00291 uint32_t segment, 00292 uint32_t offset, 00293 const void* buffer, 00294 uint32_t size); 00295 00309 int (*erase) (const rtems_fdisk_segment_desc* sd, 00310 uint32_t device, 00311 uint32_t segment); 00312 00325 int (*erase_device) (const struct rtems_fdisk_device_desc* dd, 00326 uint32_t device); 00327 00328 } rtems_fdisk_driver_handlers; 00329 00341 typedef struct rtems_fdisk_device_desc 00342 { 00343 uint32_t segment_count; 00344 const rtems_fdisk_segment_desc* segments; 00345 const rtems_fdisk_driver_handlers* flash_ops; 00346 } rtems_fdisk_device_desc; 00347 00377 typedef struct rtems_flashdisk_config 00378 { 00379 uint32_t block_size; 00380 uint32_t device_count; 00381 const rtems_fdisk_device_desc* devices; 00382 uint32_t flags; 00389 uint32_t unavail_blocks; 00390 00391 uint32_t compact_segs; 00399 uint32_t avail_compact_segs; 00400 uint32_t info_level; 00401 } rtems_flashdisk_config; 00402 00403 /* 00404 * Driver flags. 00405 */ 00406 00410 #define RTEMS_FDISK_BACKGROUND_ERASE (1 << 0) 00411 00415 #define RTEMS_FDISK_BACKGROUND_COMPACT (1 << 1) 00416 00422 #define RTEMS_FDISK_CHECK_PAGES (1 << 2) 00423 00428 #define RTEMS_FDISK_BLANK_CHECK_BEFORE_WRITE (1 << 3) 00429 00441 rtems_device_driver 00442 rtems_fdisk_initialize (rtems_device_major_number major, 00443 rtems_device_minor_number minor, 00444 void* arg); 00445 00450 extern const rtems_flashdisk_config rtems_flashdisk_configuration[]; 00451 00456 extern uint32_t rtems_flashdisk_configuration_size; 00457 00460 #endif
1.7.5