The friendly Operating System for the Internet of Things
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 
24 #ifndef DISKIO_H
25 #define DISKIO_H
26 
27 #include <stdint.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /* These functions are defined in asmfunc.S */
34 
42 void copy_al2un(unsigned char *dst, const unsigned long *src, int count);
43 
51 void copy_un2al(unsigned long *dst, const unsigned char *src, int count);
52 
53 
55 typedef enum {
62 
67 typedef enum {
71 } diskio_sta_t;
83 #define CTRL_SYNC 0
84 #define GET_SECTOR_COUNT 1
85 #define GET_SECTOR_SIZE 2
86 #define GET_BLOCK_SIZE 3
87 #define CTRL_ERASE_SECTOR 4
94 #define CTRL_POWER 5
95 #define CTRL_LOCK 6
96 #define CTRL_EJECT 7
103 #define MMC_GET_TYPE 10
104 #define MMC_GET_CSD 11
105 #define MMC_GET_CID 12
106 #define MMC_GET_OCR 13
107 #define MMC_GET_SDSTAT 14
119 diskio_sta_t mci_initialize(void);
120 
128 
139 diskio_result_t mci_read(unsigned char *buff, unsigned long sector, unsigned char count);
140 
150 diskio_result_t mci_write(const unsigned char *buff, unsigned long sector, unsigned char count);
151 
161 diskio_result_t mci_ioctl(unsigned char ctrl, void *buff);
162 
163 #ifdef __cplusplus
164 }
165 #endif
166 
168 #endif /* DISKIO_H */
diskio_sta_t mci_status(void)
Get the status of the media control interface (MCI)
void copy_al2un(unsigned char *dst, const unsigned long *src, int count)
Copy aligned to unaligned.
diskio_result_t
Results of Disk Functions.
Definition: diskio.h:55
3: Not Ready
Definition: diskio.h:59
Write protected.
Definition: diskio.h:70
void copy_un2al(unsigned long *dst, const unsigned char *src, int count)
Copy unaligned to aligned.
Drive not initialized.
Definition: diskio.h:68
4: Invalid Parameter
Definition: diskio.h:60
diskio_result_t mci_read(unsigned char *buff, unsigned long sector, unsigned char count)
Read sectors over the media control interface (MCI)
diskio_result_t mci_ioctl(unsigned char ctrl, void *buff)
IOCTL functions for the media control interface (MCI)
2: Write Protected
Definition: diskio.h:58
0: Successful
Definition: diskio.h:56
No medium in the drive.
Definition: diskio.h:69
diskio_sta_t
Definition: diskio.h:67
diskio_result_t mci_write(const unsigned char *buff, unsigned long sector, unsigned char count)
Write sectors over the media control interface (MCI)
1: R/W Error
Definition: diskio.h:57