17 lines
636 B
C
17 lines
636 B
C
#ifndef EMBPART_MASSSTORAGE_H
|
|
#define EMBPART_MASSSTORAGE_H
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef struct _MassStorage{
|
|
uint32_t sectorSize; // sector size
|
|
void * data; // some arbitrary data
|
|
int (*read_sector)(const struct _MassStorage * mstg, uint32_t idx, uint8_t * data); // read specific sector
|
|
int (*write_sector)(const struct _MassStorage * mstg, uint32_t idx, const uint8_t * data); // read specific sector
|
|
} MassStorage;
|
|
|
|
#define MSTG_READ(mstg, idx, buffer) (mstg)->read_sector((mstg), (idx), (buffer))
|
|
#define MSTG_WRITE(mstg, idx, buffer) (mstg)->write_sector((mstg), (idx), (buffer))
|
|
|
|
#endif //EMBPART_MASSSTORAGE_H
|