git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1281 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2009-11-10 22:13:59 +00:00
parent e48e822aa8
commit 176444320c
7 changed files with 28 additions and 18 deletions

View File

@ -372,6 +372,8 @@ bool_t mmcSequentialRead(MMCDriver *mmcp, uint8_t *buffer) {
* @retval TRUE the operation failed.
*/
bool_t mmcStopSequentialRead(MMCDriver *mmcp) {
static const uint8_t stopcmd[] = {0x40 | MMC_CMDSTOP, 0, 0, 0, 0, 1, 0xFF};
bool_t result;
chDbgCheck(mmcp != NULL, "mmcStopSequentialRead");
@ -382,11 +384,15 @@ bool_t mmcStopSequentialRead(MMCDriver *mmcp) {
}
chSysUnlock();
spiSend(mmcp->mmc_spip, sizeof(stopcmd), stopcmd);
result = recvr1(mmcp) != 0x00;
spiUnselect(mmcp->mmc_spip);
chSysLock();
if (mmcp->mmc_state == MMC_READING)
mmcp->mmc_state = MMC_READY;
chSysUnlock();
return FALSE;
return result;
}
/** @} */

View File

@ -61,7 +61,7 @@ static void spi_stop(SPIDriver *spip) {
}
static void spi_start_wait(SPIDriver *spip, size_t n,
void *rxbuf, void *txbuf) {
const void *txbuf, void *rxbuf) {
uint32_t ccr;
/* Common DMA setup.*/
@ -294,7 +294,7 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) {
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_TEIE;
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_TEIE;
spi_start_wait(spip, n, &dummyrx, &dummytx);
spi_start_wait(spip, n, &dummytx, &dummyrx);
}
/**
@ -309,11 +309,12 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) {
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*/
void spi_lld_exchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf) {
void spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf) {
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC | DMA_CCR1_TEIE;
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC | DMA_CCR1_TEIE;
spi_start_wait(spip, n, rxbuf, txbuf);
spi_start_wait(spip, n, txbuf, rxbuf);
}
/**
@ -326,11 +327,11 @@ void spi_lld_exchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf) {
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*/
void spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) {
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_TEIE;
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC | DMA_CCR1_TEIE;
spi_start_wait(spip, n, &dummyrx, txbuf);
spi_start_wait(spip, n, txbuf, &dummyrx);
}
/**
@ -347,7 +348,7 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC | DMA_CCR1_TEIE;
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_TEIE;
spi_start_wait(spip, n, rxbuf, &dummytx);
spi_start_wait(spip, n, &dummytx, rxbuf);
}
/** @} */

View File

@ -186,8 +186,9 @@ extern "C" {
void spi_lld_select(SPIDriver *spip);
void spi_lld_unselect(SPIDriver *spip);
void spi_lld_ignore(SPIDriver *spip, size_t n);
void spi_lld_exchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf);
void spi_lld_send(SPIDriver *spip, size_t n, void *txbuf);
void spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf);
void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf);
void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf);
#ifdef __cplusplus
}

View File

@ -159,7 +159,7 @@ void spiIgnore(SPIDriver *spip, size_t n) {
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*/
void spiExchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf) {
void spiExchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf) {
chDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL) && (txbuf != NULL),
"spiExchange");
@ -180,7 +180,7 @@ void spiExchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf) {
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*/
void spiSend(SPIDriver *spip, size_t n, void *txbuf) {
void spiSend(SPIDriver *spip, size_t n, const void *txbuf) {
chDbgCheck((spip != NULL) && (n > 0) && (txbuf != NULL),
"spiSend");

View File

@ -60,8 +60,8 @@ extern "C" {
void spiSelect(SPIDriver *spip);
void spiUnselect(SPIDriver *spip);
void spiIgnore(SPIDriver *spip, size_t n);
void spiExchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf);
void spiSend(SPIDriver *spip, size_t n, void *txbuf);
void spiExchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf);
void spiSend(SPIDriver *spip, size_t n, const void *txbuf);
void spiReceive(SPIDriver *spip, size_t n, void *rxbuf);
#if SPI_USE_MUTUAL_EXCLUSION
void spiAcquireBus(SPIDriver *spip);

View File

@ -112,7 +112,8 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) {
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*/
void spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
void spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf) {
}
@ -126,7 +127,7 @@ void spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*/
void spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) {
}

View File

@ -91,8 +91,9 @@ extern "C" {
void spi_lld_select(SPIDriver *spip);
void spi_lld_unselect(SPIDriver *spip);
void spi_lld_ignore(SPIDriver *spip, size_t n);
void spi_lld_exchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf);
void spi_lld_send(SPIDriver *spip, size_t n, void *txbuf);
void spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf);
void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf);
void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf);
#ifdef __cplusplus
}