diff options
| author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-24 19:39:07 +0000 | 
|---|---|---|
| committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-24 19:39:07 +0000 | 
| commit | af0921235ffe94efb5467b3877b763d3c030cb0c (patch) | |
| tree | 1b34a577306487f54f2a0feaf74a0104538d3e39 /os | |
| parent | d39721a6c2f050afe76421cf7409fc3e1803d154 (diff) | |
| download | ChibiOS-af0921235ffe94efb5467b3877b763d3c030cb0c.tar.gz ChibiOS-af0921235ffe94efb5467b3877b763d3c030cb0c.tar.bz2 ChibiOS-af0921235ffe94efb5467b3877b763d3c030cb0c.zip | |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2285 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
| -rw-r--r-- | os/hal/platforms/LPC11xx/spi_lld.c | 17 | ||||
| -rw-r--r-- | os/hal/platforms/LPC11xx/spi_lld.h | 4 | 
2 files changed, 9 insertions, 12 deletions
| diff --git a/os/hal/platforms/LPC11xx/spi_lld.c b/os/hal/platforms/LPC11xx/spi_lld.c index 50f9903ae..884cdab75 100644 --- a/os/hal/platforms/LPC11xx/spi_lld.c +++ b/os/hal/platforms/LPC11xx/spi_lld.c @@ -81,7 +81,7 @@ static void ssp_fifo_preload(SPIDriver *spip) {   *
   * @param[in] spip      pointer to the @p SPIDriver object
   */
 -static void serve_interrupt(SPIDriver *spip) {
 +static void spi_serve_interrupt(SPIDriver *spip) {
    LPC_SSP_TypeDef *ssp = spip->spd_ssp;
    if ((ssp->MIS & MIS_ROR) != 0) {
 @@ -101,7 +101,7 @@ static void serve_interrupt(SPIDriver *spip) {        (void)ssp->DR;
      if (--spip->spd_rxcnt == 0) {
        chDbgAssert(spip->spd_txcnt == 0,
 -                  "chSemResetI(), #1", "counter out of synch");
 +                  "spi_serve_interrupt(), #1", "counter out of synch");
        /* Stops the IRQ sources.*/
        ssp->IMSC = 0;
        /* Portable SPI ISR code defined in the high level driver, note, it is
 @@ -129,7 +129,7 @@ CH_IRQ_HANDLER(Vector90) {    CH_IRQ_PROLOGUE();
 -  serve_interrupt(&SPID1);
 +  spi_serve_interrupt(&SPID1);
    CH_IRQ_EPILOGUE();
  }
 @@ -145,7 +145,7 @@ CH_IRQ_HANDLER(Vector78) {    CH_IRQ_PROLOGUE();
 -  serve_interrupt(&SPID2);
 +  spi_serve_interrupt(&SPID2);
    CH_IRQ_EPILOGUE();
  }
 @@ -201,6 +201,7 @@ void spi_lld_start(SPIDriver *spip) {      if (&SPID1 == spip) {
        LPC_SYSCON->SSP0CLKDIV = LPC11xx_SPI_SSP0CLKDIV;
        LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 11);
 +      LPC_SYSCON->PRESETCTRL |= 1;
        NVICEnableVector(SSP0_IRQn,
                         CORTEX_PRIORITY_MASK(LPC11xx_SPI_SSP0_IRQ_PRIORITY));
      }
 @@ -209,6 +210,7 @@ void spi_lld_start(SPIDriver *spip) {      if (&SPID2 == spip) {
        LPC_SYSCON->SSP1CLKDIV = LPC11xx_SPI_SSP1CLKDIV;
        LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 18);
 +      LPC_SYSCON->PRESETCTRL |= 4;
        NVICEnableVector(SSP1_IRQn,
                         CORTEX_PRIORITY_MASK(LPC11xx_SPI_SSP1_IRQ_PRIORITY));
      }
 @@ -216,13 +218,10 @@ void spi_lld_start(SPIDriver *spip) {    }
    /* Configuration.*/
    spip->spd_ssp->CR1  = 0;
 -  /* Emptying the receive FIFO, it happens to not be empty while debugging.*/
 -  while (spip->spd_ssp->SR & SR_RNE)
 -    (void) spip->spd_ssp->DR;
    spip->spd_ssp->ICR  = ICR_RT | ICR_ROR;
    spip->spd_ssp->CR0  = spip->spd_config->spc_cr0;
    spip->spd_ssp->CPSR = spip->spd_config->spc_cpsr;
 -  spip->spd_ssp->CR1  = spip->spd_config->spc_cr1 | CR1_SSE;
 +  spip->spd_ssp->CR1  = CR1_SSE;
  }
  /**
 @@ -237,6 +236,7 @@ void spi_lld_stop(SPIDriver *spip) {    if (spip->spd_state != SPI_STOP) {
  #if LPC11xx_SPI_USE_SSP0
      if (&SPID1 == spip) {
 +      LPC_SYSCON->PRESETCTRL &= ~1;
        LPC_SYSCON->SYSAHBCLKCTRL &= ~(1 << 11);
        LPC_SYSCON->SSP0CLKDIV = 0;
        NVICDisableVector(SSP0_IRQn);
 @@ -245,6 +245,7 @@ void spi_lld_stop(SPIDriver *spip) {  #endif
  #if LPC11xx_SPI_USE_SSP1
      if (&SPID2 == spip) {
 +      LPC_SYSCON->PRESETCTRL &= ~4;
        LPC_SYSCON->SYSAHBCLKCTRL &= ~(1 << 18);
        LPC_SYSCON->SSP1CLKDIV = 0;
        NVICDisableVector(SSP1_IRQn);
 diff --git a/os/hal/platforms/LPC11xx/spi_lld.h b/os/hal/platforms/LPC11xx/spi_lld.h index 9510b7591..580787bb1 100644 --- a/os/hal/platforms/LPC11xx/spi_lld.h +++ b/os/hal/platforms/LPC11xx/spi_lld.h @@ -246,10 +246,6 @@ typedef struct {     */
    uint16_t              spc_cr0;
    /**
 -   * @brief SSP CR1 initialization data.
 -   */
 -  uint16_t              spc_cr1;
 -  /**
     * @brief SSP CPSR initialization data.
     */
    uint32_t              spc_cpsr;
 | 
