Changeset cf811a4 in rtems
- Timestamp:
- 07/09/18 11:12:57 (5 years ago)
- Branches:
- 5, master
- Children:
- 6539bea
- Parents:
- 76c03152
- git-author:
- Amaan Cheval <amaan.cheval@…> (07/09/18 11:12:57)
- git-committer:
- Joel Sherrill <joel@…> (07/11/18 20:23:43)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
bsps/x86_64/amd64/console/console.c
r76c03152 rcf811a4 25 25 */ 26 26 27 #include <libchip/ns16550.h> 28 #include <rtems/bspIo.h> 27 29 #include <bsp.h> 28 #include < rtems/bspIo.h>29 #include <rtems/ libio.h>30 #include <bsp/console-termios.h> 31 #include <rtems/score/cpuimpl.h> 30 32 31 /* console_initialize 32 * 33 * This routine initializes the console IO driver. 34 * 35 * Input parameters: NONE 36 * 37 * Output parameters: NONE 38 * 39 * Return values: 40 */ 41 42 rtems_device_driver console_initialize( 43 rtems_device_major_number major, 44 rtems_device_minor_number minor, 45 void *arg 46 ) 33 static uint8_t amd64_uart_get_register(uintptr_t addr, uint8_t i) 47 34 { 48 (void) major; 49 (void) minor; 50 (void) arg; 51 return RTEMS_SUCCESSFUL; 35 return inport_byte(addr + i); 52 36 } 53 37 54 /* 55 * Open entry point 56 */ 57 58 rtems_device_driver console_open( 59 rtems_device_major_number major, 60 rtems_device_minor_number minor, 61 void * arg 62 ) 38 static void amd64_uart_set_register(uintptr_t addr, uint8_t i, uint8_t val) 63 39 { 64 (void) major; 65 (void) minor; 66 (void) arg; 67 return RTEMS_SUCCESSFUL; 40 outport_byte(addr + i, val); 68 41 } 69 42 43 static ns16550_context amd64_uart_context = { 44 .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("UART"), 45 .get_reg = amd64_uart_get_register, 46 .set_reg = amd64_uart_set_register, 47 .port = (uintptr_t) COM1_BASE_IO, 48 .initial_baud = COM1_CLOCK_RATE 49 }; 50 70 51 /* 71 * Close entry point52 * XXX: We should use the interrupt based handler once interrupts are supported 72 53 */ 54 const console_device console_device_table[] = { 55 { 56 .device_file = "/dev/console", 57 .probe = console_device_probe_default, 58 .handler = &ns16550_handler_polled, 59 .context = &amd64_uart_context.base 60 } 61 }; 62 const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table); 73 63 74 rtems_device_driver console_close( 75 rtems_device_major_number major, 76 rtems_device_minor_number minor, 77 void * arg 78 ) 64 static void output_char(char c) 79 65 { 80 (void) major; 81 (void) minor; 82 (void) arg; 83 return RTEMS_SUCCESSFUL; 66 rtems_termios_device_context *ctx = console_device_table[0].context; 67 68 ns16550_polled_putchar(ctx, c); 84 69 } 85 70 86 /* 87 * read bytes from the serial port. We only have stdin. 88 */ 89 90 rtems_device_driver console_read( 91 rtems_device_major_number major, 92 rtems_device_minor_number minor, 93 void * arg 94 ) 95 { 96 (void) major; 97 (void) minor; 98 (void) arg; 99 return RTEMS_SUCCESSFUL; 100 } 101 102 /* 103 * write bytes to the serial port. Stdout and stderr are the same. 104 */ 105 106 rtems_device_driver console_write( 107 rtems_device_major_number major, 108 rtems_device_minor_number minor, 109 void * arg 110 ) 111 { 112 (void) major; 113 (void) minor; 114 (void) arg; 115 return 0; 116 } 117 118 /* 119 * IO Control entry point 120 */ 121 122 rtems_device_driver console_control( 123 rtems_device_major_number major, 124 rtems_device_minor_number minor, 125 void * arg 126 ) 127 { 128 (void) major; 129 (void) minor; 130 (void) arg; 131 return RTEMS_SUCCESSFUL; 132 } 133 134 BSP_output_char_function_type BSP_output_char = NULL; 135 BSP_polling_getchar_function_type BSP_poll_char = NULL; 71 BSP_output_char_function_type BSP_output_char = output_char; 72 BSP_polling_getchar_function_type BSP_poll_char = NULL; -
c/src/lib/libbsp/x86_64/amd64/Makefile.am
r76c03152 rcf811a4 30 30 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/clock/clock-simidle.c 31 31 # console 32 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios-init.c 33 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c 32 34 librtemsbsp_a_SOURCES += ../../../../../../bsps/x86_64/amd64/console/console.c 33 35 # timer -
cpukit/score/cpu/x86_64/include/rtems/score/cpuimpl.h
r76c03152 rcf811a4 29 29 #endif 30 30 31 static inline uint8_t inport_byte(uint16_t port) 32 { 33 uint8_t ret; 34 __asm__ volatile ( "inb %1, %0" 35 : "=a" (ret) 36 : "Nd" (port) ); 37 return ret; 38 } 39 40 static inline void outport_byte(uint16_t port, uint8_t val) 41 { 42 __asm__ volatile ( "outb %0, %1" : : "a" (val), "Nd" (port) ); 43 } 44 31 45 #ifdef __cplusplus 32 46 } -
cpukit/score/cpu/x86_64/include/rtems/score/x86_64.h
r76c03152 rcf811a4 35 35 #define CPU_MODEL_NAME "XXX: x86-64 generic" 36 36 37 #define COM1_BASE_IO 0x3F8 38 #define COM1_CLOCK_RATE (115200 * 16) 39 37 40 #ifdef __cplusplus 38 41 }
Note: See TracChangeset
for help on using the changeset viewer.