Changeset fca9132 in rtems


Ignore:
Timestamp:
Sep 28, 2018, 12:45:16 PM (9 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
5cb23f4b
Parents:
69a24c3
git-author:
Sebastian Huber <sebastian.huber@…> (09/28/18 12:45:16)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/01/18 07:01:21)
Message:

bsp/atsam: Use binary semaphore for SPI

Update #3534.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/atsam/spi/atsam_spi_bus.c

    r69a24c3 rfca9132  
    3333#include <bsp/iocopy.h>
    3434
     35#include <rtems/thread.h>
     36
    3537#include <dev/spi/spi.h>
    3638
     
    5456typedef struct {
    5557  spi_bus base;
     58  rtems_binary_semaphore sem;
    5659  bool msg_cs_change;
    5760  const spi_ioc_transfer *msg_current;
     
    5962  uint32_t msg_todo;
    6063  int msg_error;
    61   rtems_id msg_task;
    6264  Spid spi;
    6365  uint32_t dma_tx_channel;
     
    7375static void atsam_spi_wakeup_task(atsam_spi_bus *bus)
    7476{
    75   rtems_status_code sc;
    76 
    77   sc = rtems_event_transient_send(bus->msg_task);
    78   assert(sc == RTEMS_SUCCESSFUL);
     77  rtems_binary_semaphore_post(&bus->sem);
    7978}
    8079
     
    270269{
    271270  Xdmac *pXdmac = XDMAC;
    272   size_t i;
    273271
    274272  atsam_spi_check_alignment_and_set_up_dma_descriptors(
     
    419417)
    420418{
    421   rtems_status_code sc;
    422419  atsam_spi_bus *bus = (atsam_spi_bus *)base;
    423420
     
    427424  bus->msg_todo = msg_count;
    428425  bus->msg_error = 0;
    429   bus->msg_task = rtems_task_self();
    430426  atsam_spi_setup_transfer(bus);
    431   sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    432   assert(sc == RTEMS_SUCCESSFUL);
     427  rtems_binary_semaphore_wait(&bus->sem);
    433428  return bus->msg_error;
    434429}
     
    465460
    466461  spi_bus_destroy_and_free(&bus->base);
     462  rtems_binary_semaphore_destroy(&bus->sem);
    467463}
    468464
     
    625621  bus->chip_select_decode = config->chip_select_decode;
    626622
     623  rtems_binary_semaphore_init(&bus->sem, "ATSAM SPI");
    627624  PIO_Configure(config->pins, config->pin_count);
    628625  PMC_EnablePeripheral(config->spi_peripheral_id);
Note: See TracChangeset for help on using the changeset viewer.