From fed6612c6791e67f35874a0e682f6b488948fab4 Mon Sep 17 00:00:00 2001 From: P L Sai Krishna Date: Mon, 17 Aug 2015 19:22:58 +0530 Subject: [PATCH] iicps: Added polled, interuupt tests in peripheral test. This patch modifies the testapp tcl file to add polled and interrupt tests in peripheral tests. Signed-off-by: P L Sai Krishna Reviewed-by: Punnaiah Choudary Kalluri --- .../drivers/iicps/data/iicps_header.h | 3 + .../drivers/iicps/data/iicps_tapp.tcl | 75 ++++++++++++++++++- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/iicps/data/iicps_header.h b/XilinxProcessorIPLib/drivers/iicps/data/iicps_header.h index 7d4b51e6..175f8387 100644 --- a/XilinxProcessorIPLib/drivers/iicps/data/iicps_header.h +++ b/XilinxProcessorIPLib/drivers/iicps/data/iicps_header.h @@ -37,5 +37,8 @@ #include "xstatus.h" int IicPsSelfTestExample(u16 DeviceId); +int IicPsEepromPolledExample(XIicPs *IicInstance, u16 DeviceId); +int IicPsEepromIntrExample(XScuGic *InterruptController, XIicPs *IicInstance, + u16 DeviceId, u16 IntrId); #endif diff --git a/XilinxProcessorIPLib/drivers/iicps/data/iicps_tapp.tcl b/XilinxProcessorIPLib/drivers/iicps/data/iicps_tapp.tcl index aa4fd712..9608de40 100755 --- a/XilinxProcessorIPLib/drivers/iicps/data/iicps_tapp.tcl +++ b/XilinxProcessorIPLib/drivers/iicps/data/iicps_tapp.tcl @@ -63,7 +63,7 @@ proc gen_src_files {swproj mhsinst} { } if {$swproj == 1} { - set inc_file_lines {examples/xiicps_selftest_example.c data/iicps_header.h} + set inc_file_lines {examples/xiicps_selftest_example.c examples/xiicps_eeprom_polled_example.c examples/xiicps_eeprom_intr_example.c data/iicps_header.h} return $inc_file_lines } @@ -79,7 +79,10 @@ proc gen_init_code {swproj mhsinst} { return "" } if {$swproj == 1} { - return "" + set ipname [common::get_property NAME $mhsinst] + set decl " static XIicPs ${ipname};" + set inc_file_lines $decl + return $inc_file_lines } } @@ -99,6 +102,9 @@ proc gen_testfunc_call {swproj mhsinst} { set hasStdout 1 } + set isintr [::hsm::utils::is_ip_interrupting_current_proc $mhsinst] + set intcvar intc + set testfunc_call "" if {${hasStdout} == 0} { @@ -112,6 +118,29 @@ proc gen_testfunc_call {swproj mhsinst} { }" + append testfunc_call " + + { + int Status; + + Status = IicPsEepromPolledExample(&${ipname}, ${deviceid}); + + }" + + if {$isintr == 1} { + set intr_id "XPAR_${ipname}_INTR" + set intr_id [string toupper $intr_id] + + append testfunc_call " + + { + int Status; + Status = IicPsEepromIntrExample(&${intcvar}, &${ipname}, \\ + ${deviceid}, \\ + ${intr_id}); + }" + + } } else { @@ -132,7 +161,47 @@ proc gen_testfunc_call {swproj mhsinst} { } }" - } + append testfunc_call " + + { + int Status; + + print(\"\\r\\n Running IicPsPolledExample() for ${ipname}...\\r\\n\"); + + Status = IicPsEepromPolledExample(&${ipname}, ${deviceid}); + + if (Status == 0) { + print(\"IicPsEepromPolledExample PASSED\\r\\n\"); + } + else { + print(\"IicPsEepromPolledExample FAILED\\r\\n\"); + } + }" + + if {$isintr ==1 } { + set intr_id "XPAR_${ipname}_INTR" + set intr_id [string toupper $intr_id] + + append testfunc_call " + { + int Status; + + print(\"\\r\\n Running Interrupt Test for ${ipname}...\\r\\n\"); + + Status = IicPsEepromIntrExample(&${intcvar}, &${ipname}, \\ + ${deviceid}, \\ + ${intr_id}); + + if (Status == 0) { + print(\"IicPsIntrExample PASSED\\r\\n\"); + } + else { + print(\"IicPsIntrExample FAILED\\r\\n\"); + } + + }" + } + } return $testfunc_call }