File indexing completed on 2025-05-11 08:24:09
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <bsp.h>
0010
0011 #include <libchip/serial.h>
0012
0013 #include <rtems/bspIo.h>
0014
0015 #include <boot/ofw.h>
0016
0017 static int sun4v_console_device_first_open(int major, int minor, void *arg)
0018 {
0019 return 0;
0020 }
0021
0022 static ssize_t sun4v_console_poll_write(int minor, const char *buf, size_t n)
0023 {
0024 ofw_write(buf, n);
0025 return 0;
0026 }
0027
0028 static void sun4v_console_deviceInitialize (int minor)
0029 {
0030
0031 }
0032
0033 static int sun4v_console_poll_read(int minor){
0034 int a;
0035 ofw_read(&a,1);
0036 if ( a != 0 ) {
0037 return a>>24;
0038 }
0039 return -1;
0040 }
0041
0042 static bool sun4v_console_deviceProbe (int minor){
0043 return true;
0044 }
0045
0046
0047
0048
0049 const console_fns pooled_functions={
0050 sun4v_console_deviceProbe,
0051 sun4v_console_device_first_open,
0052 NULL,
0053 sun4v_console_poll_read,
0054 sun4v_console_poll_write,
0055 sun4v_console_deviceInitialize,
0056 NULL,
0057 NULL,
0058 NULL
0059 };
0060
0061 const console_flow sun4v_console_console_flow = {
0062 NULL,
0063 NULL
0064 };
0065
0066 console_tbl Console_Configuration_Ports[] = {
0067 {
0068 "/dev/ttyS0",
0069 SERIAL_CUSTOM,
0070 &pooled_functions,
0071 NULL,
0072 &sun4v_console_console_flow,
0073 0,
0074 0,
0075 (void *) NULL,
0076 0,
0077 0,
0078 1,
0079 NULL,
0080 NULL,
0081 NULL,
0082 NULL,
0083 0,
0084 0
0085 },
0086 };
0087
0088
0089
0090
0091
0092 #define NUM_CONSOLE_PORTS 1
0093
0094 unsigned long Console_Configuration_Count = NUM_CONSOLE_PORTS;
0095
0096
0097
0098 static void bsp_out_char (char c)
0099 {
0100 ofw_write(&c, 1);
0101 }
0102
0103 BSP_output_char_function_type BSP_output_char = bsp_out_char;
0104
0105 static int bsp_in_char( void ){
0106 int tmp;
0107 ofw_read( &tmp, 1 );
0108 if( tmp != 0 ) {
0109 return tmp>>24;
0110 }
0111 return -1;
0112 }
0113
0114 BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char;
0115