summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-14 07:25:49 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-14 13:09:28 +0100
commit3afa95bae047536165e99cb43232baf5cdaf49e4 (patch)
tree156d88b04222015244eb7e5809228239b8c23e1c
parent1505eca59c8fbf0127debd955d443fe90d267abc (diff)
downloadrtems-3afa95bae047536165e99cb43232baf5cdaf49e4.tar.bz2
bsp/atsam: Hide details of SPI driver
-rw-r--r--c/src/lib/libbsp/arm/atsam/include/atsam-spi.h36
-rw-r--r--c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c19
2 files changed, 24 insertions, 31 deletions
diff --git a/c/src/lib/libbsp/arm/atsam/include/atsam-spi.h b/c/src/lib/libbsp/arm/atsam/include/atsam-spi.h
index e8fba58332..3d02c514c9 100644
--- a/c/src/lib/libbsp/arm/atsam/include/atsam-spi.h
+++ b/c/src/lib/libbsp/arm/atsam/include/atsam-spi.h
@@ -16,43 +16,17 @@
#define LIBBSP_ARM_ATSAM_ATSAM_SPI_H
#include <libchip/chip.h>
-#include <libchip/include/pio.h>
-
-#include <bsp.h>
-#include <dev/spi/spi.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#define DEFAULT_SPI0_CS 0
-#define DEFAULT_SPI_CLOCK 500000
-
-#define REGISTER_COMMAND_LENGTH 2
-
-typedef struct {
- spi_bus base;
- Spi *regs;
- rtems_vector_number irq;
- uint32_t board_id;
- uint32_t msg_todo;
- const spi_ioc_transfer *msgs;
- rtems_id task_id;
- sXdmad Dma;
- Spid SpiDma;
- uint32_t dma_tx_channel;
- uint32_t dma_rx_channel;
- bool rx_transfer_done;
- bool tx_transfer_done;
- bool chip_select_active;
-} atsam_spi_bus;
-
int spi_bus_register_atsam(
- const char *bus_path,
- Spi *register_base,
- rtems_vector_number irq,
- const Pin *pins,
- size_t pin_count
+ const char *bus_path,
+ Spi *register_base,
+ rtems_vector_number irq,
+ const Pin *pins,
+ size_t pin_count
);
#ifdef __cplusplus
diff --git a/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c b/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c
index 00f5d33696..468e4eca9a 100644
--- a/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c
+++ b/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c
@@ -32,8 +32,27 @@
#include <rtems/irq-extension.h>
+#include <dev/spi/spi.h>
+
#define MAX_SPI_FREQUENCY 50000000
+typedef struct {
+ spi_bus base;
+ Spi *regs;
+ rtems_vector_number irq;
+ uint32_t board_id;
+ uint32_t msg_todo;
+ const spi_ioc_transfer *msgs;
+ rtems_id task_id;
+ sXdmad Dma;
+ Spid SpiDma;
+ uint32_t dma_tx_channel;
+ uint32_t dma_rx_channel;
+ bool rx_transfer_done;
+ bool tx_transfer_done;
+ bool chip_select_active;
+} atsam_spi_bus;
+
static void atsam_interrupt_handler(void *arg)
{
atsam_spi_bus *bus = (atsam_spi_bus *)arg;