From e48e822aa8ec66fc9daac05e387ffb77d8f5c452 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Nov 2009 22:00:26 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1280 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/io/mmc_spi.c | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'os/io/mmc_spi.c') diff --git a/os/io/mmc_spi.c b/os/io/mmc_spi.c index 58911a3cf..6a2407a6a 100644 --- a/os/io/mmc_spi.c +++ b/os/io/mmc_spi.c @@ -143,32 +143,6 @@ static uint8_t send_command(MMCDriver *mmcp, uint8_t cmd, uint32_t arg) { return r1; } -/** - * @brief Receives a 512 bytes block and ignores 2 CRC bytes. - * - * @param[in] mmcp pointer to the @p MMCDriver object - * @param[out] buf pointer to the buffer - * - * @return The operation status. - * @retval FALSE the operation was successful. - * @retval TRUE the operation timed out. - */ -static bool_t get_data(MMCDriver *mmcp, uint8_t *buf) { - int i; - - for (i = 0; i < MMC_WAIT_DATA; i++) { - spiReceive(mmcp->mmc_spip, 1, buf); - if (buf[0] == 0xFE) { - spiReceive(mmcp->mmc_spip, 512, buf); - /* CRC ignored. */ - spiIgnore(mmcp->mmc_spip, 2); - return FALSE; - } - } - /* Timeout.*/ - return TRUE; -} - /*===========================================================================*/ /* Driver exported functions. */ /*===========================================================================*/ @@ -337,7 +311,7 @@ bool_t mmcStartSequentialRead(MMCDriver *mmcp, uint32_t startblk) { spiSelect(mmcp->mmc_spip); send_hdr(mmcp, MMC_CMDREADMULTIPLE, startblk << 9); - if (recvr1() != 0x00) { + if (recvr1(mmcp) != 0x00) { spiUnselect(mmcp->mmc_spip); chSysLock(); if (mmcp->mmc_state == MMC_READING) @@ -371,9 +345,9 @@ bool_t mmcSequentialRead(MMCDriver *mmcp, uint8_t *buffer) { chSysUnlock(); for (i = 0; i < MMC_WAIT_DATA; i++) { - spiReceive(mmcp->mmc_spip, 1, buf); - if (buf[0] == 0xFE) { - spiReceive(mmcp->mmc_spip, 512, buf); + spiReceive(mmcp->mmc_spip, 1, buffer); + if (buffer[0] == 0xFE) { + spiReceive(mmcp->mmc_spip, 512, buffer); /* CRC ignored. */ spiIgnore(mmcp->mmc_spip, 2); return FALSE; -- cgit v1.2.3