Including a Driver Example in the Peripheral Test Application - 2024.2 English - UG1647

Porting Guide for embeddedsw Components System Device Tree Based Build Flow (UG1647)

Document ID
UG1647
Release Date
2024-11-27
Version
2024.2 English

Changes to the Data Folder of the Driver

The following changes should be made to the data folder of the driver:

  • Add a tapp section in the <driver>.yaml as mentioned in the Data Folder in Drivers section. In the existing flow, <driver>_tapp.tcl used to facilitate this action. Following is a sample "tapp" section in a <driver>.yaml:
    tapp:
        x<driver>_selftest_example.c:
            declaration: X<Driver>_SelfTestExample
        x<driver>_generic_interrupt_example.c:
            declaration: X<Driver>_IntrExample
            hwproperties:
                - interrupts
  • All the function declarations mentioned in the above tapp section must be available in the <driver>_header.h file.
  • If the examples have dependency on other files those can be mentioned via dependency_files syntax. The example changes are shown in the following code snippet:
    tapp:
        xaxiethernet_example_intr_sgdma.c:
            dependency_files:
                - xaxiethernet_example_util.c
                - xaxiethernet_example.h
            axistream-connected: 2
            declaration: AxiEthernetSgDmaIntrExample
            hwproperties:
                 - interrupts
    
        xaxiethernet_example_intr_mcdma.c:
            dependency_files:
                - xaxiethernet_example_util.c
                - xaxiethernet_example.h
            axistream-connected: 3
            hwproperties:
                 - interrupts
  • For self tests, example function declaration contains only one argument, BaseAddress.
  • For other example functions, declaration contains two arguments, the instance name and BASEADDRESS.

Example changes are shown in the following code snippets:

--- a/XilinxProcessorIPLib/drivers/csudma/data/csudma.yaml
+++ b/XilinxProcessorIPLib/drivers/csudma/data/csudma.yaml
@@ -39,4 +39,13 @@ examples:
         - reg
     xcsudma_selftest_example.c:
         - reg
+
+tapp:
+   xcsudma_selftest_example.c:
+        declaration: XCsuDma_SelfTestExample
+   xcsudma_intr_example.c:
+        declaration: XCsuDma_IntrExample
+        hwproperties:
+            - interrupts
+...
--- a/XilinxProcessorIPLib/drivers/csudma/data/csudma_header.h
+++ b/XilinxProcessorIPLib/drivers/csudma/data/csudma_header.h
@@ -11,6 +11,10 @@
 #include "xil_assert.h"
 #include "xstatus.h"
 
+#ifdef SDT
+int XCsuDma_SelfTestExample(UINTPTR BaseAddress);
+int XCsuDma_IntrExample(XCsuDma *CsuDmaInstance, UINTPTR BaseAddress);
+#else
 int XCsuDma_SelfTestExample(u16 DeviceId);
 #ifdef XPAR_SCUGIC_0_DEVICE_ID
 int XCsuDma_IntrExample(XScuGic *IntcInstancePtr, XCsuDma *CsuDmaInstance,
@@ -22,3 +26,4 @@ int XCsuDma_IntrExample(XIntc *IntcInstancePtr, XCsuDma *CsuDmaInstance,
 #endif
 #endif
 #endif
+#endif

Changes to the Example Folder of the Driver

Refer to the Examples Folder in Drivers section.