Add SD function

Add SD function and tests for RZ_A1H.
pull/744/head
Masao Hamanaka 2014-11-27 17:12:57 +09:00
parent 495ba6d817
commit cf9fc3c4ac
5 changed files with 13 additions and 1 deletions

View File

@ -76,6 +76,7 @@ typedef enum {
typedef enum {
SPI_0 = 0,
SPI_1,
SPI_2,
} SPIName;
typedef enum {

View File

@ -27,24 +27,28 @@
static const PinMap PinMap_SPI_SCLK[] = {
{P10_12, SPI_0, 4},
{P11_12, SPI_1, 2},
{P8_3, SPI_2, 3},
{NC , NC , 0}
};
static const PinMap PinMap_SPI_SSEL[] = {
{P10_13, SPI_0, 4},
{P11_13, SPI_1, 2},
{P8_4, SPI_2, 3},
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MOSI[] = {
{P10_14, SPI_0, 4},
{P11_14, SPI_1, 2},
{P8_5, SPI_2, 3},
{NC , NC , 0}
};
static const PinMap PinMap_SPI_MISO[] = {
{P10_15, SPI_0, 4},
{P11_15, SPI_1, 2},
{P8_6, SPI_2, 3},
{NC , NC , 0}
};
@ -73,6 +77,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
switch ((int)obj->spi) {
case SPI_0: CPGSTBCR10 &= ~(0x80); break;
case SPI_1: CPGSTBCR10 &= ~(0x40); break;
case SPI_2: CPGSTBCR10 &= ~(0x20); break;
}
dummy = CPGSTBCR10;

View File

@ -42,6 +42,9 @@ SDFileSystem sd(D11, D12, D13, D10, "sd");
#elif defined(TARGET_LPC1549)
SDFileSystem sd(D11, D12, D13, D10, "sd");
#elif defined(TARGET_RZ_A1H)
SDFileSystem sd(P8_5, P8_6, P8_3, P8_4, "sd");
#else
SDFileSystem sd(p11, p12, p13, p14, "sd");
#endif

View File

@ -20,6 +20,9 @@ void sd_thread(void const *argument)
#elif defined(TARGET_K64F)
SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
#elif defined(TARGET_RZ_A1H)
SDFileSystem sd(P8_5, P8_6, P8_3, P8_4, "sd");
#else
SDFileSystem sd(p11, p12, p13, p14, "sd");
#endif

View File

@ -644,7 +644,7 @@ TESTS = [
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB, FS_LIBRARY],
"automated": True,
"peripherals": ["SD"],
"mcu": ["LPC1768", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z"],
"mcu": ["LPC1768", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H"],
},
# Networking Tests