diff options
author | Tinku Mannan | 2018-01-25 13:02:13 -0600 |
---|---|---|
committer | Tinku Mannan | 2018-01-25 13:20:39 -0600 |
commit | ef2cfe16cee86a9e0e9e15fa2b3081679283c9a4 (patch) | |
tree | 9734bb2c495a715bcfdba21542f3ddb8ebe9c916 | |
parent | 6000122dbc0bc9c62623290c0e8632881791e1b7 (diff) | |
download | pruss-lld-ef2cfe16cee86a9e0e9e15fa2b3081679283c9a4.tar.gz pruss-lld-ef2cfe16cee86a9e0e9e15fa2b3081679283c9a4.tar.xz pruss-lld-ef2cfe16cee86a9e0e9e15fa2b3081679283c9a4.zip |
Adding API to select IEP clock source, unit tests updates to verify API
-rw-r--r-- | pruicss.h | 14 | ||||
-rw-r--r-- | src/pruicss_drv.c | 38 | ||||
-rw-r--r-- | test/src/main.c | 20 |
3 files changed, 71 insertions, 1 deletions
@@ -598,6 +598,20 @@ int32_t PRUICSS_setConstantTblEntry(PRUICSS_Handle handle, uint8_t pruNum, int32 | |||
598 | */ | 598 | */ |
599 | int32_t PRUICSS_setGpMuxSel(PRUICSS_Handle handle, uint8_t pruNum, uint32_t mode); | 599 | int32_t PRUICSS_setGpMuxSel(PRUICSS_Handle handle, uint8_t pruNum, uint32_t mode); |
600 | 600 | ||
601 | /** | ||
602 | * \brief This API configures the source of the IEP clock to be either | ||
603 | * IEP CLK as the source or Interface Bus CLK as the source (such as OCP/ICLK/VCLK) | ||
604 | * This is accomplished by updating the IEP clock field of the General Purpose Config | ||
605 | * Register (PRUSS_GPCFG) | ||
606 | * | ||
607 | * @param handle Pruss's driver handle | ||
608 | * @param source source of the IEP clock (0 == IEP CLK, 1 == OCP/ICLK/VCLK) | ||
609 | * | ||
610 | * \return 0 success, -1 on error | ||
611 | * | ||
612 | */ | ||
613 | int32_t PRUICSS_setIepClkSrc(PRUICSS_Handle handle, uint32_t source); | ||
614 | |||
601 | #ifdef __cplusplus | 615 | #ifdef __cplusplus |
602 | } | 616 | } |
603 | #endif | 617 | #endif |
diff --git a/src/pruicss_drv.c b/src/pruicss_drv.c index 23d7373..39cd11a 100644 --- a/src/pruicss_drv.c +++ b/src/pruicss_drv.c | |||
@@ -1034,4 +1034,42 @@ int32_t PRUICSS_setGpMuxSel(PRUICSS_Handle handle, uint8_t pruNum, uint32_t mode | |||
1034 | 1034 | ||
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | /** | ||
1038 | * \brief This API configures the source of the IEP clock to be either | ||
1039 | * IEP CLK as the source or Interface Bus CLK as the source (such as OCP/ICLK/VCLK) | ||
1040 | * This is accomplished by updating the IEP clock field of the General Purpose Config | ||
1041 | * Register (PRUSS_GPCFG) | ||
1042 | * | ||
1043 | * @param handle Pruss's driver handle | ||
1044 | * @param source source of the IEP clock (0 == IEP CLK, 1 == OCP/ICLK/VCLK) | ||
1045 | * | ||
1046 | * \return 0 success, -1 on error | ||
1047 | * | ||
1048 | */ | ||
1049 | |||
1050 | int32_t PRUICSS_setIepClkSrc(PRUICSS_Handle handle, uint32_t source) | ||
1051 | { | ||
1052 | PRUICSS_HwAttrs const *hwAttrs; | ||
1053 | int32_t ret_val = PRUICSS_RETURN_SUCCESS; | ||
1054 | |||
1055 | if(handle == NULL) | ||
1056 | { | ||
1057 | ret_val = PRUICSS_RETURN_FAILURE; | ||
1058 | } | ||
1059 | else | ||
1060 | { | ||
1061 | /* validate the clk source */ | ||
1062 | if ((source == 1U) || (source == 0U)) | ||
1063 | { | ||
1064 | hwAttrs = (PRUICSS_HwAttrs*)handle->hwAttrs; | ||
1065 | HW_WR_FIELD32((hwAttrs->prussCfgRegBase+CSL_ICSSCFG_IEPCLK), CSL_ICSSCFG_IEPCLK_OCP_EN, source); | ||
1066 | } | ||
1067 | else | ||
1068 | { | ||
1069 | ret_val = PRUICSS_RETURN_FAILURE; | ||
1070 | } | ||
1071 | } | ||
1072 | return ret_val; | ||
1073 | } | ||
1074 | |||
1037 | /*****************************END OF FILE************************************/ | 1075 | /*****************************END OF FILE************************************/ |
diff --git a/test/src/main.c b/test/src/main.c index aa3f2c2..eb24112 100644 --- a/test/src/main.c +++ b/test/src/main.c | |||
@@ -65,6 +65,7 @@ | |||
65 | 65 | ||
66 | #include <ti/csl/soc.h> | 66 | #include <ti/csl/soc.h> |
67 | #include <ti/csl/src/ip/icss/V1/cslr_icss_pru_ctrl.h> | 67 | #include <ti/csl/src/ip/icss/V1/cslr_icss_pru_ctrl.h> |
68 | #include <ti/csl/src/ip/icss/V1/cslr_icss_cfg.h> | ||
68 | 69 | ||
69 | #include <ti/csl/hw_types.h> | 70 | #include <ti/csl/hw_types.h> |
70 | 71 | ||
@@ -371,7 +372,8 @@ Void taskFxn2(UArg a0, UArg a1) | |||
371 | PRUICSS_IntcInitData pruss_intc_initdata = PRUICSS_INTC_INITDATA; | 372 | PRUICSS_IntcInitData pruss_intc_initdata = PRUICSS_INTC_INITDATA; |
372 | PRUICSS_Config *cfg; | 373 | PRUICSS_Config *cfg; |
373 | PRUICSS_IntrCfg intrCfg; | 374 | PRUICSS_IntrCfg intrCfg; |
374 | 375 | PRUICSS_HwAttrs const *hwAttrs; | |
376 | uint32_t clkSource; | ||
375 | while(taskFxnDone == 0) | 377 | while(taskFxnDone == 0) |
376 | SLEEP(1000); | 378 | SLEEP(1000); |
377 | 379 | ||
@@ -390,6 +392,22 @@ Void taskFxn2(UArg a0, UArg a1) | |||
390 | 392 | ||
391 | handle2 = PRUICSS_create(cfg,pru_num); | 393 | handle2 = PRUICSS_create(cfg,pru_num); |
392 | 394 | ||
395 | /* Test instance 2 using OCP as IEP clock source */ | ||
396 | PRINT("testing instance 2 using OCP as IEP clock source\n"); | ||
397 | hwAttrs = (PRUICSS_HwAttrs*)handle2->hwAttrs; | ||
398 | PRUICSS_setIepClkSrc(handle2,1U); | ||
399 | clkSource = HW_RD_REG32(hwAttrs->prussCfgRegBase+ CSL_ICSSCFG_IEPCLK); | ||
400 | |||
401 | if (clkSource == 1U) | ||
402 | { | ||
403 | PRINT("correct IEP clock source setting\n"); | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | |||
408 | PRINT("incorrect IEP clock source setting,. test failed\n"); | ||
409 | while(1); | ||
410 | } | ||
393 | intrCfg.pruEvtoutNum = 2; | 411 | intrCfg.pruEvtoutNum = 2; |
394 | intrCfg.waitEnable = 1; | 412 | intrCfg.waitEnable = 1; |
395 | intrCfg.irqHandler = pruss_isr2; | 413 | intrCfg.irqHandler = pruss_isr2; |