diff --git a/docs_src/docs/api_guide/components/pruicss_pwm/pruicss_pwm.md b/docs_src/docs/api_guide/components/pruicss_pwm/pruicss_pwm.md
new file mode 100644
index 0000000..387df53
--- /dev/null
+++ b/docs_src/docs/api_guide/components/pruicss_pwm/pruicss_pwm.md
@@ -0,0 +1,42 @@
+# PRUICSS PWM {#PRUICSS_PWM}
+
+[TOC]
+
+The PRUICSS PWM driver provides API to program Intial, Trip, Active states of PWM outputs.
+Below are the high level features supported by the driver.
+
+## Features Supported
+
+- Configuration of IEP compare events to produce the PWM outputs
+- Enable Efficiency mode to auto clear compare status on state transition
+- Configuration of duty cycle to each of the PWM outputs
+- Configuration of PWM outputs behaviour in Intial state
+- Configuration of PWM outputs behaviour in Active state
+- Configuration of PWM outputs behaviour in Trip state
+- Configuration of PWM Glitch Filter with Debounce Value
+- Configuration of Tripzone output block to mask trip errors inputs
+
+## SysConfig Features
+
+@VAR_SYSCFG_USAGE_NOTE
+
+SysConfig can be used to configure things mentioned below:
+
+- Syscfg based customization will be supported in future releases.
+
+## Features NOT Supported
+
+Generate PWM outputs with distinct time period, which means all the PWM outputs will be in sync with respected to each other, without re-programming.
+
+## Important Note
+
+PRUICSS has one pwm module, which has four pwm sets (PWM0, PWM1, PWM2, PWM3)
+Each Set has six signals (A0,A1,A2,B0,B1,B2) With Reference to Technical Reference Manual, Pwm six signals(A0,A1,A2,B0,B1,B2) Naming convention is is slightly different as mentioned in \ref PRUICSS_PWM_API
+
+## Example Usage
+
+\ref EXAMPLE_PRUICSS_PWM_DUTY_CYCLE
+
+## API
+
+\ref PRUICSS_PWM_API
diff --git a/docs_src/docs/api_guide/device/am243x/components.cfg b/docs_src/docs/api_guide/device/am243x/components.cfg
index 5d53f9a..ecd1dd0 100644
--- a/docs_src/docs/api_guide/device/am243x/components.cfg
+++ b/docs_src/docs/api_guide/device/am243x/components.cfg
@@ -13,6 +13,8 @@ INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/position_se
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/current_sense/current_sense.md
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/current_sense/sdfm_design.md
+INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/pruicss_pwm/pruicss_pwm.md
+
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/source/position_sense/endat/include/endat_api.h
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/source/position_sense/endat/include/endat_drv.h
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/source/position_sense/hdsl/include/hdsl_drv.h
diff --git a/docs_src/docs/api_guide/device/am243x/examples.cfg b/docs_src/docs/api_guide/device/am243x/examples.cfg
index a74a8b3..c394f81 100644
--- a/docs_src/docs/api_guide/device/am243x/examples.cfg
+++ b/docs_src/docs/api_guide/device/am243x/examples.cfg
@@ -6,3 +6,4 @@ INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/sdfm_example.
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/bissc_example.md
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/dcl/dcl_pi/dcl_pi.md
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/dcl/dcl_df22/dcl_df22.md
+INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/pruicss_pwm.md
diff --git a/docs_src/docs/api_guide/device/am64x/components.cfg b/docs_src/docs/api_guide/device/am64x/components.cfg
index 2b7e387..3dc552a 100644
--- a/docs_src/docs/api_guide/device/am64x/components.cfg
+++ b/docs_src/docs/api_guide/device/am64x/components.cfg
@@ -11,6 +11,8 @@ INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/position_se
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/current_sense/current_sense.md
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/current_sense/sdfm_design.md
+INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/components/pruicss_pwm/pruicss_pwm.md
+
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/source/position_sense/endat/include/endat_api.h
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/source/position_sense/endat/include/endat_drv.h
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/source/position_sense/hdsl/include/hdsl_drv.h
diff --git a/docs_src/docs/api_guide/device/am64x/examples.cfg b/docs_src/docs/api_guide/device/am64x/examples.cfg
index 532c41e..affa5bd 100644
--- a/docs_src/docs/api_guide/device/am64x/examples.cfg
+++ b/docs_src/docs/api_guide/device/am64x/examples.cfg
@@ -3,3 +3,4 @@ INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/hdsl_example.
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/endat_example.md
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/tamagawa_example.md
INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/sdfm_example.md
+INPUT+= $(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/examples/pruicss_pwm.md
\ No newline at end of file
diff --git a/docs_src/docs/api_guide/doxygen.cfg b/docs_src/docs/api_guide/doxygen.cfg
index 344cff3..c75d24e 100644
--- a/docs_src/docs/api_guide/doxygen.cfg
+++ b/docs_src/docs/api_guide/doxygen.cfg
@@ -856,6 +856,7 @@ IMAGE_PATH+=$(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/images/
IMAGE_PATH+=$(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/images/$(DEVICE)/
IMAGE_PATH+=$(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/images/position_sense
IMAGE_PATH+=$(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/images/current_sense
+IMAGE_PATH+=$(MOTOR_CONTROL_SDK_PATH)/docs_src/docs/api_guide/images/pruicss_pwm
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
diff --git a/docs_src/docs/api_guide/examples/examples.md b/docs_src/docs/api_guide/examples/examples.md
index b3d2a97..510befc 100644
--- a/docs_src/docs/api_guide/examples/examples.md
+++ b/docs_src/docs/api_guide/examples/examples.md
@@ -8,6 +8,8 @@ This page lists all the examples and demos supported in this SDK.
-# \subpage EXAMPLE_MOTORCONTROL_TAMAGAWA
- Current Sense
-# \subpage EXAMPLE_MOTORCONTROL_SDFM
+- PRUICSS PWM
+ -# \subpage EXAMPLE_PRUICSS_PWM_DUTY_CYCLE
\endcond
\cond SOC_AM243X
@@ -21,6 +23,8 @@ This page lists all the examples and demos supported in this SDK.
- RTLibs
-# \subpage EXAMPLES_DCL_PI
-# \subpage EXAMPLES_DCL_DF22
+- PRUICSS PWM
+ -# \subpage EXAMPLE_PRUICSS_PWM_DUTY_CYCLE
\endcond
\cond SOC_AM263X
diff --git a/docs_src/docs/api_guide/examples/pruicss_pwm.md b/docs_src/docs/api_guide/examples/pruicss_pwm.md
new file mode 100644
index 0000000..09b36b7
--- /dev/null
+++ b/docs_src/docs/api_guide/examples/pruicss_pwm.md
@@ -0,0 +1,101 @@
+# PRUICSS PWM Duty Cycle {#EXAMPLE_PRUICSS_PWM_DUTY_CYCLE}
+
+[TOC]
+
+# Introduction
+
+This example generates a signal for a specified time and duty cycle using
+PRUICSS PWM. The time and duty cycle can be configured by the user.
+
+\cond SOC_AM243X
+
+## AM243X-EVM
+The example Uses PRUICSSG1 PWM module and does below
+
+- This example uses PRUICSSG1 PWM module as probing PRUICSSG0 PWM signals requires IO breakout board
+- Configures PWM0_2_NEG(alias signal PWM0_B2) to generate a 1KHz signal with 25% duty cycle
+- PWM0_2_NEG(alias signal PWM0_B2) uses IEP0 CMP6 EVENT to control Duty cycle and IEP0 CMP0 to control output Frequency
+- Configures IEP0 CMP0 value with PWM0_2_NEG(alias signal PWM0_B2) output period value
+- Configures IEP0 CMP6 value with PWM0_2_NEG(alias signal PWM0_B2) output duty cycle value
+- PRG1_PWM0_B2 can be probed on J16 PIN1
+
+#### AM243X-EVM Probe Output
+\imageStyle{am64x_am243x_evm_duty_example_probe_output.png,width:70%}
+\image html am64x_am243x_evm_duty_example_probe_output.png "PRUICSS PWM DUTY CYCLE PROBE OUTPUT"
+
+## AM243X-LP
+The example Uses PRUICSSG0 PWM module and does below
+
+- Configures PWM0_0_POS(alias signal PWM0_A0) to generate a 1KHz signal with 25% duty cycle
+- Configures PWM3_2_NEG(alias signal PWM3_B2) to generate a 1KHz signal with 25% duty cycle
+- PWM0_0_POS(alias signal PWM0_A0) uses IEP0 CMP1 EVENT to control Duty cycle and IEP0 CMP0 to control output Frequency
+- PWM3_2_NEG(alias signal PWM3_B2) uses IEP1 CMP12 EVENT to control Duty cycle and IEP0 CMP0 to control output Frequency
+- Configures IEP0 CMP0 value with PWM0_0_POS(alias signal PWM0_A0) and PWM3_2_NEG(alias signal PWM3_B2) output period value
+- Configures IEP0 CMP6 value with PWM0_0_POS(alias signal PWM0_A0) output duty cycle value
+- Configures IEP1 CMP12 value with PWM0_0_POS(alias signal PWM0_A0) output duty cycle value
+- PWM0_0_POS(alias signal PWM0_A0) and PWM3_2_NEG(alias signal PWM3_B2) will be in sync with respect to each other as IEP0 CMP0 value is used to control output period of these signals
+- PRG0_PWM0_A0 can be probed on J1.5
+- PRG0_PWM3_B2 can be probed on J2.8
+
+#### AM243X-LP Probe Output
+\image html am243x_lp_duty_example_probe_output.png "PRUICSS PWM DUTY CYCLE PROBE OUTPUT"
+
+\endcond
+
+\cond SOC_AM64X
+
+## AM64X-EVM
+The example Uses PRUICSSG1 PWM module and does below
+
+- This example uses PRUICSSG1 PWM module as probing PRUICSSG0 PWM signals requires IO breakout board
+- Configures PWM0_2_NEG(alias signal PWM0_B2) to generate a 1KHz signal with 25% duty cycle
+- PWM0_2_NEG(alias signal PWM0_B2) uses IEP0 CMP6 EVENT to control Duty cycle and IEP0 CMP0 to control output Frequency
+- Configures IEP0 CMP0 value with PWM0_2_NEG(alias signal PWM0_B2) output period value
+- Configures IEP0 CMP6 value with PWM0_2_NEG(alias signal PWM0_B2) output duty cycle value
+- PRG1_PWM0_B2 can be probed on J16 PIN1
+
+#### AM64X-EVM Probe Output
+\imageStyle{am64x_am243x_evm_duty_example_probe_output.png,width:70%}
+\image html am64x_am243x_evm_duty_example_probe_output.png "PRUICSS PWM DUTY CYCLE PROBE OUTPUT"
+
+\endcond
+
+
+# Supported Combinations {#EXAMPLES_DRIVERS_EPWM_DUTY_CYCLE_COMBOS}
+
+\cond SOC_AM64X
+
+ Parameter | Value
+ ---------------|-----------
+ CPU + OS | r5fss0-0 freertos
+ Toolchain | ti-arm-clang
+ Board | @VAR_BOARD_NAME_LOWER
+ Example folder | examples/drivers/epwm/epwm_duty_cycle/
+
+\endcond
+
+\cond SOC_AM243X
+
+ Parameter | Value
+ ---------------|-----------
+ CPU + OS | r5fss0-0 freertos
+ Toolchain | ti-arm-clang
+ Boards | @VAR_BOARD_NAME_LOWER, @VAR_LP_BOARD_NAME_LOWER
+ Example folder | examples/drivers/epwm/epwm_duty_cycle/
+
+\endcond
+
+# Steps to Run the Example
+
+- **When using CCS projects to build**, import the CCS project for the required combination
+ and build it using the CCS project menu (see Using SDK with CCS Projects ).
+- **When using makefiles to build**, note the required combination and build using
+ make command (see Using SDK with Makefiles )
+- Launch a CCS debug session and run the executable, see CCS Launch, Load and Run
+- To probe the PRUICSS PWM output please refer setup details as mentioned above in Introduction section
+
+# See Also
+
+\ref PRUICSS_PWM_API
+
+
diff --git a/docs_src/docs/api_guide/images/pruicss_pwm/am243x_lp_duty_example_probe_output.png b/docs_src/docs/api_guide/images/pruicss_pwm/am243x_lp_duty_example_probe_output.png
new file mode 100644
index 0000000..7ad3ac0
Binary files /dev/null and b/docs_src/docs/api_guide/images/pruicss_pwm/am243x_lp_duty_example_probe_output.png differ
diff --git a/docs_src/docs/api_guide/images/pruicss_pwm/am64x_am243x_evm_duty_example_probe_output.png b/docs_src/docs/api_guide/images/pruicss_pwm/am64x_am243x_evm_duty_example_probe_output.png
new file mode 100644
index 0000000..e571ab6
Binary files /dev/null and b/docs_src/docs/api_guide/images/pruicss_pwm/am64x_am243x_evm_duty_example_probe_output.png differ
diff --git a/examples/pruicss_pwm/am243x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c b/examples/pruicss_pwm/am243x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
index 3710b35..7da130b 100644
--- a/examples/pruicss_pwm/am243x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
+++ b/examples/pruicss_pwm/am243x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
@@ -86,36 +86,36 @@ void pruicss_iep_init(void *args)
{
int32_t status;
/*Disable IEP0 counter*/
- status= PRUICSS_controlIepCounter(gPruIcssHandle,0,0);
+ status= PRUICSS_controlIepCounter(gPruIcssHandle,PRUICSS_IEP_INST0,0);
DebugP_assert(SystemP_SUCCESS == status);
Pinmux_config(gPinMuxMainDomainCfg1, PINMUX_DOMAIN_ID_MAIN);
/*Intialize IEP0 count value*/
- PRUICSS_PWM_setIepCounterLower_32bitValue(gPruIcssHandle,0,0xFFFFFFFF);
- PRUICSS_PWM_setIepCounterUpper_32bitValue(gPruIcssHandle,0,0xFFFFFFFF);
+ PRUICSS_PWM_setIepCounterLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,0xFFFFFFFF);
+ PRUICSS_PWM_setIepCounterUpper_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,0xFFFFFFFF);
/*configure cmp 0 value with APP_PRUICSS_PWM_PRD_VAL*/
- status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,0,0,(APP_PRUICSS_PWM_PRD_VAL & 0xFFFFFFFF));
+ status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,CMP_EVENT0,(APP_PRUICSS_PWM_PRD_VAL & 0xFFFFFFFF));
DebugP_assert(SystemP_SUCCESS == status);
/*configure cmp 6 value with APP_PRUICSS_IEP0_COMP6_VAL*/
- status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,0,6,(APP_PRUICSS_IEP0_COMP6_VAL & 0xFFFFFFFF));
+ status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,CMP_EVENT6,(APP_PRUICSS_IEP0_COMP6_VAL & 0xFFFFFFFF));
DebugP_assert(SystemP_SUCCESS == status);
/*Enable cmp 0 and cmp 6*/
- status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,0,0x41);
+ status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,PRUICSS_IEP_INST0,0x41);
DebugP_assert(SystemP_SUCCESS == status);
/*Set IEP0 counter Increment value*/
- status=PRUICSS_setIepCounterIncrementValue(gPruIcssHandle,0,PRUICSS_IEP_COUNT_INCREMENT_VALUE);
+ status=PRUICSS_setIepCounterIncrementValue(gPruIcssHandle,PRUICSS_IEP_INST0,PRUICSS_IEP_COUNT_INCREMENT_VALUE);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable cmp 0 reset of counter*/
- PRUICSS_PWM_configureIepCmp0ResetEnable(gPruIcssHandle,0,0x1);
+ PRUICSS_PWM_configureIepCmp0ResetEnable(gPruIcssHandle,PRUICSS_IEP_INST0,0x1);
/*Enable IEP0 counter*/
- status=PRUICSS_controlIepCounter(gPruIcssHandle,0,1);
+ status=PRUICSS_controlIepCounter(gPruIcssHandle,PRUICSS_IEP_INST0,1);
DebugP_assert(SystemP_SUCCESS == status);
}
@@ -127,12 +127,12 @@ void pruicss_pwm_init(void *args)
status=PRUICSS_PWM_configurePwmEfficiencyModeEnable(gPruIcssHandle, 1);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable compare0 trip reset */
- PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,0,1);
+ PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,PRUICSS_PWM_SET0,1);
/*configure PWM B2 signal of set 0, intial state to low*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,0,0,1);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,PRUICSS_PWM_SET0,PRUICSS_PWM_INTIAL_STATE,PRUICSS_PWM_OUTPUT_LOW);
DebugP_assert(SystemP_SUCCESS == status);
/*configure PWM B2 signal of set 0, active state to high*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,0,1,2);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,PRUICSS_PWM_SET0,PRUICSS_PWM_ACTIVE_STATE,PRUICSS_PWM_OUTPUT_HIGH);
DebugP_assert(SystemP_SUCCESS == status);
}
diff --git a/examples/pruicss_pwm/am243x-lp/r5fss0-0_freertos/pruicss_pwm_dutycycle.c b/examples/pruicss_pwm/am243x-lp/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
index 559a3d6..f610173 100644
--- a/examples/pruicss_pwm/am243x-lp/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
+++ b/examples/pruicss_pwm/am243x-lp/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
@@ -104,7 +104,7 @@ void pruicss_iep_init(void *args)
int status;
/*Disable IEP0 counter*/
- status= PRUICSS_controlIepCounter(gPruIcssHandle,0,0);
+ status= PRUICSS_controlIepCounter(gPruIcssHandle,PRUICSS_IEP_INST0,0);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable IEP1 slave mode*/
@@ -112,39 +112,39 @@ void pruicss_iep_init(void *args)
DebugP_assert(SystemP_SUCCESS == status);
/*Intialize IEP0 count value*/
- PRUICSS_PWM_setIepCounterLower_32bitValue(gPruIcssHandle,0,0xFFFFFFFF);
- PRUICSS_PWM_setIepCounterUpper_32bitValue(gPruIcssHandle,0,0xFFFFFFFF);
+ PRUICSS_PWM_setIepCounterLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,0xFFFFFFFF);
+ PRUICSS_PWM_setIepCounterUpper_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,0xFFFFFFFF);
/*configure cmp 0 value of IEP0 with APP_PRUICSS_PWM_PRD_VAL*/
- status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,0,0,(APP_PRUICSS_PWM_PRD_VAL & 0xFFFFFFFF));
+ status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,CMP_EVENT0,(APP_PRUICSS_PWM_PRD_VAL & 0xFFFFFFFF));
DebugP_assert(SystemP_SUCCESS == status);
/*configure cmp 1 value with APP_PRUICSS_IEP0_COMP1_VAL*/
- status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,0,1,(APP_PRUICSS_IEP0_COMP1_VAL & 0xFFFFFFFF));
+ status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,CMP_EVENT1,(APP_PRUICSS_IEP0_COMP1_VAL & 0xFFFFFFFF));
DebugP_assert(SystemP_SUCCESS == status);
- /*configure cmp 11 value with APP_PRUICSS_IEP1_COMP11_VAL*/
- status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,1,12,(APP_PRUICSS_IEP1_COMP12_VAL & 0xFFFFFFFF));
+ /*configure cmp 12 value with APP_PRUICSS_IEP1_COMP12_VAL*/
+ status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST1,CMP_EVENT12,(APP_PRUICSS_IEP1_COMP12_VAL & 0xFFFFFFFF));
DebugP_assert(SystemP_SUCCESS == status);
/*Enable cmp 0 and cmp 1 of IEP0*/
- status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,0,0x3);
+ status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,PRUICSS_IEP_INST0,0x3);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable cmp12 of IEP1*/
- status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,1,0x1000);
+ status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,PRUICSS_IEP_INST1,0x1000);
DebugP_assert(SystemP_SUCCESS == status);
/*Set IEP0 counter Increment value*/
- status=PRUICSS_setIepCounterIncrementValue(gPruIcssHandle,0,PRUICSS_IEP_COUNT_INCREMENT_VALUE);
+ status=PRUICSS_setIepCounterIncrementValue(gPruIcssHandle,PRUICSS_IEP_INST0,PRUICSS_IEP_COUNT_INCREMENT_VALUE);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable cmp 0 reset of IEP0 counter*/
- status=PRUICSS_PWM_configureIepCmp0ResetEnable(gPruIcssHandle,0,0x1);
+ status=PRUICSS_PWM_configureIepCmp0ResetEnable(gPruIcssHandle,PRUICSS_IEP_INST0,0x1);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable IEP0 counter*/
- status=PRUICSS_controlIepCounter(gPruIcssHandle,0,1);
+ status=PRUICSS_controlIepCounter(gPruIcssHandle,PRUICSS_IEP_INST0,1);
DebugP_assert(SystemP_SUCCESS == status);
}
@@ -157,27 +157,27 @@ void pruicss_pwm_init(void *args){
DebugP_assert(SystemP_SUCCESS == status);
/*Enable compare0 trip reset of set 0*/
- status=PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,0,1);
+ status=PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,PRUICSS_PWM_SET0,1);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable compare0 trip reset of set 3 */
- status=PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,3,1);
+ status=PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,PRUICSS_PWM_SET3,1);
DebugP_assert(SystemP_SUCCESS == status);
/*configure PWM B2 signal of set 0, intial state to low*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalA0(gPruIcssHandle,0,0,1);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalA0(gPruIcssHandle,PRUICSS_PWM_SET0,PRUICSS_PWM_INTIAL_STATE,1);
DebugP_assert(SystemP_SUCCESS == status);
/*configure PWM B2 signal of set 0, active state to high*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalA0(gPruIcssHandle,0,1,2);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalA0(gPruIcssHandle,PRUICSS_PWM_SET0,PRUICSS_PWM_ACTIVE_STATE,2);
DebugP_assert(SystemP_SUCCESS == status);
/*configure PWM B2 signal of set 0, intial state to low*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,3,0,1);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,PRUICSS_PWM_SET3,PRUICSS_PWM_INTIAL_STATE,1);
DebugP_assert(SystemP_SUCCESS == status);
/*configure PWM B2 signal of set 0, active state to high*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,3,1,2);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,PRUICSS_PWM_SET3,PRUICSS_PWM_ACTIVE_STATE,2);
DebugP_assert(SystemP_SUCCESS == status);
}
diff --git a/examples/pruicss_pwm/am64x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c b/examples/pruicss_pwm/am64x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
index 3710b35..7da130b 100644
--- a/examples/pruicss_pwm/am64x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
+++ b/examples/pruicss_pwm/am64x-evm/r5fss0-0_freertos/pruicss_pwm_dutycycle.c
@@ -86,36 +86,36 @@ void pruicss_iep_init(void *args)
{
int32_t status;
/*Disable IEP0 counter*/
- status= PRUICSS_controlIepCounter(gPruIcssHandle,0,0);
+ status= PRUICSS_controlIepCounter(gPruIcssHandle,PRUICSS_IEP_INST0,0);
DebugP_assert(SystemP_SUCCESS == status);
Pinmux_config(gPinMuxMainDomainCfg1, PINMUX_DOMAIN_ID_MAIN);
/*Intialize IEP0 count value*/
- PRUICSS_PWM_setIepCounterLower_32bitValue(gPruIcssHandle,0,0xFFFFFFFF);
- PRUICSS_PWM_setIepCounterUpper_32bitValue(gPruIcssHandle,0,0xFFFFFFFF);
+ PRUICSS_PWM_setIepCounterLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,0xFFFFFFFF);
+ PRUICSS_PWM_setIepCounterUpper_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,0xFFFFFFFF);
/*configure cmp 0 value with APP_PRUICSS_PWM_PRD_VAL*/
- status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,0,0,(APP_PRUICSS_PWM_PRD_VAL & 0xFFFFFFFF));
+ status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,CMP_EVENT0,(APP_PRUICSS_PWM_PRD_VAL & 0xFFFFFFFF));
DebugP_assert(SystemP_SUCCESS == status);
/*configure cmp 6 value with APP_PRUICSS_IEP0_COMP6_VAL*/
- status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,0,6,(APP_PRUICSS_IEP0_COMP6_VAL & 0xFFFFFFFF));
+ status=PRUICSS_PWM_setIepCompareEventLower_32bitValue(gPruIcssHandle,PRUICSS_IEP_INST0,CMP_EVENT6,(APP_PRUICSS_IEP0_COMP6_VAL & 0xFFFFFFFF));
DebugP_assert(SystemP_SUCCESS == status);
/*Enable cmp 0 and cmp 6*/
- status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,0,0x41);
+ status=PRUICSS_PWM_configureIepCompareEnable(gPruIcssHandle,PRUICSS_IEP_INST0,0x41);
DebugP_assert(SystemP_SUCCESS == status);
/*Set IEP0 counter Increment value*/
- status=PRUICSS_setIepCounterIncrementValue(gPruIcssHandle,0,PRUICSS_IEP_COUNT_INCREMENT_VALUE);
+ status=PRUICSS_setIepCounterIncrementValue(gPruIcssHandle,PRUICSS_IEP_INST0,PRUICSS_IEP_COUNT_INCREMENT_VALUE);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable cmp 0 reset of counter*/
- PRUICSS_PWM_configureIepCmp0ResetEnable(gPruIcssHandle,0,0x1);
+ PRUICSS_PWM_configureIepCmp0ResetEnable(gPruIcssHandle,PRUICSS_IEP_INST0,0x1);
/*Enable IEP0 counter*/
- status=PRUICSS_controlIepCounter(gPruIcssHandle,0,1);
+ status=PRUICSS_controlIepCounter(gPruIcssHandle,PRUICSS_IEP_INST0,1);
DebugP_assert(SystemP_SUCCESS == status);
}
@@ -127,12 +127,12 @@ void pruicss_pwm_init(void *args)
status=PRUICSS_PWM_configurePwmEfficiencyModeEnable(gPruIcssHandle, 1);
DebugP_assert(SystemP_SUCCESS == status);
/*Enable compare0 trip reset */
- PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,0,1);
+ PRUICSS_PWM_configurePwmCmp0TripResetEnable(gPruIcssHandle,PRUICSS_PWM_SET0,1);
/*configure PWM B2 signal of set 0, intial state to low*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,0,0,1);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,PRUICSS_PWM_SET0,PRUICSS_PWM_INTIAL_STATE,PRUICSS_PWM_OUTPUT_LOW);
DebugP_assert(SystemP_SUCCESS == status);
/*configure PWM B2 signal of set 0, active state to high*/
- status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,0,1,2);
+ status=PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(gPruIcssHandle,PRUICSS_PWM_SET0,PRUICSS_PWM_ACTIVE_STATE,PRUICSS_PWM_OUTPUT_HIGH);
DebugP_assert(SystemP_SUCCESS == status);
}
diff --git a/source/pruicss_pwm/driver/pruicss_pwm.c b/source/pruicss_pwm/driver/pruicss_pwm.c
index ec0a709..6bda74b 100644
--- a/source/pruicss_pwm/driver/pruicss_pwm.c
+++ b/source/pruicss_pwm/driver/pruicss_pwm.c
@@ -852,7 +852,7 @@ int32_t PRUICSS_PWM_actionOnOutputCfgPwmSignalA0(PRUICSS_Handle handle, uint8_t
PRUICSS_HwAttrs const *hwAttrs;
int32_t retVal = SystemP_FAILURE;
- if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES))
+ if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES) && (action < PRUICSS_NUM_PWM_OUTPUT_ACTIONS))
{
retVal = SystemP_SUCCESS;
hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
@@ -939,7 +939,7 @@ int32_t PRUICSS_PWM_actionOnOutputCfgPwmSignalA1(PRUICSS_Handle handle, uint8_t
PRUICSS_HwAttrs const *hwAttrs;
int32_t retVal = SystemP_FAILURE;
- if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES))
+ if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES) && (action < PRUICSS_NUM_PWM_OUTPUT_ACTIONS))
{
retVal = SystemP_SUCCESS;
hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
@@ -1026,7 +1026,7 @@ int32_t PRUICSS_PWM_actionOnOutputCfgPwmSignalA2(PRUICSS_Handle handle, uint8_t
PRUICSS_HwAttrs const *hwAttrs;
int32_t retVal = SystemP_FAILURE;
- if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES))
+ if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES) && (action < PRUICSS_NUM_PWM_OUTPUT_ACTIONS))
{
retVal = SystemP_SUCCESS;
hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
@@ -1111,7 +1111,7 @@ int32_t PRUICSS_PWM_actionOnOutputCfgPwmSignalB0(PRUICSS_Handle handle, uint8_t
PRUICSS_HwAttrs const *hwAttrs;
int32_t retVal = SystemP_FAILURE;
- if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES))
+ if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES) && (action < PRUICSS_NUM_PWM_OUTPUT_ACTIONS))
{
retVal = SystemP_SUCCESS;
hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
@@ -1196,7 +1196,7 @@ int32_t PRUICSS_PWM_actionOnOutputCfgPwmSignalB1(PRUICSS_Handle handle, uint8_t
PRUICSS_HwAttrs const *hwAttrs;
int32_t retVal = SystemP_FAILURE;
- if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES))
+ if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES) && (action < PRUICSS_NUM_PWM_OUTPUT_ACTIONS))
{
retVal = SystemP_SUCCESS;
hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
@@ -1282,7 +1282,7 @@ int32_t PRUICSS_PWM_actionOnOutputCfgPwmSignalB2(PRUICSS_Handle handle, uint8_t
PRUICSS_HwAttrs const *hwAttrs;
int32_t retVal = SystemP_FAILURE;
- if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES))
+ if ((handle != NULL) && (pwmSet < PRUICSS_NUM_PWM_SETS) && (state < PRUICSS_NUM_PWM_STATES) && (action < PRUICSS_NUM_PWM_OUTPUT_ACTIONS))
{
retVal = SystemP_SUCCESS;
hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
diff --git a/source/pruicss_pwm/include/pruicss_pwm.h b/source/pruicss_pwm/include/pruicss_pwm.h
index 1d8cc47..be0cf61 100644
--- a/source/pruicss_pwm/include/pruicss_pwm.h
+++ b/source/pruicss_pwm/include/pruicss_pwm.h
@@ -31,7 +31,7 @@
*/
/**
- * \defgroup PRUICSS_PWM_API APIs for PruIcss_pwm
+ * \defgroup PRUICSS_PWM_API APIs for PRUICSS PWM
*
* This module contains APIs for device driver pruicss_pwm supported in this SDK.
*
@@ -96,43 +96,132 @@ extern "C" {
/* Macros & Typedefs */
/* ========================================================================== */
+
/**
- * \brief Number of PRUICSS IEP Instances
+ *
+ * \anchor PRUICSS_PWM_SET
+ * \name PRUICSS PWM SET
+ *
+ * @{
+ */
+#define PRUICSS_NUM_PWM_SETS (0x4U)
+
+#define PRUICSS_PWM_SET0 (0x0U)
+
+#define PRUICSS_PWM_SET1 (0x1U)
+
+#define PRUICSS_PWM_SET2 (0x2U)
+
+#define PRUICSS_PWM_SET3 (0x3U)
+/** @} */
+
+
+/**
+ *
+ * \anchor PRUICSS_PWM_STATE
+ * \name PRUICSS PWM STATE
+ *
+ * @{
+ */
+#define PRUICSS_NUM_PWM_STATES (0x3U)
+
+#define PRUICSS_PWM_INTIAL_STATE (0x0U)
+
+#define PRUICSS_PWM_ACTIVE_STATE (0x1U)
+
+#define PRUICSS_PWM_TRIP_STATE (0x2U)
+/** @} */
+
+/**
+ *
+ * \anchor PRUICSS_PWM_OUTPUT_ACTION
+ * \name PRUICSS PWM OUTPUT ACTION
+ *
+ * @{
+ */
+#define PRUICSS_NUM_PWM_OUTPUT_ACTIONS (0x3U)
+
+#define PRUICSS_PWM_OUTPUT_TOGGLE (0x0U)
+
+#define PRUICSS_PWM_OUTPUT_LOW (0x1U)
+
+#define PRUICSS_PWM_OUTPUT_HIGH (0x2U)
+/** @} */
+
+/**
+ *
+ * \anchor PRUICSS_IEP_INSTANCE
+ * \name PRUICSS IEP INSTANCE
+ *
+ * @{
*/
#define PRUICSS_NUM_IEP_INSTANCES (0x2U)
+#define PRUICSS_IEP_INST0 (0x0U)
+
+#define PRUICSS_IEP_INST1 (0x1U)
+/** @} */
+
+
/**
* \brief PRUICSS IEP count register maximum value
*/
#define PRUICSS_IEP_COUNT_REG_MAX (0xFFFFFFFFU)
/**
- * \brief Number of PRUICSS IEP compare events
+ *
+ * \anchor PRUICSS_IEP_COMPARE_EVENT
+ * \name PRUICSS IEP COMPARE EVENT
+ *
+ * @{
*/
#define PRUICSS_NUM_IEP_CMP_EVENTS (0x10U)
+#define CMP_EVENT0 (0x0U)
+
+#define CMP_EVENT1 (0x1U)
+
+#define CMP_EVENT2 (0x2U)
+
+#define CMP_EVENT3 (0x3U)
+
+#define CMP_EVENT4 (0x4U)
+
+#define CMP_EVENT5 (0x5U)
+
+#define CMP_EVENT6 (0x6U)
+
+#define CMP_EVENT7 (0x7U)
+
+#define CMP_EVENT8 (0x8U)
+
+#define CMP_EVENT9 (0x9U)
+
+#define CMP_EVENT10 (0xAU)
+
+#define CMP_EVENT11 (0xBU)
+
+#define CMP_EVENT12 (0xCU)
+
+#define CMP_EVENT13 (0xDU)
+
+#define CMP_EVENT14 (0xEU)
+
+#define CMP_EVENT15 (0xFU)
+/** @} */
+
/**
* \brief Number of PRUICSS IEP compare events enable field maximum value
*/
#define PRUICSS_IEP_CMP_EVENTS_ENABLE_MAX_VALUE (0x0000FFFFU)
-/**
- * \brief Number of PRUICSS PWM Sets
- */
-#define PRUICSS_NUM_PWM_SETS (0x4U)
-
-/**
- * \brief Number of PRUICSS PWM number of states
- */
-#define PRUICSS_NUM_PWM_STATES (0x3U)
-
/**
* \brief PRUICSS PWM Debounce maximum value
*/
#define PRUICSS_PWM_DEBOUNCE_MAX_VALUE (0xFFU)
/**
- * \brief Number of PRUICSS PWM Sets
+ * \brief PRUICSS PWM mask field maximum value
*/
#define PRUICSS_PWM_TRIP_MASK_MAX_VALUE (0x000001FFU)
@@ -147,7 +236,7 @@ extern "C" {
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param iepInstance 0 for IEP0, 1 for IEP1
- * \param value iep count register Lower 32bit Value
+ * \param value Iep count register lower 32bit value
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -158,7 +247,7 @@ int32_t PRUICSS_PWM_setIepCounterLower_32bitValue(PRUICSS_Handle handle, uint8_t
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param iepInstance 0 for IEP0, 1 for IEP1
- * \param value iep count register Upper 32bit Value
+ * \param value Iep count register upper 32bit value
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -169,7 +258,7 @@ int32_t PRUICSS_PWM_setIepCounterUpper_32bitValue(PRUICSS_Handle handle, uint8_t
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param iepInstance 0 for IEP0, 1 for IEP1
- * \param enable enable 0 for disable, 1 for enable
+ * \param enable 0 for disable, 1 for enable
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -191,8 +280,8 @@ int32_t PRUICSS_PWM_configureIepCompareEnable(PRUICSS_Handle handle, uint8_t iep
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param iepInstance 0 for IEP0, 1 for IEP1
- * \param value compare register Lower 32bit Value
- * \param cmpEvent compare Event number. Maximum value allowed is 15
+ * \param value Compare register lower 32bit value
+ * \param cmpEvent Compare event number. maximum value allowed is 15
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -203,8 +292,8 @@ int32_t PRUICSS_PWM_setIepCompareEventLower_32bitValue(PRUICSS_Handle handle, ui
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param iepInstance 0 for IEP0, 1 for IEP1
- * \param value compare register Upper 32bit Value
- * \param cmpEvent compare Event number. Maximum value allowed is 15
+ * \param value Compare register upper 32bit Value
+ * \param cmpEvent Compare event number. maximum value allowed is 15
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -215,7 +304,7 @@ int32_t PRUICSS_PWM_setIepCompareEventUpper_32bitValue(PRUICSS_Handle handle, ui
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param pwmSet 0 for PWM0, 1 for PWM1, 2 for PWM2, 3 for PWM3
- * \param value pwmSet Debounce Value
+ * \param value Pwmset debounce value
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -237,7 +326,7 @@ int32_t PRUICSS_PWM_setPwmDebounceValue(PRUICSS_Handle handle, uint8_t pwmSet, u
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param pwmSet 0 for PWM0, 1 for PWM1, 2 for PWM2, 3 for PWM3
- * \param maskvalue pwmSet maskValue
+ * \param maskvalue Pwmset maskvalue
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -248,7 +337,7 @@ int32_t PRUICSS_PWM_setPwmTripMask(PRUICSS_Handle handle, uint8_t pwmSet, uint16
*
* \param handle PRUICSS_Handle returned from PRUICSS_open()
* \param pwmSet 0 for PWM0, 1 for PWM1, 2 for PWM2, 3 for PWM3
- * \param enable 0 for disable, 1 for enable
+ * \param enable 0 for disable, 1 for enable
* \return SystemP_SUCCESS on success, SystemP_FAILURE on error
*
*/
@@ -442,6 +531,8 @@ int32_t PRUICSS_PWM_configurePwmEfficiencyModeEnable(PRUICSS_Handle handle, uint
*/
int32_t PRUICSS_PWM_enableIEP1Slave(PRUICSS_Handle handle, uint8_t enable);
+/** @} */
+
#ifdef __cplusplus
}
#endif