Use the debug serial port of Wince as a Common Serial Port

Source: Internet
Author: User
Currently, the serial port 0 of Wince is used for debugging the serial port. However, because my case requires three serial ports, I need to change it to a common serial port, but I still need to print the debug information when I start the system, in view of this, I modified the following: Debug. add a line in C: int debugconsoleenabled = 1; make a judgment when sending:

// Outputs //// function: oemwritedebugbyte // transmits a character out of the debug serial port. // void oemwritedebugbyte (uint8 ch) {If (debugconsoleenabled = 0) return; // wait for transmit buffer to be empty while (inreg32 (& g_puarregulatory-> utrstat) & 0x02) = 0); // send character outreg32 (& g_puarreg-> utxh, CH );}//----------------- ----------------------------------------------------------- // Function: oemreaddebugbyte // reads a byte from the debug serial port. does not wait for a character. // If a character is not available function returns "oem_debug_read_nodata ". // int oemreaddebugbyte () {uint32 status, ch; If (debugconsoleenabled = 0) return 0; status = inreg32 (& g_puarreg-> utrstat ); if (Status & 0x01 )! = 0) {CH = inreg32 (& g_puarreg-> urxh); // If (Status & uart_linestat_rf )! = 0) CH = oem_debug_com_error;} else {CH = oem_debug_read_nodata;} return (INT) ch;} Then debugconsoleenabled = 0 after the oeminit function is complete. I don't know why. I can use the serial port test program to test the wince generated by my 4.2 BSP, but my 5.0 wince cannot be opened by the serial port test program, instead, you can only write a simple C # Serial Port test. Serial Port 0 is OK. The next step is Serial Port 1 and Serial Port 2. PS: C # Is really convenient. A person who has never touched C # can directly write a program that does not seem simple on the interface. It seems like Delphi's ease of use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.