File indexing completed on 2025-05-11 08:24:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <bsp.h>
0021 #include <rtems/bspIo.h>
0022
0023 void console_outbyte_polled( int port, unsigned char ch )
0024 {
0025 if ( port == 0 ) {
0026 while ( (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE) == 0 );
0027 LEON_REG.UART_Channel_1 = (unsigned int) ch;
0028 return;
0029 }
0030
0031 while ( (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE) == 0 );
0032 LEON_REG.UART_Channel_2 = (unsigned int) ch;
0033 }
0034
0035 int console_inbyte_nonblocking( int port )
0036 {
0037 if ( port == 0 ) {
0038 if (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_ERR) {
0039 LEON_REG.UART_Status_1 = ~LEON_REG_UART_STATUS_ERR;
0040 }
0041
0042 if ((LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_DR) == 0)
0043 return -1;
0044 return (int) LEON_REG.UART_Channel_1;
0045 }
0046
0047 if (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_ERR) {
0048 LEON_REG.UART_Status_2 = ~LEON_REG_UART_STATUS_ERR;
0049 }
0050
0051 if ((LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_DR) == 0)
0052 return -1;
0053 return (int) LEON_REG.UART_Channel_2;
0054 }
0055
0056 static void bsp_out_char( char c )
0057 {
0058 console_outbyte_polled( 0, c );
0059 }
0060
0061 BSP_output_char_function_type BSP_output_char = bsp_out_char;
0062
0063 static int bsp_in_char( void )
0064 {
0065 return console_inbyte_nonblocking( 0 );
0066 }
0067
0068 BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char;