]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
842bbe005b36e9f22dac8d81c6dc9c96a18ae473
2 Serial I/O Port library functions with no library constructor/destructor
5 Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Include/Uefi.h>
19 #include <Library/IoLib.h>
20 #include <Library/PcdLib.h>
21 #include <Library/SerialPortLib.h>
23 #include <Drivers/PL011Uart.h>
25 #include <ArmPlatform.h>
29 Programmed hardware of Serial port.
31 @return Always return EFI_UNSUPPORTED.
36 SerialPortInitialize (
40 // No parity, 1 stop, no fifo, 8 data bits
41 return PL011UartInitialize (
42 (UINTN
)PcdGet64 (PcdSerialRegisterBase
),
43 (UINTN
)PcdGet64 (PcdUartDefaultBaudRate
),
44 PL011_UARTLCR_H_WLEN_8
);
48 Write data to serial device.
50 @param Buffer Point of data buffer which need to be writed.
51 @param NumberOfBytes Number of output bytes which are cached in Buffer.
53 @retval 0 Write data failed.
54 @retval !0 Actual number of bytes writed to serial device.
61 IN UINTN NumberOfBytes
64 return PL011UartWrite ((UINTN
)PcdGet64 (PcdSerialRegisterBase
), Buffer
, NumberOfBytes
);
68 Read data from serial device and save the datas in buffer.
70 @param Buffer Point of data buffer which need to be writed.
71 @param NumberOfBytes Number of output bytes which are cached in Buffer.
73 @retval 0 Read data failed.
74 @retval !0 Aactual number of bytes read from serial device.
81 IN UINTN NumberOfBytes
84 return PL011UartRead ((UINTN
)PcdGet64 (PcdSerialRegisterBase
), Buffer
, NumberOfBytes
);
88 Check to see if any data is avaiable to be read from the debug device.
90 @retval EFI_SUCCESS At least one byte of data is avaiable to be read
91 @retval EFI_NOT_READY No data is avaiable to be read
92 @retval EFI_DEVICE_ERROR The serial device is not functioning properly
101 return PL011UartPoll ((UINTN
)PcdGet64 (PcdSerialRegisterBase
));