| 1 | /** @file\r |
| 2 | Basic serial IO abstaction for GDB\r |
| 3 | \r |
| 4 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
| 5 | \r |
| 6 | This program and the accompanying materials\r |
| 7 | are licensed and made available under the terms and conditions of the BSD License\r |
| 8 | which accompanies this distribution. The full text of the license may be found at\r |
| 9 | http://opensource.org/licenses/bsd-license.php\r |
| 10 | \r |
| 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
| 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
| 13 | \r |
| 14 | **/\r |
| 15 | \r |
| 16 | #ifndef __GDB_SERIAL_LIB_H__\r |
| 17 | #define __GDB_SERIAL_LIB_H__\r |
| 18 | \r |
| 19 | \r |
| 20 | \r |
| 21 | /**\r |
| 22 | Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,\r |
| 23 | data buts, and stop bits on a serial device. This call is optional as the serial\r |
| 24 | port will be set up with defaults base on PCD values.\r |
| 25 | \r |
| 26 | @param BaudRate The requested baud rate. A BaudRate value of 0 will use the the\r |
| 27 | device's default interface speed.\r |
| 28 | @param Parity The type of parity to use on this serial device. A Parity value of\r |
| 29 | DefaultParity will use the device's default parity value.\r |
| 30 | @param DataBits The number of data bits to use on the serial device. A DataBits\r |
| 31 | vaule of 0 will use the device's default data bit setting.\r |
| 32 | @param StopBits The number of stop bits to use on this serial device. A StopBits\r |
| 33 | value of DefaultStopBits will use the device's default number of\r |
| 34 | stop bits.\r |
| 35 | \r |
| 36 | @retval EFI_SUCCESS The device was configured.\r |
| 37 | @retval EFI_DEVICE_ERROR The serial device could not be coonfigured.\r |
| 38 | \r |
| 39 | **/\r |
| 40 | RETURN_STATUS\r |
| 41 | EFIAPI\r |
| 42 | GdbSerialInit (\r |
| 43 | IN UINT64 BaudRate,\r |
| 44 | IN UINT8 Parity,\r |
| 45 | IN UINT8 DataBits,\r |
| 46 | IN UINT8 StopBits\r |
| 47 | );\r |
| 48 | \r |
| 49 | \r |
| 50 | /**\r |
| 51 | Check to see if a character is available from GDB. Do not read the character as that is\r |
| 52 | done via GdbGetChar().\r |
| 53 | \r |
| 54 | @return TRUE - Character available\r |
| 55 | @return FALSE - Character not available\r |
| 56 | \r |
| 57 | **/\r |
| 58 | BOOLEAN\r |
| 59 | EFIAPI\r |
| 60 | GdbIsCharAvailable (\r |
| 61 | VOID\r |
| 62 | );\r |
| 63 | \r |
| 64 | /**\r |
| 65 | Get a character from GDB. This function must be able to run in interrupt context.\r |
| 66 | \r |
| 67 | @return A character from GDB\r |
| 68 | \r |
| 69 | **/\r |
| 70 | CHAR8\r |
| 71 | EFIAPI\r |
| 72 | GdbGetChar (\r |
| 73 | VOID\r |
| 74 | );\r |
| 75 | \r |
| 76 | \r |
| 77 | /**\r |
| 78 | Send a character to GDB. This function must be able to run in interrupt context.\r |
| 79 | \r |
| 80 | \r |
| 81 | @param Char Send a character to GDB\r |
| 82 | \r |
| 83 | **/\r |
| 84 | \r |
| 85 | VOID\r |
| 86 | EFIAPI\r |
| 87 | GdbPutChar (\r |
| 88 | IN CHAR8 Char\r |
| 89 | );\r |
| 90 | \r |
| 91 | \r |
| 92 | /**\r |
| 93 | Send an ASCII string to GDB. This function must be able to run in interrupt context.\r |
| 94 | \r |
| 95 | \r |
| 96 | @param String Send a string to GDB\r |
| 97 | \r |
| 98 | **/\r |
| 99 | \r |
| 100 | VOID\r |
| 101 | GdbPutString (\r |
| 102 | IN CHAR8 *String\r |
| 103 | );\r |
| 104 | \r |
| 105 | \r |
| 106 | #endif\r |
| 107 | \r |