@@ -0,0 +1,65 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the libuc, microcontroler library | |||
|
3 | -- Copyright (C) 2012, Alexis Jeandet | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------- | |||
|
19 | -- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@gmail.com | |||
|
21 | -------------------------------------------------------------------------------*/ | |||
|
22 | #ifndef SDCARD-SDIO_H | |||
|
23 | #define SDCARD-SDIO_H | |||
|
24 | #include <blkdevice.h> | |||
|
25 | #include <libucstrings.h> | |||
|
26 | #include <uhandle.h> | |||
|
27 | #include <sdcard.h> | |||
|
28 | ||||
|
29 | extern void sdcardsdiomake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy)); | |||
|
30 | extern void sdcardsdiomakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected); | |||
|
31 | ||||
|
32 | ||||
|
33 | #endif | |||
|
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 | ||||
|
61 | ||||
|
62 | ||||
|
63 | ||||
|
64 | ||||
|
65 |
@@ -0,0 +1,66 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the libuc, microcontroler library | |||
|
3 | -- Copyright (C) 2012, Alexis Jeandet | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------- | |||
|
19 | -- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@gmail.com | |||
|
21 | -------------------------------------------------------------------------------*/ | |||
|
22 | #ifndef SDCARD-SPI_H | |||
|
23 | #define SDCARD-SPI_H | |||
|
24 | #include <blkdevice.h> | |||
|
25 | #include <libucstrings.h> | |||
|
26 | #include <uhandle.h> | |||
|
27 | #include <sdcard.h> | |||
|
28 | ||||
|
29 | ||||
|
30 | extern void sdcardspimake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy)); | |||
|
31 | extern void sdcardspimakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected); | |||
|
32 | ||||
|
33 | ||||
|
34 | #endif | |||
|
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 | ||||
|
61 | ||||
|
62 | ||||
|
63 | ||||
|
64 | ||||
|
65 | ||||
|
66 |
@@ -249,7 +249,14 void bsp_iic_init() | |||||
249 |
|
249 | |||
250 | void bsp_SD_init() |
|
250 | void bsp_SD_init() | |
251 | { |
|
251 | { | |
252 |
|
252 | gpio_t SDIO_DBxList[]={PC8 ,PC9 ,PC10 ,PC11 ,PC12,PD2}; | ||
|
253 | for(int i=0;i<6;i++) | |||
|
254 | { | |||
|
255 | gpio_t SDIO_DBx = gpioopen(SDIO_DBxList[i]); | |||
|
256 | SDIO_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype; | |||
|
257 | gpiosetconfig(&SDIO_DBx); | |||
|
258 | GPIO_PinAFConfig(GPIOGETPORT(SDIO_DBx), (uint8_t)(SDIO_DBx & 0xF), GPIO_AF_SDIO); | |||
|
259 | } | |||
253 | } |
|
260 | } | |
254 |
|
261 | |||
255 | void vs10XXclearXCS(){} |
|
262 | void vs10XXclearXCS(){} |
@@ -19,7 +19,22 | |||||
19 | -- Author : Alexis Jeandet |
|
19 | -- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@gmail.com |
|
20 | -- Mail : alexis.jeandet@gmail.com | |
21 | -------------------------------------------------------------------------------*/ |
|
21 | -------------------------------------------------------------------------------*/ | |
22 |
#include |
|
22 | #include <sdcard.h> | |
|
23 | #include <sdcard-spi.h> | |||
|
24 | ||||
|
25 | int sdcardselect (blkdeviceptr _this); | |||
|
26 | void sdcarddeselect (blkdeviceptr _this); | |||
|
27 | int sdcardwait_ready (sdcardDev* sdcard); | |||
|
28 | int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token); | |||
|
29 | int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr); | |||
|
30 | char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg); | |||
|
31 | ||||
|
32 | DSTATUS sdcarddisk_status (blkdeviceptr _this); | |||
|
33 | DSTATUS sdcarddisk_initialize (blkdeviceptr _this); | |||
|
34 | DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count); | |||
|
35 | DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count); | |||
|
36 | DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff); | |||
|
37 | ||||
23 | static volatile |
|
38 | static volatile | |
24 | unsigned int Timer1, Timer2; /* 1kHz decrement timer stopped at zero (disk_timerproc()) */ |
|
39 | unsigned int Timer1, Timer2; /* 1kHz decrement timer stopped at zero (disk_timerproc()) */ | |
25 |
|
40 |
@@ -67,21 +67,9 struct sdcard_str | |||||
67 |
|
67 | |||
68 | typedef volatile struct sdcard_str sdcardDev; |
|
68 | typedef volatile struct sdcard_str sdcardDev; | |
69 |
|
69 | |||
70 | extern void sdcardmake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy)); |
|
70 | //extern void sdcardmake(sdcardDev* sdcard,UHANDLE phy,void (*rcvr_mmc) (UHANDLE,char *,uint32_t ),void (*xmit_mmc) (UHANDLE,const char *,uint32_t ),void (*setspeed) (UHANDLE phy,uint32_t speed),uint32_t (*getspeed) (UHANDLE phy)); | |
71 | extern void sdcardmakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected); |
|
71 | //extern void sdcardmakeblkdev(blkdevice* dev,sdcardDev* sdcard, blkdevselect_t select,blkdevpower_t power,blkdevdetect_t detect,blkdevwriteprotected_t writeprotected); | |
72 |
|
72 | |||
73 | extern int sdcardselect (blkdeviceptr _this); |
|
|||
74 | extern void sdcarddeselect (blkdeviceptr _this); |
|
|||
75 | extern int sdcardwait_ready (sdcardDev* sdcard); |
|
|||
76 | extern int sdcardxmit_datablock (sdcardDev* sdcard,const char *buff,char token); |
|
|||
77 | extern int sdcardrcvr_datablock (sdcardDev* sdcard,char *buff,uint32_t btr); |
|
|||
78 | extern char sdcardsend_cmd (blkdeviceptr _this,char cmd,uint32_t arg); |
|
|||
79 |
|
||||
80 | extern DSTATUS sdcarddisk_status (blkdeviceptr _this); |
|
|||
81 | extern DSTATUS sdcarddisk_initialize (blkdeviceptr _this); |
|
|||
82 | extern DRESULT sdcarddisk_read (blkdeviceptr _this,char *buff,uint32_t sector,char count); |
|
|||
83 | extern DRESULT sdcarddisk_write (blkdeviceptr _this,const char *buff,uint32_t sector,char count); |
|
|||
84 | extern DRESULT sdcarddisk_ioctl (blkdeviceptr _this,char ctrl,void *buff); |
|
|||
85 |
|
73 | |||
86 | #endif |
|
74 | #endif | |
87 |
|
75 |
General Comments 0
You need to be logged in to leave comments.
Login now