TianoCore EDK2 master
Loading...
Searching...
No Matches
PL011SerialPortLib.c
Go to the documentation of this file.
1
12#include <Base.h>
13
14#include <Library/IoLib.h>
15#include <Library/PcdLib.h>
19
26RETURN_STATUS
27EFIAPI
29 VOID
30 )
31{
32 UINT64 BaudRate;
33 UINT32 ReceiveFifoDepth;
34 EFI_PARITY_TYPE Parity;
35 UINT8 DataBits;
36 EFI_STOP_BITS_TYPE StopBits;
37
38 BaudRate = FixedPcdGet64 (PcdUartDefaultBaudRate);
39 ReceiveFifoDepth = 0; // Use default FIFO depth
40 Parity = (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity);
41 DataBits = FixedPcdGet8 (PcdUartDefaultDataBits);
42 StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits);
43
45 (UINTN)PcdGet64 (PcdSerialRegisterBase),
47 &BaudRate,
48 &ReceiveFifoDepth,
49 &Parity,
50 &DataBits,
51 &StopBits
52 );
53}
54
66EFIAPI
68 IN UINT8 *Buffer,
69 IN UINTN NumberOfBytes
70 )
71{
72 return PL011UartWrite ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
73}
74
86EFIAPI
88 OUT UINT8 *Buffer,
89 IN UINTN NumberOfBytes
90 )
91{
92 return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
93}
94
102BOOLEAN
103EFIAPI
105 VOID
106 )
107{
108 return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
109}
110
142RETURN_STATUS
143EFIAPI
145 IN OUT UINT64 *BaudRate,
146 IN OUT UINT32 *ReceiveFifoDepth,
147 IN OUT UINT32 *Timeout,
148 IN OUT EFI_PARITY_TYPE *Parity,
149 IN OUT UINT8 *DataBits,
150 IN OUT EFI_STOP_BITS_TYPE *StopBits
151 )
152{
154 (UINTN)PcdGet64 (PcdSerialRegisterBase),
156 BaudRate,
157 ReceiveFifoDepth,
158 Parity,
159 DataBits,
160 StopBits
161 );
162}
163
190RETURN_STATUS
191EFIAPI
193 IN UINT32 Control
194 )
195{
196 return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
197}
198
231RETURN_STATUS
232EFIAPI
234 OUT UINT32 *Control
235 )
236{
237 return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
238}
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
BOOLEAN EFIAPI SerialPortPoll(VOID)
RETURN_STATUS EFIAPI SerialPortSetAttributes(IN OUT UINT64 *BaudRate, IN OUT UINT32 *ReceiveFifoDepth, IN OUT UINT32 *Timeout, IN OUT EFI_PARITY_TYPE *Parity, IN OUT UINT8 *DataBits, IN OUT EFI_STOP_BITS_TYPE *StopBits)
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
RETURN_STATUS EFIAPI SerialPortInitialize(VOID)
RETURN_STATUS EFIAPI SerialPortSetControl(IN UINT32 Control)
RETURN_STATUS EFIAPI SerialPortGetControl(OUT UINT32 *Control)
UINTN EFIAPI SerialPortWrite(IN UINT8 *Buffer, IN UINTN NumberOfBytes)
UINT32 EFIAPI PL011UartClockGetFreq(VOID)
RETURN_STATUS EFIAPI PL011UartInitializePort(IN UINTN UartBase, IN UINT32 UartClkInHz, IN OUT UINT64 *BaudRate, IN OUT UINT32 *ReceiveFifoDepth, IN OUT EFI_PARITY_TYPE *Parity, IN OUT UINT8 *DataBits, IN OUT EFI_STOP_BITS_TYPE *StopBits)
Definition: PL011UartLib.c:66
RETURN_STATUS EFIAPI PL011UartSetControl(IN UINTN UartBase, IN UINT32 Control)
Definition: PL011UartLib.c:270
UINTN EFIAPI PL011UartWrite(IN UINTN UartBase, IN UINT8 *Buffer, IN UINTN NumberOfBytes)
Definition: PL011UartLib.c:417
UINTN EFIAPI PL011UartRead(IN UINTN UartBase, OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
Definition: PL011UartLib.c:448
BOOLEAN EFIAPI PL011UartPoll(IN UINTN UartBase)
Definition: PL011UartLib.c:475
RETURN_STATUS EFIAPI PL011UartGetControl(IN UINTN UartBase, OUT UINT32 *Control)
Definition: PL011UartLib.c:347
#define PcdGet64(TokenName)
Definition: PcdLib.h:375
#define FixedPcdGet64(TokenName)
Definition: PcdLib.h:106
#define FixedPcdGet8(TokenName)
Definition: PcdLib.h:64
EFI_STOP_BITS_TYPE
Definition: SerialIo.h:53
EFI_PARITY_TYPE
Definition: SerialIo.h:41