Skip to content

Commit

Permalink
elimnate spi_enable_rcc
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Jul 21, 2024
1 parent c10dbfe commit 95acc2b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/driver/at32/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include "core/failloop.h"
#include "driver/interrupt.h"

extern void spi_enable_rcc(spi_ports_t port);

extern bool spi_txn_can_send(spi_bus_device_t *bus, bool dma);
extern void spi_txn_finish(spi_ports_t port);

Expand Down Expand Up @@ -239,9 +237,9 @@ static void spi_device_init(spi_ports_t port) {
}

spi_init_pins(port);
spi_enable_rcc(port);

const spi_port_def_t *def = &spi_port_defs[port];
rcc_enable(def->rcc);
dma_enable_rcc(def->dma_rx);
dma_enable_rcc(def->dma_tx);

Expand Down
4 changes: 0 additions & 4 deletions src/driver/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ DMA_RAM uint8_t txn_buffers[SPI_TXN_MAX][DMA_ALIGN(512)];
extern void spi_reconfigure(spi_bus_device_t *bus);
extern void spi_dma_transfer_begin(spi_ports_t port, uint8_t *buffer, uint32_t length);

void spi_enable_rcc(spi_ports_t port) {
rcc_enable(spi_port_defs[port].rcc);
}

static inline __attribute__((always_inline)) spi_txn_t *spi_txn_pop(spi_bus_device_t *bus) {
ATOMIC_BLOCK_ALL {
for (uint32_t i = 0; i < SPI_TXN_MAX; i++) {
Expand Down
4 changes: 1 addition & 3 deletions src/driver/stm32/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include "core/failloop.h"
#include "driver/interrupt.h"

extern void spi_enable_rcc(spi_ports_t port);

extern bool spi_txn_can_send(spi_bus_device_t *bus, bool dma);
extern void spi_txn_finish(spi_ports_t port);

Expand Down Expand Up @@ -252,9 +250,9 @@ static void spi_device_init(spi_ports_t port) {
}

spi_init_pins(port);
spi_enable_rcc(port);

const spi_port_def_t *def = &spi_port_defs[port];
rcc_enable(def->rcc);
dma_enable_rcc(def->dma_rx);
dma_enable_rcc(def->dma_tx);

Expand Down

0 comments on commit 95acc2b

Please sign in to comment.