1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
68
72
73
80
99
100
106
110
111
116
120
121
122
/* ... */
#include "ff_gen_drv.h"
Includes
Disk_drvTypeDef disk = {{0},{0},{0},0};
Private variables
/* ... */
uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun)
{
uint8_t ret = 1;
uint8_t DiskNum = 0;
if(disk.nbr < _VOLUMES)
{
disk.is_initialized[disk.nbr] = 0;
disk.drv[disk.nbr] = drv;
disk.lun[disk.nbr] = lun;
DiskNum = disk.nbr++;
path[0] = DiskNum + '0';
path[1] = ':';
path[2] = '/';
path[3] = 0;
ret = 0;
}if (disk.nbr < _VOLUMES) { ... }
return ret;
}{ ... }
/* ... */
uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path)
{
return FATFS_LinkDriverEx(drv, path, 0);
}{ ... }
/* ... */
uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun)
{
uint8_t DiskNum = 0;
uint8_t ret = 1;
if(disk.nbr >= 1)
{
DiskNum = path[0] - '0';
if(disk.drv[DiskNum] != 0)
{
disk.drv[DiskNum] = 0;
disk.lun[DiskNum] = 0;
disk.nbr--;
ret = 0;
}if (disk.drv[DiskNum] != 0) { ... }
}if (disk.nbr >= 1) { ... }
return ret;
}{ ... }
/* ... */
uint8_t FATFS_UnLinkDriver(char *path)
{
return FATFS_UnLinkDriverEx(path, 0);
}{ ... }
/* ... */
uint8_t FATFS_GetAttachedDriversNbr(void)
{
return disk.nbr;
}{ ... }
Private functions