[b759b04] | 1 | /* |
---|
| 2 | * Console driver for CSB337 |
---|
| 3 | * |
---|
| 4 | * This driver uses the shared console driver in |
---|
| 5 | * ...../libbsp/shared/console.c |
---|
| 6 | * |
---|
| 7 | * Copyright (c) 2003 by Cogent Computer Systems |
---|
| 8 | * Written by Jay Monkman <jtm@lopingdog.com> |
---|
| 9 | * |
---|
| 10 | * The license and distribution terms for this file may be |
---|
| 11 | * found in the file LICENSE in this distribution or at |
---|
[e8d4bd3e] | 12 | * http://www.rtems.com/license/LICENSE. |
---|
[b759b04] | 13 | * |
---|
[e7bde492] | 14 | * FrameBuffer Console Device Support added By Joel Sherrill, 2009. |
---|
| 15 | * |
---|
[b759b04] | 16 | * $Id$ |
---|
| 17 | */ |
---|
[e7bde492] | 18 | |
---|
[b759b04] | 19 | #include <bsp.h> |
---|
| 20 | #include <rtems/libio.h> |
---|
| 21 | #include <termios.h> |
---|
| 22 | #include <rtems/bspIo.h> |
---|
| 23 | |
---|
| 24 | #include <at91rm9200.h> |
---|
| 25 | #include <at91rm9200_dbgu.h> |
---|
| 26 | #include <libchip/serial.h> |
---|
| 27 | #include <libchip/sersupp.h> |
---|
[e7bde492] | 28 | #include <bspopts.h> |
---|
[b759b04] | 29 | |
---|
[e7bde492] | 30 | /* rtems console uses the following minor number */ |
---|
| 31 | rtems_device_minor_number Console_Port_Minor = 0; |
---|
| 32 | extern console_fns dbgu_fns; |
---|
| 33 | #if ENABLE_LCD |
---|
| 34 | extern console_fns fbcons_fns; |
---|
[737f8c4] | 35 | #define LCD_DEVICE 1 |
---|
[e7bde492] | 36 | #else |
---|
[737f8c4] | 37 | #define LCD_DEVICE 0 |
---|
[e7bde492] | 38 | #endif |
---|
[b759b04] | 39 | |
---|
[737f8c4] | 40 | #if ENABLE_UMON_CONSOLE |
---|
| 41 | extern console_fns umoncons_fns; |
---|
| 42 | #define UMON_CONSOLE_DEVICE 1 |
---|
| 43 | #else |
---|
| 44 | #define UMON_CONSOLE_DEVICE 0 |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | #define NUM_DEVS (1 + LCD_DEVICE + UMON_CONSOLE_DEVICE) |
---|
| 48 | |
---|
[b759b04] | 49 | /* These are used by code in console.c */ |
---|
| 50 | unsigned long Console_Port_Count = NUM_DEVS; |
---|
| 51 | console_data Console_Port_Data[NUM_DEVS]; |
---|
| 52 | |
---|
| 53 | /* |
---|
| 54 | * There's one item in array for each UART. |
---|
| 55 | * |
---|
| 56 | * Some of these fields are marked "NOT USED". They are not used |
---|
| 57 | * by console.c, but may be used by drivers in libchip |
---|
| 58 | * |
---|
| 59 | * when we add other types of UARTS we will need to move this |
---|
| 60 | * structure to a generic uart.c file with only this in it |
---|
| 61 | */ |
---|
| 62 | console_tbl Console_Port_Tbl[] = { |
---|
[e7bde492] | 63 | { |
---|
| 64 | "/dev/console", /* sDeviceName */ |
---|
| 65 | SERIAL_CUSTOM, /* deviceType */ |
---|
| 66 | &dbgu_fns, /* pDeviceFns */ |
---|
| 67 | NULL, /* deviceProbe */ |
---|
| 68 | NULL, /* pDeviceFlow */ |
---|
| 69 | 0, /* ulMargin - NOT USED */ |
---|
| 70 | 0, /* ulHysteresis - NOT USED */ |
---|
| 71 | NULL, /* pDeviceParams */ |
---|
| 72 | DBGU_BASE, /* ulCtrlPort1 - Pointer to DBGU regs */ |
---|
| 73 | 0, /* ulCtrlPort2 - NOT USED */ |
---|
| 74 | 0, /* ulDataPort - NOT USED */ |
---|
| 75 | NULL, /* getRegister - NOT USED */ |
---|
| 76 | NULL, /* setRegister - NOT USED */ |
---|
| 77 | NULL, /* getData - NOT USED */ |
---|
| 78 | NULL, /* setData - NOT USED */ |
---|
| 79 | 0, /* ulClock - NOT USED */ |
---|
| 80 | 0 /* ulIntVector - NOT USED */ |
---|
| 81 | }, |
---|
| 82 | #if ENABLE_LCD |
---|
| 83 | { |
---|
| 84 | "/dev/fbcons", /* sDeviceName */ |
---|
| 85 | SERIAL_CUSTOM, /* deviceType */ |
---|
| 86 | &fbcons_fns, /* pDeviceFns */ |
---|
| 87 | NULL, /* deviceProbe */ |
---|
| 88 | NULL, /* pDeviceFlow */ |
---|
| 89 | 0, /* ulMargin - NOT USED */ |
---|
| 90 | 0, /* ulHysteresis - NOT USED */ |
---|
| 91 | NULL, /* pDeviceParams */ |
---|
| 92 | 0, /* ulCtrlPort1 - Pointer to DBGU regs */ |
---|
| 93 | 0, /* ulCtrlPort2 - NOT USED */ |
---|
| 94 | 0, /* ulDataPort - NOT USED */ |
---|
| 95 | NULL, /* getRegister - NOT USED */ |
---|
| 96 | NULL, /* setRegister - NOT USED */ |
---|
| 97 | NULL, /* getData - NOT USED */ |
---|
| 98 | NULL, /* setData - NOT USED */ |
---|
| 99 | 0, /* ulClock - NOT USED */ |
---|
| 100 | 0 /* ulIntVector - NOT USED */ |
---|
[737f8c4] | 101 | }, |
---|
| 102 | #endif |
---|
| 103 | #if ENABLE_UMON_CONSOLE |
---|
| 104 | { |
---|
| 105 | "/dev/umon", /* sDeviceName */ |
---|
| 106 | SERIAL_CUSTOM, /* deviceType */ |
---|
| 107 | &umoncons_fns, /* pDeviceFns */ |
---|
| 108 | NULL, /* deviceProbe */ |
---|
| 109 | NULL, /* pDeviceFlow */ |
---|
| 110 | 0, /* ulMargin - NOT USED */ |
---|
| 111 | 0, /* ulHysteresis - NOT USED */ |
---|
| 112 | NULL, /* pDeviceParams */ |
---|
| 113 | 0, /* ulCtrlPort1 - Pointer to UMON regs */ |
---|
| 114 | 0, /* ulCtrlPort2 - NOT USED */ |
---|
| 115 | 0, /* ulDataPort - NOT USED */ |
---|
| 116 | NULL, /* getRegister - NOT USED */ |
---|
| 117 | NULL, /* setRegister - NOT USED */ |
---|
| 118 | NULL, /* getData - NOT USED */ |
---|
| 119 | NULL, /* setData - NOT USED */ |
---|
| 120 | 0, /* ulClock - NOT USED */ |
---|
| 121 | 0 /* ulIntVector - NOT USED */ |
---|
[e7bde492] | 122 | } |
---|
| 123 | #endif |
---|
| 124 | }; |
---|
[b759b04] | 125 | |
---|
| 126 | |
---|
| 127 | console_tbl *BSP_get_uart_from_minor(int minor) |
---|
| 128 | { |
---|
| 129 | return &Console_Port_Tbl[minor]; |
---|
| 130 | } |
---|