SDCard: implement busy flag
[clinton/Smoothieware.git] / src / libs / USBDevice / USBMSD / disk.h
CommitLineData
47b0bbd2
MM
1#ifndef _DISK_H
2#define _DISK_H
3
4#include <stdint.h>
5
6class MSD_Disk {
7public:
8 /*
9 * read a block on a storage chip
10 *
11 * @param data pointer where will be stored read data
12 * @param block block number
13 * @returns 0 if successful
14 */
246fd409 15 virtual int disk_read(char * data, uint32_t block) { return 0; };
47b0bbd2
MM
16
17 /*
18 * write a block on a storage chip
19 *
20 * @param data data to write
21 * @param block block number
22 * @returns 0 if successful
23 */
246fd409 24 virtual int disk_write(const char * data, uint32_t block) { return 0; };
47b0bbd2
MM
25
26 /*
27 * Disk initilization
28 */
246fd409 29 virtual int disk_initialize() { return 0; };
47b0bbd2
MM
30
31 /*
32 * Return the number of blocks
33 *
34 * @returns number of blocks
35 */
246fd409 36 virtual uint32_t disk_sectors() { return 0; };
47b0bbd2
MM
37
38 /*
39 * Return memory size
40 *
41 * @returns memory size
42 */
246fd409 43 virtual uint64_t disk_size() { return 0; };
47b0bbd2 44
246fd409 45 virtual uint32_t disk_blocksize() { return 0; };
47b0bbd2
MM
46
47 /*
48 * To check the status of the storage chip
49 *
50 * @returns status: 0: OK, 1: disk not initialized, 2: no medium in the drive, 4: write protected
51 */
246fd409 52 virtual int disk_status() { return 0; };
47b0bbd2
MM
53
54 /*
55 * check if this disk can do DMA operations
56 */
246fd409
MM
57 virtual bool disk_canDMA() { return 0; };
58
59 virtual int disk_sync() { return 0; };
cab89893
MM
60
61 virtual bool busy() = 0;
47b0bbd2
MM
62};
63
64#endif /* _DISK_H */