mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-29 16:31:18 +01:00
cpu/sam3: fix PMC enable/disable peripheral clock access
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
This commit is contained in:
parent
e09a800978
commit
b4d061943d
@ -88,12 +88,12 @@ void rtt_clear_alarm(void)
|
||||
|
||||
void rtt_poweron(void)
|
||||
{
|
||||
PMC->PMC_PCER0 |= (1 << ID_RTT);
|
||||
PMC->PMC_PCER0 = (1 << ID_RTT);
|
||||
}
|
||||
|
||||
void rtt_poweroff(void)
|
||||
{
|
||||
PMC->PMC_PCER0 &= ~(1 << ID_RTT);
|
||||
PMC->PMC_PCDR0 = (1 << ID_RTT);
|
||||
}
|
||||
|
||||
void isr_rtt(void)
|
||||
|
||||
@ -71,7 +71,7 @@ void spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk)
|
||||
/* lock bus */
|
||||
mutex_lock(&locks[bus]);
|
||||
/* enable SPI device clock */
|
||||
PMC->PMC_PCER0 |= (1 << spi_config[bus].id);
|
||||
PMC->PMC_PCER0 = (1 << spi_config[bus].id);
|
||||
/* set mode and speed */
|
||||
dev(bus)->SPI_CSR[0] = (SPI_CSR_SCBR(CLOCK_CORECLOCK / clk) | mode);
|
||||
dev(bus)->SPI_MR = (SPI_MR_MSTR | SPI_MR_MODFDIS);
|
||||
@ -82,7 +82,7 @@ void spi_release(spi_t bus)
|
||||
{
|
||||
/* disable device and turn off clock signal */
|
||||
dev(bus)->SPI_CR = 0;
|
||||
PMC->PMC_PCER0 &= ~(1 << spi_config[bus].id);
|
||||
PMC->PMC_PCDR0 = (1 << spi_config[bus].id);
|
||||
/* release device lock */
|
||||
mutex_unlock(&locks[bus]);
|
||||
}
|
||||
|
||||
@ -89,12 +89,12 @@ void uart_write(uart_t uart, const uint8_t *data, size_t len)
|
||||
|
||||
void uart_poweron(uart_t uart)
|
||||
{
|
||||
PMC->PMC_PCER0 |= (1 << uart_config[uart].pmc_id);
|
||||
PMC->PMC_PCER0 = (1 << uart_config[uart].pmc_id);
|
||||
}
|
||||
|
||||
void uart_poweroff(uart_t uart)
|
||||
{
|
||||
PMC->PMC_PCER0 &= ~(1 << uart_config[uart].pmc_id);
|
||||
PMC->PMC_PCDR0 = (1 << uart_config[uart].pmc_id);
|
||||
}
|
||||
|
||||
static inline void isr_handler(int num)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user