File indexing completed on 2025-05-11 08:23:05
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <rtems/bspIo.h>
0010
0011 #include <libchip/serial.h>
0012
0013 #include <bspopts.h>
0014 #include <bsp/irq.h>
0015 #include <bsp/usart.h>
0016 #include <bsp/stm32f4.h>
0017
0018 console_tbl Console_Configuration_Ports [] = {
0019 #ifdef STM32F4_ENABLE_USART_1
0020 {
0021 .sDeviceName = "/dev/ttyS0",
0022 .deviceType = SERIAL_CUSTOM,
0023 .pDeviceFns = &stm32f4_usart_fns,
0024 .ulCtrlPort1 = (uint32_t) STM32F4_USART_1,
0025 .ulCtrlPort2 = 0,
0026 .ulClock = STM32F4_USART_BAUD,
0027 .ulIntVector = STM32F4_IRQ_USART1
0028 },
0029 #endif
0030 #ifdef STM32F4_ENABLE_USART_2
0031 {
0032 .sDeviceName = "/dev/ttyS1",
0033 .deviceType = SERIAL_CUSTOM,
0034 .pDeviceFns = &stm32f4_usart_fns,
0035 .ulCtrlPort1 = (uint32_t) STM32F4_USART_2,
0036 .ulCtrlPort2 = 1,
0037 .ulClock = STM32F4_USART_BAUD,
0038 .ulIntVector = STM32F4_IRQ_USART2
0039 },
0040 #endif
0041 #ifdef STM32F4_ENABLE_USART_3
0042 {
0043 .sDeviceName = "/dev/ttyS2",
0044 .deviceType = SERIAL_CUSTOM,
0045 .pDeviceFns = &stm32f4_usart_fns,
0046 .ulCtrlPort1 = (uint32_t) STM32F4_USART_3,
0047 .ulCtrlPort2 = 2,
0048 .ulClock = STM32F4_USART_BAUD,
0049 .ulIntVector = STM32F4_IRQ_USART3
0050 },
0051 #endif
0052 #ifdef STM32F4_ENABLE_UART_4
0053 {
0054 .sDeviceName = "/dev/ttyS3",
0055 .deviceType = SERIAL_CUSTOM,
0056 .pDeviceFns = &stm32f4_usart_fns,
0057 .ulCtrlPort1 = (uint32_t) STM32F4_USART_4,
0058 .ulCtrlPort2 = 3,
0059 .ulClock = STM32F4_USART_BAUD,
0060 .ulIntVector = STM32F4_IRQ_UART4
0061 },
0062 #endif
0063 #ifdef STM32F4_ENABLE_UART_5
0064 {
0065 .sDeviceName = "/dev/ttyS4",
0066 .deviceType = SERIAL_CUSTOM,
0067 .pDeviceFns = &stm32f4_usart_fns,
0068 .ulCtrlPort1 = (uint32_t) STM32F4_USART_5,
0069 .ulCtrlPort2 = 4,
0070 .ulClock = STM32F4_USART_BAUD,
0071 .ulIntVector = STM32F4_IRQ_UART5
0072 },
0073 #endif
0074 #ifdef STM32F4_ENABLE_USART_6
0075 {
0076 .sDeviceName = "/dev/ttyS5",
0077 .deviceType = SERIAL_CUSTOM,
0078 .pDeviceFns = &stm32f4_usart_fns,
0079 .ulCtrlPort1 = (uint32_t) STM32F4_USART_6,
0080 .ulCtrlPort2 = 5,
0081 .ulClock = STM32F4_USART_BAUD,
0082 .ulIntVector = STM32F4_IRQ_USART6
0083 },
0084 #endif
0085 };
0086
0087 #define PORT_COUNT \
0088 (sizeof(Console_Configuration_Ports) \
0089 / sizeof(Console_Configuration_Ports [0]))
0090
0091 unsigned long Console_Configuration_Count = PORT_COUNT;
0092
0093 static void output_char(char c)
0094 {
0095 const console_fns *con =
0096 Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
0097
0098 con->deviceWritePolled((int) Console_Port_Minor, c);
0099 }
0100
0101 BSP_output_char_function_type BSP_output_char = output_char;
0102
0103 BSP_polling_getchar_function_type BSP_poll_char = NULL;