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