Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
Loading...
Searching...
No Matches
disk.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 Intel Corporation.
3
* Copyright (c) 2021 Nordic Semiconductor ASA
4
*
5
* SPDX-License-Identifier: Apache-2.0
6
*/
7
18
19
#ifndef ZEPHYR_INCLUDE_DRIVERS_DISK_H_
20
#define ZEPHYR_INCLUDE_DRIVERS_DISK_H_
21
35
36
#include <
zephyr/kernel.h
>
37
#include <
zephyr/types.h
>
38
#include <
zephyr/sys/dlist.h
>
39
40
#ifdef __cplusplus
41
extern
"C"
{
42
#endif
43
47
49
#define DISK_IOCTL_GET_SECTOR_COUNT 1
51
#define DISK_IOCTL_GET_SECTOR_SIZE 2
53
#define DISK_IOCTL_RESERVED 3
55
#define DISK_IOCTL_GET_ERASE_BLOCK_SZ 4
57
#define DISK_IOCTL_CTRL_SYNC 5
63
#define DISK_IOCTL_CTRL_INIT 6
75
#define DISK_IOCTL_CTRL_DEINIT 7
80
#define DISK_IOCTL_GET_CARD_CID 8
81
85
87
#define DISK_STATUS_OK 0x00
89
#define DISK_STATUS_UNINIT 0x01
91
#define DISK_STATUS_NOMEDIA 0x02
93
#define DISK_STATUS_WR_PROTECT 0x04
94
95
struct
disk_operations
;
96
100
struct
disk_info
{
102
sys_dnode_t
node
;
104
const
char
*
name
;
106
const
struct
disk_operations
*
ops
;
108
const
struct
device
*
dev
;
110
uint16_t
refcnt
;
111
};
112
116
struct
disk_operations
{
117
int (*
init
)(
struct
disk_info
*disk);
118
int (*
status
)(
struct
disk_info
*disk);
119
int (*
read
)(
struct
disk_info
*disk,
uint8_t
*data_buf,
120
uint32_t
start_sector,
uint32_t
num_sector);
121
int (*
write
)(
struct
disk_info
*disk,
const
uint8_t
*data_buf,
122
uint32_t
start_sector,
uint32_t
num_sector);
123
int (*
erase
)(
struct
disk_info
*disk,
uint32_t
start_sector,
uint32_t
num_sector);
124
int (*
ioctl
)(
struct
disk_info
*disk,
uint8_t
cmd
,
void
*buff);
125
};
126
134
int
disk_access_register
(
struct
disk_info
*disk);
135
143
int
disk_access_unregister
(
struct
disk_info
*disk);
144
145
#ifdef __cplusplus
146
}
147
#endif
148
152
153
#endif
/* ZEPHYR_INCLUDE_DRIVERS_DISK_H_ */
dlist.h
Header file for the doubly-linked list API.
disk_access_register
int disk_access_register(struct disk_info *disk)
Register disk.
disk_access_unregister
int disk_access_unregister(struct disk_info *disk)
Unregister disk.
sys_dnode_t
struct _dnode sys_dnode_t
Doubly-linked list node structure.
Definition
dlist.h:57
cmd
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition
ft8xx_reference_api.h:153
types.h
kernel.h
Public kernel APIs.
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
uint16_t
__UINT16_TYPE__ uint16_t
Definition
stdint.h:89
device
Runtime device structure (in ROM) per driver instance.
Definition
device.h:513
disk_info
Disk info.
Definition
disk.h:100
disk_info::ops
const struct disk_operations * ops
Disk operations.
Definition
disk.h:106
disk_info::node
sys_dnode_t node
Internally used list node.
Definition
disk.h:102
disk_info::name
const char * name
Disk name.
Definition
disk.h:104
disk_info::refcnt
uint16_t refcnt
Internally used disk reference count.
Definition
disk.h:110
disk_info::dev
const struct device * dev
Device associated to this disk.
Definition
disk.h:108
disk_operations
Disk operations.
Definition
disk.h:116
disk_operations::read
int(* read)(struct disk_info *disk, uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
Definition
disk.h:119
disk_operations::ioctl
int(* ioctl)(struct disk_info *disk, uint8_t cmd, void *buff)
Definition
disk.h:124
disk_operations::erase
int(* erase)(struct disk_info *disk, uint32_t start_sector, uint32_t num_sector)
Definition
disk.h:123
disk_operations::status
int(* status)(struct disk_info *disk)
Definition
disk.h:118
disk_operations::write
int(* write)(struct disk_info *disk, const uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
Definition
disk.h:121
disk_operations::init
int(* init)(struct disk_info *disk)
Definition
disk.h:117
zephyr
drivers
disk.h
Generated on
for Zephyr API by
1.17.0