diskio.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 ChaN
3  * Copyright 2016 INRIA
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
22 #ifndef DISKIO_H
23 #define DISKIO_H
24 
25 #include <stdint.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* These functions are defined in asmfunc.S */
32 
40 void copy_al2un(unsigned char *dst, const unsigned long *src, int count);
41 
49 void copy_un2al(unsigned long *dst, const unsigned char *src, int count);
50 
51 
53 typedef enum {
60 
64 typedef enum {
68 } diskio_sta_t;
69 
79 #define CTRL_SYNC 0
80 #define GET_SECTOR_COUNT 1
81 #define GET_SECTOR_SIZE 2
82 #define GET_BLOCK_SIZE 3
83 #define CTRL_ERASE_SECTOR 4
90 #define CTRL_POWER 5
91 #define CTRL_LOCK 6
92 #define CTRL_EJECT 7
99 #define MMC_GET_TYPE 10
100 #define MMC_GET_CSD 11
101 #define MMC_GET_CID 12
102 #define MMC_GET_OCR 13
103 #define MMC_GET_SDSTAT 14
115 diskio_sta_t mci_initialize(void);
116 
124 
135 diskio_result_t mci_read(unsigned char *buff, unsigned long sector, unsigned char count);
136 
146 diskio_result_t mci_write(const unsigned char *buff, unsigned long sector, unsigned char count);
147 
157 diskio_result_t mci_ioctl(unsigned char ctrl, void *buff);
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif /* DISKIO_H */
164 
DISKIO_RES_ERROR
@ DISKIO_RES_ERROR
1: R/W Error
Definition: diskio.h:55
DISKIO_STA_NOINIT
@ DISKIO_STA_NOINIT
Drive not initialized.
Definition: diskio.h:65
copy_al2un
void copy_al2un(unsigned char *dst, const unsigned long *src, int count)
Copy aligned to unaligned.
mci_read
diskio_result_t mci_read(unsigned char *buff, unsigned long sector, unsigned char count)
Read sectors over the media control interface (MCI)
DISKIO_STA_NODISK
@ DISKIO_STA_NODISK
No medium in the drive.
Definition: diskio.h:66
DISKIO_RES_PARERR
@ DISKIO_RES_PARERR
4: Invalid Parameter
Definition: diskio.h:58
mci_status
diskio_sta_t mci_status(void)
Get the status of the media control interface (MCI)
copy_un2al
void copy_un2al(unsigned long *dst, const unsigned char *src, int count)
Copy unaligned to aligned.
diskio_result_t
diskio_result_t
Results of Disk Functions.
Definition: diskio.h:53
DISKIO_STA_PROTECT
@ DISKIO_STA_PROTECT
Write protected.
Definition: diskio.h:67
diskio_sta_t
diskio_sta_t
Disk Status Bits.
Definition: diskio.h:64
mci_write
diskio_result_t mci_write(const unsigned char *buff, unsigned long sector, unsigned char count)
Write sectors over the media control interface (MCI)
DISKIO_RES_NOTRDY
@ DISKIO_RES_NOTRDY
3: Not Ready
Definition: diskio.h:57
DISKIO_RES_OK
@ DISKIO_RES_OK
0: Successful
Definition: diskio.h:54
mci_ioctl
diskio_result_t mci_ioctl(unsigned char ctrl, void *buff)
IOCTL functions for the media control interface (MCI)
DISKIO_RES_WRPRT
@ DISKIO_RES_WRPRT
2: Write Protected
Definition: diskio.h:56