Zephyr UARTPS Driver Support

This page gives an overview of the UARTPS Zephyr driver which is available as part of the zephyr-amd repo.

HW Features

Design Notes

  • N/A

Implementation

  • N/A

Features Supported

  • Polled Mode - UART Send/Receive

  • Interrupt Mode - UART Send/Receive

  • APIs supported and verified

    • uart_poll_in - Read a character from the device for input

    • uart_poll_out - Write a character to the device for output

    • uart_configure - Set UART configuration

    • uart_config_get - Get UART configuration

    • uart_fifo_fill - Fill FIFO with data

    • uart_fifo_read - Read data from FIFO

Missing Features

  • TBA

Known Issues

  • N/A

Limitations

  • N/A

Kernel Configuration

CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_USE_RUNTIME_CONFIGURE=y

Device Tree

The uartps device tree node:

uart0: serial@ff000000 {
        compatible = "xlnx,xuartps";
        interrupt-parent = <&gic>;
        interrupts = <GIC_SPI 0x15 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
        reg = <0xff000000 0x1000>;
        clock-frequency = <0x5f5b9f5>;
        current-speed = <0x1c200>;
        status = "okay";
};
  • Lopper support to generate uartps node is to be verified

Driver Stack Size

  • uart_xlnx_ps.c (interrupt) - 1.3 KB

  • uart_xlnx_ps.c (polled) - 0.9 KB

Test Platform

  • zcu102 board

Test SoC Architecture

  • RPU - R5 core - Verified

  • APU - A53 core - Not tested

  • SMP - Switch - Not tested

Testing Sequence

  • Build zephyr application for R5 core

    • west build -p -b <board> <sample application path>

  • Run zephyr elf on board

Example Tests

Test Name

Example Source

Description

hello world

samples/hello_world/

Prints “Hello World” on uart console

uart_basic_api

tests/drivers/uart/uart_basic_api/

Performs Ztest which verifies basic uart driver APIs.

Expected Output

  • west build -p -b zcu102_r5 tests/drivers/uart/uart_basic_api/ -G’Unix Makefiles’

The full test log is included below; it can also be downloaded from this page.

zcu102 R5 uartps test log
Zynq MP First Stage Boot Loader
Release 2024.1   Dec 24 2024  -  10:40:58
PMU-FW is not running, certain applications may not be supported.
*** Booting Zephyr OS build 36940db938a8 ***
Hello World! zcu102_r5/zcu102_r5_rpu
*** Booting Zephyr OS build 36940db938a8 ***
Running TESTSUITE uart_basic_api
===================================================================
START - test_uart_config_get
 PASS - test_uart_config_get in 0.003 seconds
===================================================================
 PASS - test_uart_configure in 0.001 seconds
===================================================================
START - test_uart_fifo_fill
This is a FIFO test.
 PASS - test_uart_fifo_fill in 0.502 seconds
===================================================================
START - test_uart_fifo_read
Please send characters to serial console
this is uartps testing
 PASS - test_uart_fifo_read in 6.925 seconds
===================================================================
START - test_uart_poll_in
Please send characters to serial console
uartps
 PASS - test_uart_poll_in in 4.955 seconds
===================================================================
START - test_uart_poll_out
This is a POLL test.
 PASS - test_uart_poll_out in 0.002 seconds
===================================================================
TESTSUITE uart_basic_api succeeded
Running TESTSUITE uart_basic_api_pending
===================================================================
START - test_uart_pending
Please send characters to serial console

 PASS - test_uart_pending in 1.190 seconds
===================================================================
TESTSUITE uart_basic_api_pending succeeded

------ TESTSUITE SUMMARY START ------

SUITE PASS - 100.00% [uart_basic_api]: pass = 6, fail = 0, skip = 0, total = 6 duration = 12.388 seconds
 - PASS - [uart_basic_api.test_uart_config_get] duration = 0.003 seconds
 - PASS - [uart_basic_api.test_uart_configure] duration = 0.001 seconds
 - PASS - [uart_basic_api.test_uart_fifo_fill] duration = 0.502 seconds
 - PASS - [uart_basic_api.test_uart_fifo_read] duration = 6.925 seconds
 - PASS - [uart_basic_api.test_uart_poll_in] duration = 4.955 seconds
 - PASS - [uart_basic_api.test_uart_poll_out] duration = 0.002 seconds

SUITE PASS - 100.00% [uart_basic_api_pending]: pass = 1, fail = 0, skip = 0, total = 1 duration = 1.190 seconds
 - PASS - [uart_basic_api_pending.test_uart_pending] duration = 1.190 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION SUCCESSFUL

Download zephyr_zcu102_uartps_testlog.log

Code Coverage

  • With uart ztest, Code Coverage was 74.9%.

Performance Metric

  • N/A

Mainline Status

  • The preceding features are mainlined as of 01-Oct-2024

Driver Source Path

  • drivers/serial/uart_xlnx_ps.c

Misra C Report

File

Required

Advisory

uart_xlnx_ps.c

96

54

  • Detailed Breakup

misra-c rule
(zephyr guideline)

Severity

Actual File
Violations
Kernel Utility
Violations

Dir 4.6

Advisory

15

0

Dir 4.8

Advisory

0

8

Dir 4.9

Advisory

0

19

Rule 1.2

Advisory

0

6

Rule 2.7

Advisory

1

1

Rule 10.1

Required

6

0

Rule 10.3

Required

9

0

Rule 10.4

Required

24

0

Rule 10.8

Required

1

0

Rule 11.8

Required

1

18

Rule 11.9

Required

1

0

Rule 12.1

Advisory

3

0

Rule 13.3

Advisory

1

0

Rule 14.4

Required

2

0

Rule 16.1

Required

5

0

Rule 16.3

Required

13

0

Rule 16.4

Required

3

0

Rule 16.5

Required

5

0

Rule 16.6

Required

3

0

Rule 20.9

Required

1

0

Rule 21.2

Required

0

4

Total violations

94

56