Including a Driver Example in the Peripheral Test Application - 2024.1 English

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

Document ID
UG1647
Release Date
2024-06-21
Version
2024.1 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.
  • 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.