1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

cpu/fe310: use CLOCK_CORECLOCK macro to get cpu freq

This commit is contained in:
Alexandre Abadie 2019-12-13 14:33:17 +01:00
parent 473f1d7147
commit 3f29eb9efb
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -86,13 +86,8 @@ int uart_init(uart_t dev, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
/* Power on the device */
uart_poweron(dev);
/* Calculate baudrate divisor given current CPU clk rate
* Ignore the first run (icache needs to be warm) */
uartDiv = PRCI_measure_mcycle_freq(1000, RTC_FREQ);
/* cppcheck-suppress redundantAssignment
* (reason: should ignore first cycle to get correct values) */
uartDiv = PRCI_measure_mcycle_freq(1000, RTC_FREQ);
uartDiv = uartDiv / baudrate;
/* Calculate baudrate divisor given current CPU clk rate */
uartDiv = cpu_freq() / baudrate;
/* Enable UART 8-N-1 at given baudrate */
_REG32(uart_config[dev].addr, UART_REG_DIV) = uartDiv;