You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
1.8 KiB
95 lines
1.8 KiB
/* vim: set ts=4 sw=4 fenc=cp936 et fdm=marker: */
|
|
#ifndef __MMC_USER_H___
|
|
#define __MMC_USER_H___
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
/*
|
|
* mmc userspace interfaces
|
|
*
|
|
* ChangeLog:
|
|
* 2022/03/29: surenyi926 add
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
|
|
#define MMC_BLKSIZE (512)
|
|
|
|
/*
|
|
* mmcInit:
|
|
*
|
|
* initialize the mmc subsystem.
|
|
*
|
|
* return: 0 on success, < 0 on failure.
|
|
*/
|
|
int mmcInit();
|
|
|
|
/* deinitialize the mmc subsystem */
|
|
void mmcClose();
|
|
|
|
/*
|
|
* mmcGetCapacity:
|
|
*
|
|
* query the total size of mmc devices.
|
|
*
|
|
* return: total size.
|
|
*/
|
|
uint64_t mmcGetCapacity();
|
|
|
|
/*
|
|
* mmcReadBlocks:
|
|
*
|
|
* read data from mmc device
|
|
*
|
|
* off: start blocks of mmc device
|
|
* blocks: the blocks of data to read
|
|
* buffer: save data to the buffer
|
|
*
|
|
* return: < 0 on failure, otherwise `blocks` of read
|
|
*/
|
|
int mmcReadBlocks(size_t off, size_t blocks, void *buffer);
|
|
|
|
/*
|
|
* mmcWriteBlocks:
|
|
*
|
|
* write data to mmc device
|
|
*
|
|
* off: start blocks of mmc device
|
|
* blocks: the blocks of data to write
|
|
* buffer: transter the data to mmc device
|
|
*
|
|
* return: < 0 on failure, otherwise `blocks` of wroten
|
|
*/
|
|
int mmcWriteBlocks(size_t off, size_t blocks, void *buffer);
|
|
|
|
/*
|
|
* mmcRead:
|
|
*
|
|
* read data from mmc device (linearity)
|
|
*
|
|
* off: lba start address
|
|
* buffer: save data to the buffer
|
|
* len: bytes of data to read
|
|
*
|
|
* return: < 0 on failure, otherwise `bytes` of read
|
|
*/
|
|
int mmcRead(uint64_t off, void *buffer, size_t len);
|
|
|
|
/*
|
|
* mmcWrite:
|
|
*
|
|
* write data to mmc device (linearity)
|
|
*
|
|
* off: lba start address
|
|
* buffer: save data to the buffer
|
|
* len: bytes of data to write
|
|
*
|
|
* return: < 0 on failure, otherwise `bytes` of wrotten
|
|
*/
|
|
int mmcWrite(uint64_t off, void *buffer, size_t len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|