git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1261 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
5d84678f57
commit
37182851ef
|
@ -88,6 +88,7 @@ static msg_t spi_start_wait(SPIDriver *spip) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
spip->spd_spi->CR1 |= SPI_CR1_SPE; /* SPI enable.*/
|
spip->spd_spi->CR1 |= SPI_CR1_SPE; /* SPI enable.*/
|
||||||
|
|
||||||
spip->spd_thread = currp;
|
spip->spd_thread = currp;
|
||||||
chSchGoSleepS(PRSUSPENDED); /* Wait for completion event.*/
|
chSchGoSleepS(PRSUSPENDED); /* Wait for completion event.*/
|
||||||
spip->spd_thread = NULL;
|
spip->spd_thread = NULL;
|
||||||
|
@ -312,10 +313,8 @@ void spi_lld_unselect(SPIDriver *spip) {
|
||||||
*/
|
*/
|
||||||
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
|
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
|
||||||
|
|
||||||
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC |
|
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC | DMA_CCR1_TEIE;
|
||||||
DMA_CCR1_TEIE | DMA_CCR1_EN;
|
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC | DMA_CCR1_TEIE;
|
||||||
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC |
|
|
||||||
DMA_CCR1_TEIE | DMA_CCR1_EN;
|
|
||||||
dma_start(spip, n, rxbuf, txbuf);
|
dma_start(spip, n, rxbuf, txbuf);
|
||||||
return spi_start_wait(spip);
|
return spi_start_wait(spip);
|
||||||
}
|
}
|
||||||
|
@ -335,10 +334,8 @@ msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
|
||||||
*/
|
*/
|
||||||
msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
|
msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
|
||||||
|
|
||||||
spip->spd_dmarx->CCR = DMA_CCR1_TCIE |
|
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_TEIE;
|
||||||
DMA_CCR1_TEIE | DMA_CCR1_EN;
|
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC | DMA_CCR1_TEIE;
|
||||||
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC |
|
|
||||||
DMA_CCR1_TEIE | DMA_CCR1_EN;
|
|
||||||
dma_start(spip, n, &dummyrx, txbuf);
|
dma_start(spip, n, &dummyrx, txbuf);
|
||||||
return spi_start_wait(spip);
|
return spi_start_wait(spip);
|
||||||
}
|
}
|
||||||
|
@ -358,10 +355,8 @@ msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
|
||||||
*/
|
*/
|
||||||
msg_t spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
|
msg_t spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
|
||||||
|
|
||||||
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC |
|
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC | DMA_CCR1_TEIE;
|
||||||
DMA_CCR1_TEIE | DMA_CCR1_EN;
|
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_TEIE;
|
||||||
spip->spd_dmatx->CCR = DMA_CCR1_DIR |
|
|
||||||
DMA_CCR1_TEIE | DMA_CCR1_EN;
|
|
||||||
dma_start(spip, n, rxbuf, &dummytx);
|
dma_start(spip, n, rxbuf, &dummytx);
|
||||||
return spi_start_wait(spip);
|
return spi_start_wait(spip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
|
|
||||||
#include "stm32_dma.h"
|
#include "stm32_dma.h"
|
||||||
|
|
||||||
|
#undef FALSE
|
||||||
|
#undef TRUE
|
||||||
|
#include <stm32f10x.h>
|
||||||
|
#define FALSE 0
|
||||||
|
#define TRUE (!FALSE)
|
||||||
|
|
||||||
static cnt_t dmacnt1;
|
static cnt_t dmacnt1;
|
||||||
#if defined(STM32F10X_HD) || defined (STM32F10X_CL)
|
#if defined(STM32F10X_HD) || defined (STM32F10X_CL)
|
||||||
static cnt_t dmacnt2;
|
static cnt_t dmacnt2;
|
||||||
|
@ -39,8 +45,11 @@ static cnt_t dmacnt2;
|
||||||
void dmaInit(void) {
|
void dmaInit(void) {
|
||||||
|
|
||||||
dmacnt1 = 0;
|
dmacnt1 = 0;
|
||||||
|
DMA1->IFCR = 0x0FFFFFFF;
|
||||||
|
|
||||||
#if defined(STM32F10X_HD) || defined (STM32F10X_CL)
|
#if defined(STM32F10X_HD) || defined (STM32F10X_CL)
|
||||||
dmacnt2 = 0;
|
dmacnt2 = 0;
|
||||||
|
DMA2->IFCR = 0x0FFFFFFF;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
*** 1.3.4 ***
|
*** 1.3.4 ***
|
||||||
- NEW: New SPI (master) driver model.
|
- NEW: New SPI (master) driver model.
|
||||||
|
- NEW: SPI driver for STM32 implementing the new SPI driver model.
|
||||||
|
|
||||||
*** 1.3.3 ***
|
*** 1.3.3 ***
|
||||||
- FIX: Fixed bug in the LPC2148 PAL driver (bug 2881380).
|
- FIX: Fixed bug in the LPC2148 PAL driver (bug 2881380).
|
||||||
|
|
Loading…
Reference in New Issue