Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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#ifndef ZEPHYR_INCLUDE_DRIVERS_DISK_H_
19#define ZEPHYR_INCLUDE_DRIVERS_DISK_H_
20
27#include <kernel.h>
28#include <zephyr/types.h>
29#include <sys/dlist.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
40#define DISK_IOCTL_GET_SECTOR_COUNT 1
42#define DISK_IOCTL_GET_SECTOR_SIZE 2
44#define DISK_IOCTL_RESERVED 3
46#define DISK_IOCTL_GET_ERASE_BLOCK_SZ 4
48#define DISK_IOCTL_CTRL_SYNC 5
49
55#define DISK_STATUS_OK 0x00
57#define DISK_STATUS_UNINIT 0x01
59#define DISK_STATUS_NOMEDIA 0x02
61#define DISK_STATUS_WR_PROTECT 0x04
62
63struct disk_operations;
64
68struct disk_info {
72 char *name;
74 const struct disk_operations *ops;
76 const struct device *dev;
77};
78
83 int (*init)(struct disk_info *disk);
84 int (*status)(struct disk_info *disk);
85 int (*read)(struct disk_info *disk, uint8_t *data_buf,
86 uint32_t start_sector, uint32_t num_sector);
87 int (*write)(struct disk_info *disk, const uint8_t *data_buf,
88 uint32_t start_sector, uint32_t num_sector);
89 int (*ioctl)(struct disk_info *disk, uint8_t cmd, void *buff);
90};
91
100
109
110#ifdef __cplusplus
111}
112#endif
113
118#endif /* ZEPHYR_INCLUDE_DRIVERS_DISK_H_ */
Doubly-linked list implementation.
int disk_access_register(struct disk_info *disk)
Register disk.
int disk_access_unregister(struct disk_info *disk)
Unregister disk.
struct _dnode sys_dnode_t
Definition: dlist.h:49
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition: ft8xx_reference_api.h:153
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
Disk info.
Definition: disk.h:68
const struct disk_operations * ops
Definition: disk.h:74
char * name
Definition: disk.h:72
sys_dnode_t node
Definition: disk.h:70
const struct device * dev
Definition: disk.h:76
Disk operations.
Definition: disk.h:82
int(* read)(struct disk_info *disk, uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
Definition: disk.h:85
int(* ioctl)(struct disk_info *disk, uint8_t cmd, void *buff)
Definition: disk.h:89
int(* status)(struct disk_info *disk)
Definition: disk.h:84
int(* write)(struct disk_info *disk, const uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
Definition: disk.h:87
int(* init)(struct disk_info *disk)
Definition: disk.h:83
uint8_t data_buf[16]
Definition: targets.c:14