rtems_isr console_isr_a( rtems_vector_number vector ) { char ch; int UStat; if ( (UStat = LEON_REG.UART_Status_1) & LEON_REG_UART_STATUS_DR ) { if (UStat & LEON_REG_UART_STATUS_ERR) { LEON_REG.UART_Status_1 = LEON_REG_UART_STATUS_CLR; } ch = LEON_REG.UART_Channel_1; rtems_termios_enqueue_raw_characters( console_termios_data[ 0 ], &ch, 1 ); } if ( LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE ) { if ( !Ring_buffer_Is_empty( &TX_Buffer[ 0 ] ) ) { Ring_buffer_Remove_character( &TX_Buffer[ 0 ], ch ); LEON_REG.UART_Channel_1 = (uint32_t) ch; } else Is_TX_active[ 0 ] = false; } LEON_Clear_interrupt( LEON_INTERRUPT_UART_1_RX_TX ); }
void buffered_io_flush(void) { char ch; while ( !Ring_buffer_Is_empty(&Buffer) ) { Ring_buffer_Remove_character( &Buffer, ch ); fprintf( stderr, "%c", ch ); } FLUSH_OUTPUT(); }
void console_exit() { int i; volatile Ring_buffer_t *buffer; uint32_t ch; for ( i=0 ; i < NUM_Z85C30_PORTS ; i++ ) { buffer = &( Ports_85C30[i].Protocol->TX_Buffer); while ( !Ring_buffer_Is_empty( buffer ) ) { Ring_buffer_Remove_character( buffer, ch ); outbyte_polled_85c30( Ports_85C30[i].ctrl, ch ); } } }
void console_exit() { uint32_t port; uint32_t ch; /* * Although the interrupts for the UART are unmasked, the PIL is set to * disable all external interrupts. So we might as well do this first. */ LEON_Mask_interrupt( LEON_INTERRUPT_UART_1_RX_TX ); LEON_Mask_interrupt( LEON_INTERRUPT_UART_2_RX_TX ); for ( port=0 ; port <= 1 ; port++ ) { while ( !Ring_buffer_Is_empty( &TX_Buffer[ port ] ) ) { Ring_buffer_Remove_character( &TX_Buffer[ port ], ch ); console_outbyte_polled( port, ch ); } } /* * Now wait for all the data to actually get out ... the send register * should be empty. */ while ( (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE) != LEON_REG_UART_STATUS_THE ); while ( (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE) != LEON_REG_UART_STATUS_THE ); LEON_REG.UART_Control_1 = 0; LEON_REG.UART_Control_2 = 0; LEON_REG.UART_Status_1 = 0; LEON_REG.UART_Status_2 = 0; }