Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Disk Access Interface

Disk Access APIs. More...

Functions

int disk_access_init (const char *pdrv)
 perform any initialization
 
int disk_access_status (const char *pdrv)
 Get the status of disk.
 
int disk_access_read (const char *pdrv, uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
 read data from disk
 
int disk_access_write (const char *pdrv, const uint8_t *data_buf, uint32_t start_sector, uint32_t num_sector)
 write data to disk
 
int disk_access_ioctl (const char *pdrv, uint8_t cmd, void *buff)
 Get/Configure disk parameters.
 

Detailed Description

Disk Access APIs.

Function Documentation

◆ disk_access_init()

int disk_access_init ( const char *  pdrv)

#include <zephyr/storage/disk_access.h>

perform any initialization

This call is made by the consumer before doing any IO calls so that the disk or the backing device can do any initialization.

Parameters
[in]pdrvDisk name
Returns
0 on success, negative errno code on fail

◆ disk_access_ioctl()

int disk_access_ioctl ( const char *  pdrv,
uint8_t  cmd,
void *  buff 
)

#include <zephyr/storage/disk_access.h>

Get/Configure disk parameters.

Function to get disk parameters and make any special device requests.

Parameters
[in]pdrvDisk name
[in]cmdDISK_IOCTL_* code describing the request
[in]buffCommand data buffer
Returns
0 on success, negative errno code on fail

◆ disk_access_read()

int disk_access_read ( const char *  pdrv,
uint8_t data_buf,
uint32_t  start_sector,
uint32_t  num_sector 
)

#include <zephyr/storage/disk_access.h>

read data from disk

Function to read data from disk to a memory buffer.

Note: if he disk is of NVMe type, user will need to ensure data_buf pointer is 4-bytes aligned.

Parameters
[in]pdrvDisk name
[in]data_bufPointer to the memory buffer to put data.
[in]start_sectorStart disk sector to read from
[in]num_sectorNumber of disk sectors to read
Returns
0 on success, negative errno code on fail

◆ disk_access_status()

int disk_access_status ( const char *  pdrv)

#include <zephyr/storage/disk_access.h>

Get the status of disk.

This call is used to get the status of the disk

Parameters
[in]pdrvDisk name
Returns
DISK_STATUS_OK or other DISK_STATUS_*s

◆ disk_access_write()

int disk_access_write ( const char *  pdrv,
const uint8_t data_buf,
uint32_t  start_sector,
uint32_t  num_sector 
)

#include <zephyr/storage/disk_access.h>

write data to disk

Function write data from memory buffer to disk.

Note: if he disk is of NVMe type, user will need to ensure data_buf pointer is 4-bytes aligned.

Parameters
[in]pdrvDisk name
[in]data_bufPointer to the memory buffer
[in]start_sectorStart disk sector to write to
[in]num_sectorNumber of disk sectors to write
Returns
0 on success, negative errno code on fail