source: rtems/c/src/lib/libbsp/arm/stm32f4/console/console-config.c @ e230fb4

4.115
Last change on this file since e230fb4 was e230fb4, checked in by Sebastian Huber <sebastian.huber@…>, on 03/29/12 at 19:23:14

bsp/stm32f4: New BSP

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[e230fb4]1/*
2 * Copyright (c) 2012 Sebastian Huber.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Obere Lagerstr. 30
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 */
14
15#include <rtems/bspIo.h>
16
17#include <libchip/serial.h>
18
19#include <bspopts.h>
20#include <bsp/irq.h>
21#include <bsp/usart.h>
22#include <bsp/stm32f4.h>
23
24console_tbl Console_Configuration_Ports [] = {
25  #ifdef STM32F4_ENABLE_USART_1
26    {
27      .sDeviceName = "/dev/ttyS0",
28      .deviceType = SERIAL_CUSTOM,
29      .pDeviceFns = &stm32f4_usart_fns,
30      .ulCtrlPort1 = (uint32_t) &STM32F4_USART_1,
31      .ulCtrlPort2 = 0,
32      .ulClock = STM32F4_USART_BAUD,
33      .ulIntVector = STM32F4_IRQ_USART1
34    },
35  #endif
36  #ifdef STM32F4_ENABLE_USART_2
37    {
38      .sDeviceName = "/dev/ttyS2",
39      .deviceType = SERIAL_CUSTOM,
40      .pDeviceFns = &stm32f4_usart_fns,
41      .ulCtrlPort1 = (uint32_t) &STM32F4_USART_2,
42      .ulCtrlPort2 = 1,
43      .ulClock = STM32F4_USART_BAUD,
44      .ulIntVector = STM32F4_IRQ_USART2
45    },
46  #endif
47  #ifdef STM32F4_ENABLE_USART_3
48    {
49      .sDeviceName = "/dev/ttyS2",
50      .deviceType = SERIAL_CUSTOM,
51      .pDeviceFns = &stm32f4_usart_fns,
52      .ulCtrlPort1 = (uint32_t) &STM32F4_USART_3,
53      .ulCtrlPort2 = 2,
54      .ulClock = STM32F4_USART_BAUD,
55      .ulIntVector = STM32F4_IRQ_USART3
56    },
57  #endif
58  #ifdef STM32F4_ENABLE_UART_4
59    {
60      .sDeviceName = "/dev/ttyS3",
61      .deviceType = SERIAL_CUSTOM,
62      .pDeviceFns = &stm32f4_usart_fns,
63      .ulCtrlPort1 = (uint32_t) &STM32F4_USART_4,
64      .ulCtrlPort2 = 3,
65      .ulClock = STM32F4_USART_BAUD,
66      .ulIntVector = STM32F4_IRQ_UART4
67    },
68  #endif
69  #ifdef STM32F4_ENABLE_UART_5
70    {
71      .sDeviceName = "/dev/ttyS4",
72      .deviceType = SERIAL_CUSTOM,
73      .pDeviceFns = &stm32f4_usart_fns,
74      .ulCtrlPort1 = (uint32_t) &STM32F4_USART_5,
75      .ulCtrlPort2 = 4,
76      .ulClock = STM32F4_USART_BAUD,
77      .ulIntVector = STM32F4_IRQ_UART5
78    },
79  #endif
80  #ifdef STM32F4_ENABLE_USART_6
81    {
82      .sDeviceName = "/dev/ttyS5",
83      .deviceType = SERIAL_CUSTOM,
84      .pDeviceFns = &stm32f4_usart_fns,
85      .ulCtrlPort1 = (uint32_t) &STM32F4_USART_6,
86      .ulCtrlPort2 = 5,
87      .ulClock = STM32F4_USART_BAUD,
88      .ulIntVector = STM32F4_IRQ_USART6
89    },
90  #endif
91};
92
93#define PORT_COUNT \
94  (sizeof(Console_Configuration_Ports) \
95    / sizeof(Console_Configuration_Ports [0]))
96
97unsigned long Console_Configuration_Count = PORT_COUNT;
98
99static void output_char(char c)
100{
101  const console_fns *con =
102    Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
103 
104  if (c == '\n') {
105    con->deviceWritePolled((int) Console_Port_Minor, '\r');
106  }
107  con->deviceWritePolled((int) Console_Port_Minor, c);
108}
109
110BSP_output_char_function_type BSP_output_char = output_char;
111
112BSP_polling_getchar_function_type BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.