Zephyr Project API 3.7.0
A Scalable Open Source RTOS
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#ifndef ZEPHYR_INCLUDE_DRIVERS_DISK_H_
19#define ZEPHYR_INCLUDE_DRIVERS_DISK_H_
20
30#include <zephyr/kernel.h>
31#include <zephyr/types.h>
32#include <zephyr/sys/dlist.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
43#define DISK_IOCTL_GET_SECTOR_COUNT 1
45#define DISK_IOCTL_GET_SECTOR_SIZE 2
47#define DISK_IOCTL_RESERVED 3
49#define DISK_IOCTL_GET_ERASE_BLOCK_SZ 4
51#define DISK_IOCTL_CTRL_SYNC 5
57#define DISK_IOCTL_CTRL_INIT 6
69#define DISK_IOCTL_CTRL_DEINIT 7
70
76#define DISK_STATUS_OK 0x00
78#define DISK_STATUS_UNINIT 0x01
80#define DISK_STATUS_NOMEDIA 0x02
82#define DISK_STATUS_WR_PROTECT 0x04
83
84struct disk_operations;
85
89struct disk_info {
93 const char *name;
95 const struct disk_operations *ops;
97 const struct device *dev;
100};
101
106 int (*init)(struct disk_info *disk);
107 int (*status)(struct disk_info *disk);
108 int (*read)(struct disk_info *disk, uint8_t *data_buf,
109 uint32_t start_sector, uint32_t num_sector);
110 int (*write)(struct disk_info *disk, const uint8_t *data_buf,
111 uint32_t start_sector, uint32_t num_sector);
112 int (*ioctl)(struct disk_info *disk, uint8_t cmd, void *buff);
113};
114
123
132
133#ifdef __cplusplus
134}
135#endif
136
141#endif /* ZEPHYR_INCLUDE_DRIVERS_DISK_H_ */
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
Doubly-linked list node structure.
Definition dlist.h:54
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition ft8xx_reference_api.h:153
Public kernel APIs.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
Disk info.
Definition disk.h:89
const struct disk_operations * ops
Disk operations.
Definition disk.h:95
sys_dnode_t node
Internally used list node.
Definition disk.h:91
const char * name
Disk name.
Definition disk.h:93
uint16_t refcnt
Internally used disk reference count.
Definition disk.h:99
const struct device * dev
Device associated to this disk.
Definition disk.h:97
Disk operations.
Definition disk.h:105
int(* read)(struct disk_info *disk, uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
Definition disk.h:108
int(* ioctl)(struct disk_info *disk, uint8_t cmd, void *buff)
Definition disk.h:112
int(* status)(struct disk_info *disk)
Definition disk.h:107
int(* write)(struct disk_info *disk, const uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
Definition disk.h:110
int(* init)(struct disk_info *disk)
Definition disk.h:106
uint8_t data_buf[16]
Definition targets.c:14