4.115
Last change
on this file since 8affb5a9 was
8affb5a9,
checked in by Joel Sherrill <joel.sherrill@…>, on 08/20/10 at 21:22:27
|
2010-08-20 <yann.sionneau@…>
Add Milkymist BSP developed as part of GSOC 2010.
- ChangeLog?, Makefile.am, README, bsp_specs, configure.ac,
preinstall.am, Documentation/uart.txt, include/.cvsignore,
include/bsp.h, include/system_conf.h, include/tm27.h,
make/custom/milkymist.cfg, startup/linkcmds: New files.
|
-
Property mode set to
100644
|
File size:
609 bytes
|
Rev | Line | |
---|
[8affb5a9] | 1 | Initialization : |
---|
| 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 | |
---|
| 10 | How to send a byte to uart : |
---|
| 11 | |
---|
| 12 | void writechar(char c) |
---|
| 13 | { |
---|
| 14 | CSR_UART_RXTX = c; |
---|
| 15 | while(!(irq_pending() & IRQ_UARTTX)); |
---|
| 16 | irq_ack(IRQ_UARTTX); |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | How to receive a byte from uart : |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | char 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.