?? io_dte.c
字號:
* * Stuff that handles UART dte stuff. * * Copyright (c) 1999 Richard J.M. Close * * Can be freely distributed and used under the terms of the GNU GPL. */#include "io_dte.h"// Check wheteher dte or dce!// UART routines.void UART_ri_off(void){ if (io_uart_status != 4) { io_uart_status = io_uart_status | 0x2000; io_uart_msr = io_uart_msr | 4; } io_uart_status = io_uart_status & 0xFFFB; io_uart_msr = io_uart_msr & 0xBF;}void UART_dsr_on(void){ if (io_uart_status == 2) { io_uart_status = io_uart_status | 0x10; io_uart_msr = io_uart_msr | 2; } io_uart_status = io_uart_status | 2; io_uart_msr = io_uart_msr | 0x20;}void UART_dsr_off(void){ if (io_uart_status != 2) { io_uart_status = io_uart_status | 0x10; io_uart_msr = io_uart_msr | 2; } io_uart_status = io_uart_status & 0xFFFD; io_uart_msr = io_uart_msr & 0xDF;}void UART_cts_off(void){ if (io_uart_status != 8) { io_uart_status = io_uart_status | 0x20; io_uart_msr = io_uart_msr | 1; } io_uart_status = io_uart_status & 0xFFF7; io_uart_msr = io_uart_msr & 0xEF;}void UART_cts_on(void){ if (io_uart_status == 8) { io_uart_status = io_uart_status | 0x20; io_uart_msr = io_uart_msr | 1; } io_uart_status = io_uart_status | 8; io_uart_msr = io_uart_msr | 0x10;}void UART_cd_off(void){ if (io_uart_status != 1) { io_uart_status = io_uart_status | 0x1000; io_uart_msr = io_uart_msr | 8; } io_uart_status = io_uart_status & 0xFFFE; io_uart_msr = io_uart_msr & 0x7F;}void UART_cd_on(void){ if (io_uart_status == 1) { io_uart_status = io_uart_status | 0x1000; io_uart_msr = io_uart_msr | 8; } io_uart_status = io_uart_status | 1; io_uart_msr = io_uart_msr | 0x80;}void UART_xoff_off(void){ io_uart_status = io_uart_status & 0x7FFF;}void UART_xoff_on(void){ io_uart_status = io_uart_status | 0x8000;}void UART_SetTxQue (unsigned char* app_pqTx, unsigned short app_cbqTx){ // arg_0 = dword ptr 4 // arg_4 = word ptr 8 //eax = app_pqTx; //cx = app_cbqTx; if (app_pqTx != NULL){ // Save old values. old_app_pqTx = app_pqTx; old_app_cbqTx = app_cbqTx; } if ((app_pqTx == NULL) || (io_state == 9)){ // Setup buffer pointers. io_dte_rx_sptr = &io_dte_rx_buff[0]; // buffer start. io_dte_rx_eptr = &io_dte_rx_buff[0x1001]; // buffer end. io_app_tx_sptr = &io_dte_rx_buff[0]; // buffer start. io_app_tx_eptr = &io_dte_rx_buff[0x1001]; // buffer end. } else{ io_app_tx_sptr = app_pqTx; io_app_tx_eptr = app_pqTx + app_cbqTx; } io_app_tx_data_update = 0; UART_Flush(0); io_esc_dte_wptr = io_dte_rx_wptr;}void UART_Flush(unsigned int arg1){ if (arg1 == 0) { if (io_app_tx_sptr == io_dte_rx_sptr) { io_dte_rx_wptr = io_dte_rx_sptr; io_dte_rx_rptr = io_dte_rx_sptr; } io_app_tx_wptr = io_app_tx_sptr; io_app_tx_rptr = io_app_tx_sptr; } if (arg1 == 1) { io_dte_tx_wptr = io_dte_tx_sptr; io_dte_tx_rptr = io_dte_tx_sptr; } io_app_tx_data_update = 0;}//--------------------------------------------------------------// More interesting stuff.bool io_get_dte_rx_char(unsigned char* the_rx_char){ unsigned char al; // Check if read and write pointers are the same. if (io_dte_rx_rptr == io_dte_rx_wptr) return false; // Copy char from read position to supplied pointer. al = *io_dte_rx_rptr; *the_rx_char = al; // Wind read position on one. io_dte_rx_rptr++; // Check whether the end of the buffer has been reached. if (io_dte_rx_rptr >= io_dte_rx_eptr){ // Reached end of buffer so reset pointer. io_dte_rx_rptr = io_dte_rx_sptr; } return true;}bool io_at_esc_seq_detected(void){ printf("io_at_esc_seq_detected: Warning not yet implemented!\n"); return false;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -