Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
toki
components
freertos-portable
Commits
7f99d9de
Commit
7f99d9de
authored
Feb 15, 2018
by
Mahmoud Rushdi
Committed by
Oliver Horst
Aug 15, 2020
Browse files
[fix] Apply review comments.
parent
9af215bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
drivers/uart.c
View file @
7f99d9de
...
...
@@ -59,12 +59,11 @@ int hal_uart_init_channel(hal_io_handle_t handle, uint32_t baudrate)
uartInstance_t
*
uartInstPtr
;
XUartPs
*
xilUartPtr
;
XUartPs_Config
*
cfgPtr
;
int
status
,
i
;
u
int
32_t
status
;
if
(
handle
>=
MAX_NUM_UART_CONTROLLERS
)
if
(
MAX_NUM_UART_CONTROLLERS
<=
handle
)
{
// Unsupported handle
// xil_printf( "UART: hal_uart_init_channel: handle should be less than %d. \n", MAX_NUM_UART_CONTROLLERS);
/* Unsupported handle */
return
pdFAIL
;
}
else
...
...
@@ -75,7 +74,6 @@ int hal_uart_init_channel(hal_io_handle_t handle, uint32_t baudrate)
cfgPtr
=
XUartPs_LookupConfig
(
handle
);
if
(
!
cfgPtr
)
{
// xil_printf( "UART: hal_uart_init_channel: handle can't be resolved. \n");
return
pdFAIL
;
}
else
...
...
@@ -90,30 +88,23 @@ int hal_uart_init_channel(hal_io_handle_t handle, uint32_t baudrate)
);
if
(
XST_SUCCESS
!=
status
)
{
// xil_printf( "UART: hal_uart_init_channel: Xilinx driver initialization failed. \n");
return
pdFAIL
;
}
else
{
/*
* Run self-test on the UART controller.
*/
/* Run self-test on the UART controller. */
status
=
XUartPs_SelfTest
(
xilUartPtr
);
if
(
XST_SUCCESS
!=
status
)
{
// xil_printf( "UART: hal_uart_init_channel: Xilinx driver self-test failed. \n");
return
pdFAIL
;
}
else
{
/*
* Set the baudrate.
*/
/* Set the baudrate. */
status
=
XUartPs_SetBaudRate
(
xilUartPtr
,
baudrate
);
if
(
XST_SUCCESS
!=
status
)
{
// xil_printf( "UART: hal_uart_init_channel: Xilinx driver Set Baudrate failed. \n");
return
pdFAIL
;
}
...
...
@@ -121,10 +112,7 @@ int hal_uart_init_channel(hal_io_handle_t handle, uint32_t baudrate)
* of bus-off state. */
uartInstPtr
->
baudrate
=
baudrate
;
/*
* Enter Normal Mode.
*/
/* Enter Normal Mode. */
XUartPs_SetOperMode
(
xilUartPtr
,
XUARTPS_OPER_MODE_NORMAL
);
while
(
XUARTPS_OPER_MODE_NORMAL
!=
XUartPs_GetOperMode
(
xilUartPtr
)
);
...
...
@@ -133,15 +121,13 @@ int hal_uart_init_channel(hal_io_handle_t handle, uint32_t baudrate)
}
}
}
}
int
hal_uart_getchar
(
hal_io_handle_t
handle
,
uint8_t
*
ch
)
{
if
(
handle
>=
MAX_NUM_UART_CONTROLLERS
)
if
(
MAX_NUM_UART_CONTROLLERS
<=
handle
)
{
// Unsupported handle
// xil_printf( "UART: hal_uart_getchar: handle should be less than %d. \n", MAX_NUM_UART_CONTROLLERS);
/* Unsupported handle */
return
pdFAIL
;
}
else
...
...
@@ -157,14 +143,18 @@ int hal_uart_getchar(hal_io_handle_t handle, uint8_t *ch)
int
hal_uart_getchar_timeout
(
hal_io_handle_t
handle
,
uint8_t
*
ch
,
TickType_t
timeout
)
{
(
void
)
handle
;
(
void
)
*
ch
;
(
void
)
timeout
;
return
pdFAIL
;
}
int
hal_uart_putchar
(
hal_io_handle_t
handle
,
uint8_t
ch
)
{
if
(
handle
>=
MAX_NUM_UART_CONTROLLERS
)
if
(
MAX_NUM_UART_CONTROLLERS
<=
handle
)
{
// Unsupported handle
// xil_printf( "UART: hal_uart_putchar: handle should be less than %d. \n", MAX_NUM_UART_CONTROLLERS);
/* Unsupported handle */
return
pdFAIL
;
}
else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment