EmbeddedPkg: Clarify the declaration of SerialPortGetControl()
Rework the PL011UartGetControl() function removing a TODO by the way. Update of the header comment blocks of (PL011Uart|SerialPort)GetControl() functions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <ronald.cron@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16252 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
committed by
oliviermartin
parent
ab71619108
commit
d2e7e385fc
@ -236,20 +236,39 @@ PL011UartSetControl (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the serial device control bits.
|
|
||||||
|
|
||||||
@param UartBase The base address of the PL011 UART.
|
Retrieve the status of the control bits on a serial device.
|
||||||
@param Control Control signals read from the serial device.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
@param[in] UartBase UART registers base address
|
||||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
@param[out] Control Status of the control bits on a serial device :
|
||||||
|
|
||||||
|
. EFI_SERIAL_DATA_CLEAR_TO_SEND, EFI_SERIAL_DATA_SET_READY,
|
||||||
|
EFI_SERIAL_RING_INDICATE, EFI_SERIAL_CARRIER_DETECT,
|
||||||
|
EFI_SERIAL_REQUEST_TO_SEND, EFI_SERIAL_DATA_TERMINAL_READY
|
||||||
|
are all related to the DTE (Data Terminal Equipment) and
|
||||||
|
DCE (Data Communication Equipment) modes of operation of
|
||||||
|
the serial device.
|
||||||
|
. EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the receive
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the transmit
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if the
|
||||||
|
hardware loopback is enabled (the ouput feeds the receive
|
||||||
|
buffer), 0 otherwise.
|
||||||
|
. EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if a
|
||||||
|
loopback is accomplished by software, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to one if the
|
||||||
|
hardware flow control based on CTS (Clear To Send) and RTS
|
||||||
|
(Ready To Send) control signals is enabled, 0 otherwise.
|
||||||
|
|
||||||
|
@retval RETURN_SUCCESS The control bits were read from the serial device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PL011UartGetControl (
|
PL011UartGetControl (
|
||||||
IN UINTN UartBase,
|
IN UINTN UartBase,
|
||||||
OUT UINT32 *Control
|
OUT UINT32 *Control
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 FlagRegister;
|
UINT32 FlagRegister;
|
||||||
@ -293,22 +312,15 @@ PL011UartGetControl (
|
|||||||
*Control |= EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
*Control |= EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ControlRegister & (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN)) == (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN)) {
|
if ((ControlRegister & (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN))
|
||||||
|
== (PL011_UARTCR_CTSEN | PL011_UARTCR_RTSEN)) {
|
||||||
*Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
|
*Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NEVER
|
|
||||||
// ToDo: Implement EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE
|
|
||||||
if ((ControlRegister & PL011_UARTCR_LBE) == PL011_UARTCR_LBE) {
|
if ((ControlRegister & PL011_UARTCR_LBE) == PL011_UARTCR_LBE) {
|
||||||
*Control |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;
|
*Control |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: Implement EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE
|
|
||||||
if (SoftwareLoopbackEnable) {
|
|
||||||
*Control |= EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,20 +134,40 @@ PL011UartSetControl (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the serial device control bits.
|
|
||||||
|
|
||||||
@param UartBase The base address of the PL011 UART.
|
Retrieve the status of the control bits on a serial device.
|
||||||
@param Control Control signals read from the serial device.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
@param[in] UartBase UART registers base address
|
||||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
@param[out] Control Status of the control bits on a serial device :
|
||||||
|
|
||||||
|
. EFI_SERIAL_DATA_CLEAR_TO_SEND, EFI_SERIAL_DATA_SET_READY,
|
||||||
|
EFI_SERIAL_RING_INDICATE, EFI_SERIAL_CARRIER_DETECT,
|
||||||
|
EFI_SERIAL_REQUEST_TO_SEND, EFI_SERIAL_DATA_TERMINAL_READY
|
||||||
|
are all related to the DTE (Data Terminal Equipment) and
|
||||||
|
DCE (Data Communication Equipment) modes of operation of
|
||||||
|
the serial device.
|
||||||
|
. EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the receive
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the transmit
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if the
|
||||||
|
hardware loopback is enabled (the ouput feeds the receive
|
||||||
|
buffer), 0 otherwise.
|
||||||
|
. EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if a
|
||||||
|
loopback is accomplished by software, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to one if the
|
||||||
|
hardware flow control based on CTS (Clear To Send) and RTS
|
||||||
|
(Ready To Send) control signals is enabled, 0 otherwise.
|
||||||
|
|
||||||
|
|
||||||
|
@retval RETURN_SUCCESS The control bits were read from the serial device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PL011UartGetControl (
|
PL011UartGetControl (
|
||||||
IN UINTN UartBase,
|
IN UINTN UartBase,
|
||||||
OUT UINT32 *Control
|
OUT UINT32 *Control
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,20 +100,38 @@ SerialPortSetControl (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the serial device control bits.
|
|
||||||
|
|
||||||
@param Control Control signals read from the serial device.
|
Retrieve the status of the control bits on a serial device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
@param[out] Control Status of the control bits on a serial device :
|
||||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
|
||||||
|
. EFI_SERIAL_DATA_CLEAR_TO_SEND, EFI_SERIAL_DATA_SET_READY,
|
||||||
|
EFI_SERIAL_RING_INDICATE, EFI_SERIAL_CARRIER_DETECT,
|
||||||
|
EFI_SERIAL_REQUEST_TO_SEND, EFI_SERIAL_DATA_TERMINAL_READY
|
||||||
|
are all related to the DTE (Data Terminal Equipment) and
|
||||||
|
DCE (Data Communication Equipment) modes of operation of
|
||||||
|
the serial device.
|
||||||
|
. EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the receive
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the transmit
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if the
|
||||||
|
hardware loopback is enabled (the ouput feeds the receive
|
||||||
|
buffer), 0 otherwise.
|
||||||
|
. EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if a
|
||||||
|
loopback is accomplished by software, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to one if the
|
||||||
|
hardware flow control based on CTS (Clear To Send) and RTS
|
||||||
|
(Ready To Send) control signals is enabled, 0 otherwise.
|
||||||
|
|
||||||
|
@retval RETURN_SUCCESS The control bits were read from the serial device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SerialPortGetControl (
|
SerialPortGetControl (
|
||||||
OUT UINT32 *Control
|
OUT UINT32 *Control
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
|
return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,18 +61,38 @@ SerialPortSetControl (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the serial device control bits.
|
|
||||||
|
|
||||||
@param Control Control signals read from the serial device.
|
Retrieve the status of the control bits on a serial device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
@param[out] Control Status of the control bits on a serial device :
|
||||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
|
||||||
|
. EFI_SERIAL_DATA_CLEAR_TO_SEND, EFI_SERIAL_DATA_SET_READY,
|
||||||
|
EFI_SERIAL_RING_INDICATE, EFI_SERIAL_CARRIER_DETECT,
|
||||||
|
EFI_SERIAL_REQUEST_TO_SEND, EFI_SERIAL_DATA_TERMINAL_READY
|
||||||
|
are all related to the DTE (Data Terminal Equipment) and
|
||||||
|
DCE (Data Communication Equipment) modes of operation of
|
||||||
|
the serial device.
|
||||||
|
. EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the receive
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the transmit
|
||||||
|
buffer is empty, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if the
|
||||||
|
hardware loopback is enabled (the ouput feeds the receive
|
||||||
|
buffer), 0 otherwise.
|
||||||
|
. EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if a
|
||||||
|
loopback is accomplished by software, 0 otherwise.
|
||||||
|
. EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to one if the
|
||||||
|
hardware flow control based on CTS (Clear To Send) and RTS
|
||||||
|
(Ready To Send) control signals is enabled, 0 otherwise.
|
||||||
|
|
||||||
|
@retval RETURN_SUCCESS The control bits were read from the serial device.
|
||||||
|
@retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SerialPortGetControl (
|
SerialPortGetControl (
|
||||||
OUT UINT32 *Control
|
OUT UINT32 *Control
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ SerialPortSetControl (
|
|||||||
/**
|
/**
|
||||||
Get the serial device control bits.
|
Get the serial device control bits.
|
||||||
|
|
||||||
@param Control Control signals read from the serial device.
|
@param Control Control signals read from the serial device.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
@retval EFI_SUCCESS The control bits were read from the serial device.
|
||||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||||
@ -45,7 +45,7 @@ SerialPortSetControl (
|
|||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SerialPortGetControl (
|
SerialPortGetControl (
|
||||||
OUT UINT32 *Control
|
OUT UINT32 *Control
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (SerialPortPoll ()) {
|
if (SerialPortPoll ()) {
|
||||||
@ -54,7 +54,7 @@ SerialPortGetControl (
|
|||||||
} else {
|
} else {
|
||||||
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||||
}
|
}
|
||||||
return EFI_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user