Changeset b934898 in rtems for bsps


Ignore:
Timestamp:
Mar 6, 2019, 8:48:41 AM (8 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
923a033
Parents:
02926290
git-author:
Sebastian Huber <sebastian.huber@…> (03/06/19 08:48:41)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/06/19 12:07:16)
Message:

bsp/atsam: Make SPI CS delays configurable

Location:
bsps/arm/atsam
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/atsam/include/bsp/atsam-spi.h

    r02926290 rb934898  
    2828  size_t      pin_count;
    2929  bool        chip_select_decode;
     30
     31  /* Delay before SCLK in ns */
     32  uint32_t    dlybs_in_ns[4];
     33
     34  /* Delay before consecutive word transfers in ns */
     35  uint32_t    dlybct_in_ns[4];
    3036} atsam_spi_config;
    3137
  • bsps/arm/atsam/spi/atsam_spi_bus.c

    r02926290 rb934898  
    149149  bus->spi_regs->SPI_MR = mode;
    150150
    151   csr =
    152     SPI_DLYBCT(1000, BOARD_MCK) |
    153     SPI_DLYBS(1000, BOARD_MCK) |
    154     SPI_CSR_SCBR(scbr) |
    155     SPI_CSR_BITS(bus->base.bits_per_word - 8);
     151  csr = bus->spi_csr[cs]
     152    | SPI_CSR_SCBR(scbr)
     153    | SPI_CSR_BITS(bus->base.bits_per_word - 8);
    156154
    157155  atsam_set_phase_and_polarity(bus->base.mode, &csr);
     
    607605{
    608606  atsam_spi_bus *bus;
     607  size_t i;
    609608
    610609  bus = (atsam_spi_bus *) spi_bus_alloc_and_init(sizeof(*bus));
     
    625624  bus->chip_select_decode = config->chip_select_decode;
    626625
     626  for (i = 0; i < RTEMS_ARRAY_SIZE(bus->spi_csr); ++i) {
     627    if (config->dlybs_in_ns[i] != 0) {
     628      bus->spi_csr[i] |= SPI_DLYBS(config->dlybs_in_ns[i], BOARD_MCK);
     629    }
     630
     631    if (config->dlybct_in_ns[i] != 0) {
     632      bus->spi_csr[i] |= SPI_DLYBCT(config->dlybct_in_ns[i], BOARD_MCK);
     633    }
     634  }
     635
    627636  rtems_binary_semaphore_init(&bus->sem, "ATSAM SPI");
    628637  PIO_Configure(config->pins, config->pin_count);
Note: See TracChangeset for help on using the changeset viewer.