Changeset 24fe213 in rtems


Ignore:
Timestamp:
Oct 17, 2016, 12:36:49 PM (3 years ago)
Author:
Alexander Krutwig <alexander.krutwig@…>
Branches:
master
Children:
9361412
Parents:
dfcec559
git-author:
Alexander Krutwig <alexander.krutwig@…> (10/17/16 12:36:49)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/17/16 12:48:43)
Message:

atsam: multiple messages on one cs low level

Location:
c/src/lib/libbsp/arm/atsam
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/atsam/include/atsam-spi.h

    rdfcec559 r24fe213  
    4545        bool rx_transfer_done;
    4646        bool tx_transfer_done;
     47        bool spi_switched_on;
    4748} atsam_spi_bus;
    4849
  • c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c

    rdfcec559 r24fe213  
    9898        /* Block end interrupt for LLI dma mode */
    9999        if (XDMAC_GetChannelIsr(xdmac, channel) & XDMAC_CIS_BIS) {
    100           atsam_finish_command(spid);
    101100        }
    102101      }
     
    111110
    112111      if (bus->rx_transfer_done && bus->tx_transfer_done) {
    113         atsam_finish_command(spid);
    114112        sc = rtems_event_transient_send(bus->task_id);
    115113        assert(sc == RTEMS_SUCCESSFUL);
     
    150148      break;
    151149  }
     150  *csr |= SPI_CSR_CSAAT;
    152151}
    153152
     
    371370  }
    372371
    373   /* Enable the SPI Peripheral */
    374   PMC_EnablePeripheral(spid->spiId);
    375 
    376   /* SPI chip select */
    377   SPI_ChipSelect(pSpiHw, 1 << msg->cs);
    378 
    379   /* Enables the SPI to transfer and receive data. */
    380   SPI_Enable (pSpiHw);
     372  if(!bus->spi_switched_on){
     373    /* Enable the SPI Peripheral */
     374    PMC_EnablePeripheral(spid->spiId);
     375
     376    /* SPI chip select */
     377    SPI_ChipSelect(pSpiHw, 1 << msg->cs);
     378
     379    /* Enables the SPI to transfer and receive data. */
     380    SPI_Enable (pSpiHw);
     381  }
     382
     383  bus->spi_switched_on = true;
    381384
    382385  /* Start DMA 0(RX) && 1(TX) */
     
    454457    if (msgs[i].cs_change > 0) {
    455458      SPI_ReleaseCS(bus->SpiDma.pSpiHw);
     459      atsam_finish_command(&bus->SpiDma);
     460      bus->spi_switched_on = false;
    456461    }
    457462  }
Note: See TracChangeset for help on using the changeset viewer.