Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Disk Driver Interface

Disk Driver Interface. More...

Data Structures

struct  disk_info
 Disk info. More...
 
struct  disk_operations
 Disk operations. More...
 

Macros

#define DISK_IOCTL_GET_SECTOR_COUNT   1
 Possible Cmd Codes for disk_ioctl()
 
#define DISK_IOCTL_GET_SECTOR_SIZE   2
 Get the size of a disk SECTOR in bytes.
 
#define DISK_IOCTL_RESERVED   3
 reserved.
 
#define DISK_IOCTL_GET_ERASE_BLOCK_SZ   4
 How many sectors constitute a FLASH Erase block.
 
#define DISK_IOCTL_CTRL_SYNC   5
 Commit any cached read/writes to disk.
 
#define DISK_IOCTL_CTRL_INIT   6
 Initialize the disk.
 
#define DISK_IOCTL_CTRL_DEINIT   7
 Deinitialize the disk.
 
#define DISK_STATUS_OK   0x00
 Possible return bitmasks for disk_status()
 
#define DISK_STATUS_UNINIT   0x01
 Disk status uninitialized.
 
#define DISK_STATUS_NOMEDIA   0x02
 Disk status no media.
 
#define DISK_STATUS_WR_PROTECT   0x04
 Disk status write protected.
 

Functions

int disk_access_register (struct disk_info *disk)
 Register disk.
 
int disk_access_unregister (struct disk_info *disk)
 Unregister disk.
 

Detailed Description

Disk Driver Interface.

Since
1.6
Version
1.0.0

Macro Definition Documentation

◆ DISK_IOCTL_CTRL_DEINIT

#define DISK_IOCTL_CTRL_DEINIT   7

#include <include/zephyr/drivers/disk.h>

Deinitialize the disk.

This IOCTL can be used to de-initialize the disk, enabling it to be removed from the system if the disk is hot-pluggable. Disk usage is reference counted, so for a given disk the DISK_IOCTL_CTRL_DEINIT IOCTL must be issued as many times as the DISK_IOCTL_CTRL_INIT IOCTL was issued in order to de-initialize it.

This macro optionally accepts a pointer to a boolean as the buf parameter, which if true indicates the disk should be forcibly stopped, ignoring all reference counts. The disk driver must report success if a forced stop is requested, but this operation is inherently unsafe.

◆ DISK_IOCTL_CTRL_INIT

#define DISK_IOCTL_CTRL_INIT   6

#include <include/zephyr/drivers/disk.h>

Initialize the disk.

This IOCTL must be issued before the disk can be used for I/O. It is reference counted, so only the first successful invocation of this macro on an uninitialized disk will initialize the IO device

◆ DISK_IOCTL_CTRL_SYNC

#define DISK_IOCTL_CTRL_SYNC   5

#include <include/zephyr/drivers/disk.h>

Commit any cached read/writes to disk.

◆ DISK_IOCTL_GET_ERASE_BLOCK_SZ

#define DISK_IOCTL_GET_ERASE_BLOCK_SZ   4

#include <include/zephyr/drivers/disk.h>

How many sectors constitute a FLASH Erase block.

◆ DISK_IOCTL_GET_SECTOR_COUNT

#define DISK_IOCTL_GET_SECTOR_COUNT   1

#include <include/zephyr/drivers/disk.h>

Possible Cmd Codes for disk_ioctl()

Get the number of sectors in the disk

◆ DISK_IOCTL_GET_SECTOR_SIZE

#define DISK_IOCTL_GET_SECTOR_SIZE   2

#include <include/zephyr/drivers/disk.h>

Get the size of a disk SECTOR in bytes.

◆ DISK_IOCTL_RESERVED

#define DISK_IOCTL_RESERVED   3

#include <include/zephyr/drivers/disk.h>

reserved.

It used to be DISK_IOCTL_GET_DISK_SIZE

◆ DISK_STATUS_NOMEDIA

#define DISK_STATUS_NOMEDIA   0x02

#include <include/zephyr/drivers/disk.h>

Disk status no media.

◆ DISK_STATUS_OK

#define DISK_STATUS_OK   0x00

#include <include/zephyr/drivers/disk.h>

Possible return bitmasks for disk_status()

Disk status okay

◆ DISK_STATUS_UNINIT

#define DISK_STATUS_UNINIT   0x01

#include <include/zephyr/drivers/disk.h>

Disk status uninitialized.

◆ DISK_STATUS_WR_PROTECT

#define DISK_STATUS_WR_PROTECT   0x04

#include <include/zephyr/drivers/disk.h>

Disk status write protected.

Function Documentation

◆ disk_access_register()

int disk_access_register ( struct disk_info disk)

#include <include/zephyr/drivers/disk.h>

Register disk.

Parameters
[in]diskPointer to the disk info structure
Returns
0 on success, negative errno code on fail

◆ disk_access_unregister()

int disk_access_unregister ( struct disk_info disk)

#include <include/zephyr/drivers/disk.h>

Unregister disk.

Parameters
[in]diskPointer to the disk info structure
Returns
0 on success, negative errno code on fail