projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use dmac for data blk transfer from sd. Fix set bus with function. Clean up.
[bertos.git]
/
bertos
/
cpu
/
cortex-m3
/
drv
/
hsmci_sam3.h
diff --git
a/bertos/cpu/cortex-m3/drv/hsmci_sam3.h
b/bertos/cpu/cortex-m3/drv/hsmci_sam3.h
index 9e41c016eba00093bac1c50b27907728601d602d..61fb878d5b495dc2096d1da3a8bf1b5991f326ab 100644
(file)
--- a/
bertos/cpu/cortex-m3/drv/hsmci_sam3.h
+++ b/
bertos/cpu/cortex-m3/drv/hsmci_sam3.h
@@
-38,8
+38,10
@@
#ifndef DRV_HSMCI_SAM3_H
#define DRV_HSMCI_SAM3_H
#ifndef DRV_HSMCI_SAM3_H
#define DRV_HSMCI_SAM3_H
-#include <io/cm3.h>
#include <cfg/macros.h>
#include <cfg/macros.h>
+#include <cfg/debug.h>
+
+#include <io/cm3.h>
#define CMD8_V_RANGE_CHECK_PAT 0xAA
#define CMD8_V_RANGE_27V_36V (0x100 | CMD8_V_RANGE_CHECK_PAT)
#define CMD8_V_RANGE_CHECK_PAT 0xAA
#define CMD8_V_RANGE_27V_36V (0x100 | CMD8_V_RANGE_CHECK_PAT)
@@
-72,6
+74,7
@@
} while (!(HSMCI_SR & BV(HSMCI_SR_NOTBUSY)))
} while (!(HSMCI_SR & BV(HSMCI_SR_NOTBUSY)))
+#define HSMCI_INIT_SPEED 400000
typedef struct Hsmci
{
typedef struct Hsmci
{
@@
-87,9
+90,29
@@
INLINE void hsmci_disableIrq(void)
HSMCI_IDR = BV(HSMCI_IER_RTOE);
}
HSMCI_IDR = BV(HSMCI_IER_RTOE);
}
-void hsmci_readResp(void *resp, size_t len);
+INLINE void hsmci_setBusWidth(size_t len)
+{
+ int sdcsel= 0;
+ if (len == 4)
+ sdcsel = 2;
+ if (len == 8)
+ sdcsel = 3;
+
+ HSMCI_SDCR = (sdcsel << HSMCI_SDCR_SDCBUS_SHIFT) & HSMCI_SDCR_SDCBUS_MASK;
+}
+
+void hsmci_readResp(uint32_t *resp, size_t len);
bool hsmci_sendCmd(uint8_t index, uint32_t argument, uint32_t reply_type);
bool hsmci_sendCmd(uint8_t index, uint32_t argument, uint32_t reply_type);
+void hsmci_prgRxDMA(uint32_t *buf, size_t word_num, size_t blk_size);
+void hsmci_prgTxDMA(uint32_t *buf, size_t word_num, size_t blk_size);
+void hsmci_waitTransfer(void);
+
+void hsmci_setSpeed(uint32_t data_rate, int flag);
+
+
+
+
void hsmci_init(Hsmci *hsmci);
#endif /* DRV_HSMCI_SAM3_H */
void hsmci_init(Hsmci *hsmci);
#endif /* DRV_HSMCI_SAM3_H */