source: rtems/bsps/lm32/milkymist/Documentation/uart.txt @ eb36d11

5
Last change on this file since eb36d11 was eb36d11, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 25, 2018 at 1:06:08 PM

bsps: Move documentation, etc. files to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 609 bytes
Line 
1Initialization :
2
3        set the CSR_UART_DIVISOR to the correct VALUE,
4        depending on the internal frequency of the LatticeMico32 softcore.
5
6        for the ML401 board, this value is calculated using this formula : clk_frequency/230400/16
7        clk_frequency  = 100000000 Hz
8        => we must set CSR_UART_DIVISOR to 27
9
10How to send a byte to uart :
11
12void writechar(char c)
13{
14                CSR_UART_RXTX = c;
15                while(!(irq_pending() & IRQ_UARTTX));
16                irq_ack(IRQ_UARTTX);
17}
18
19How to receive a byte from uart :
20
21
22char readchar()
23{
24        char c;
25        while(!(irq_pending() & IRQ_UARTRX));
26        irq_ack(IRQ_UARTRX);
27        c = CSR_UART_RXTX;
28        return c;
29}
30
31
Note: See TracBrowser for help on using the repository browser.