1 | /* |
---|
2 | * Copyright (c) 2013 Alan Cudmore |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * |
---|
7 | * http://www.rtems.com/license/LICENSE |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #include <rtems/bspIo.h> |
---|
12 | |
---|
13 | #include <libchip/serial.h> |
---|
14 | |
---|
15 | #include <bspopts.h> |
---|
16 | #include <bsp/irq.h> |
---|
17 | #include <bsp/usart.h> |
---|
18 | #include <bsp/raspberrypi.h> |
---|
19 | |
---|
20 | console_tbl Console_Configuration_Ports [] = { |
---|
21 | { |
---|
22 | .sDeviceName = "/dev/ttyS0", |
---|
23 | .deviceType = SERIAL_CUSTOM, |
---|
24 | .pDeviceFns = &bcm2835_usart_fns, |
---|
25 | .deviceProbe = NULL, |
---|
26 | .pDeviceFlow = NULL, |
---|
27 | .ulCtrlPort1 = BCM2835_UART0_BASE, |
---|
28 | .ulCtrlPort2 = 0, |
---|
29 | .ulClock = USART0_DEFAULT_BAUD, |
---|
30 | .ulIntVector = BCM2835_IRQ_ID_UART |
---|
31 | } |
---|
32 | }; |
---|
33 | |
---|
34 | #define PORT_COUNT \ |
---|
35 | (sizeof(Console_Configuration_Ports) \ |
---|
36 | / sizeof(Console_Configuration_Ports [0])) |
---|
37 | |
---|
38 | unsigned long Console_Configuration_Count = PORT_COUNT; |
---|
39 | |
---|
40 | static void output_char(char c) |
---|
41 | { |
---|
42 | const console_fns *con = |
---|
43 | Console_Configuration_Ports [Console_Port_Minor].pDeviceFns; |
---|
44 | |
---|
45 | if (c == '\n') { |
---|
46 | con->deviceWritePolled((int) Console_Port_Minor, '\r'); |
---|
47 | } |
---|
48 | con->deviceWritePolled((int) Console_Port_Minor, c); |
---|
49 | } |
---|
50 | |
---|
51 | BSP_output_char_function_type BSP_output_char = output_char; |
---|
52 | |
---|
53 | BSP_polling_getchar_function_type BSP_poll_char = NULL; |
---|