summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Livingston2019-08-19 11:27:29 -0500
committerFrank Livingston2019-08-19 11:27:29 -0500
commite1f69cc0adce876352f2a705de7286934c1e1add (patch)
treecf9f752731a906ad6f4326dbe9d4781aea0d0366
parentffd4b21bd392d23823a3f91301142fece77715fa (diff)
downloadpruss-lld-e1f69cc0adce876352f2a705de7286934c1e1add.tar.gz
pruss-lld-e1f69cc0adce876352f2a705de7286934c1e1add.tar.xz
pruss-lld-e1f69cc0adce876352f2a705de7286934c1e1add.zip
PRSDK-5738:Add PWM enable flag
Flag allows Host to execute PWM firmware, but reconfigure PWMs before configuration is applied. Signed-off-by: Frank Livingston <frank-livingston@ti.com>
-rw-r--r--example/apps/icssg_pwm/firmware/src/icssg_iep_pwm.h20
-rw-r--r--example/apps/icssg_pwm/firmware/src/iepPwm.c26
-rw-r--r--example/apps/icssg_pwm/firmware/src/iepPwm.h8
-rw-r--r--example/apps/icssg_pwm/firmware/src/iepPwmFwRegs.c2
-rw-r--r--example/apps/icssg_pwm/firmware/src/main.c10
5 files changed, 54 insertions, 12 deletions
diff --git a/example/apps/icssg_pwm/firmware/src/icssg_iep_pwm.h b/example/apps/icssg_pwm/firmware/src/icssg_iep_pwm.h
index 6086af9..c85bb89 100644
--- a/example/apps/icssg_pwm/firmware/src/icssg_iep_pwm.h
+++ b/example/apps/icssg_pwm/firmware/src/icssg_iep_pwm.h
@@ -108,26 +108,36 @@
108#define FW_FEATURE_FW_IEP1_NUM_PWMS_MASK ( FW_IEP1_NUM_PWMS_MASK << FW_FEATURE_FW_IEP1_NUM_PWMS_SHIFT ) 108#define FW_FEATURE_FW_IEP1_NUM_PWMS_MASK ( FW_IEP1_NUM_PWMS_MASK << FW_FEATURE_FW_IEP1_NUM_PWMS_SHIFT )
109 109
110/* PWM_CTRL */ 110/* PWM_CTRL */
111#define BF_PWM_EN_DISABLE ( 0 ) /* PWM Enable bit field disable setting */
112#define BF_PWM_EN_ENABLE ( 1 ) /* PWM Enable bit field enable setting */
111#define BF_PWM_GBL_EN_DISABLE ( 0 ) /* Global Enable bit field disabled setting */ 113#define BF_PWM_GBL_EN_DISABLE ( 0 ) /* Global Enable bit field disabled setting */
112#define BF_PWM_GBL_EN_ENABLE ( 1 ) /* Global Enable bit field enabled setting */ 114#define BF_PWM_GBL_EN_ENABLE ( 1 ) /* Global Enable bit field enabled setting */
115#define PWM_EN_MASK ( 0x1 )
113#define IEP_PWM_GBL_EN_MASK ( 0x1 ) 116#define IEP_PWM_GBL_EN_MASK ( 0x1 )
114#define PWM_CTRL_IEP0_PWM_GBL_EN_SHIFT ( 0 ) 117#define PWM_CTRL_PWM_EN_SHIFT ( 0 )
118#define PWM_CTRL_PWM_EN_MASK ( PWM_EN_MASK << PWM_CTRL_PWM_EN_SHIFT )
119#define PWM_CTRL_IEP0_PWM_GBL_EN_SHIFT ( 1 )
115#define PWM_CTRL_IEP0_PWM_GBL_EN_MASK ( IEP_PWM_GBL_EN_MASK << PWM_CTRL_IEP0_PWM_GBL_EN_SHIFT ) 120#define PWM_CTRL_IEP0_PWM_GBL_EN_MASK ( IEP_PWM_GBL_EN_MASK << PWM_CTRL_IEP0_PWM_GBL_EN_SHIFT )
116#define PWM_CTRL_IEP1_PWM_GBL_EN_SHIFT ( 1 ) 121#define PWM_CTRL_IEP1_PWM_GBL_EN_SHIFT ( 2 )
117#define PWM_CTRL_IEP1_PWM_GBL_EN_MASK ( IEP_PWM_GBL_EN_MASK << PWM_CTRL_IEP1_PWM_GBL_EN_SHIFT ) 122#define PWM_CTRL_IEP1_PWM_GBL_EN_MASK ( IEP_PWM_GBL_EN_MASK << PWM_CTRL_IEP1_PWM_GBL_EN_SHIFT )
118 123
119/* PWM_STAT */ 124/* PWM_STAT */
125#define BF_PWM_EN_ACK_DISABLE ( 0 ) /* PWM Enable ACK bit field disabled setting */
126#define BF_PWM_EN_ACK_ENABLE ( 1 ) /* PWM Enable ACK bit field enabled setting */
120#define BF_PWM_GBL_EN_ACK_DISABLE ( 0 ) /* Global Enable ACK bit field disabled setting */ 127#define BF_PWM_GBL_EN_ACK_DISABLE ( 0 ) /* Global Enable ACK bit field disabled setting */
121#define BF_PWM_GBL_EN_ACK_ENABLE ( 1 ) /* Global Enable ACK bit field enabled setting */ 128#define BF_PWM_GBL_EN_ACK_ENABLE ( 1 ) /* Global Enable ACK bit field enabled setting */
122#define BF_PWM_FW_INIT_UNINIT ( 0 ) /* FW initialized bit field uninitialized setting */ 129#define BF_PWM_FW_INIT_UNINIT ( 0 ) /* FW initialized bit field uninitialized setting */
123#define BF_PWM_FW_INIT_INIT ( 1 ) /* FW initialized bit field initialized setting */ 130#define BF_PWM_FW_INIT_INIT ( 1 ) /* FW initialized bit field initialized setting */
131#define PWM_EN_ACK_MASK ( 0x1 )
124#define IEP_PWM_GBL_EN_ACK_MASK ( 0x1 ) 132#define IEP_PWM_GBL_EN_ACK_MASK ( 0x1 )
125#define FW_INIT_MASK ( 0x1 ) 133#define FW_INIT_MASK ( 0x1 )
126#define PWM_STAT_IEP0_PWM_GBL_EN_ACK_SHIFT ( 0 ) 134#define PWM_STAT_PWM_EN_ACK_SHIFT ( 0 )
135#define PWM_STAT_PWM_EN_ACK_MASK ( PWM_EN_ACK_MASK << PWM_STAT_PWM_EN_ACK_SHIFT )
136#define PWM_STAT_IEP0_PWM_GBL_EN_ACK_SHIFT ( 1 )
127#define PWM_STAT_IEP0_PWM_GBL_EN_ACK_MASK ( IEP_PWM_GBL_EN_ACK_MASK << PWM_STAT_IEP0_PWM_GBL_EN_ACK_SHIFT ) 137#define PWM_STAT_IEP0_PWM_GBL_EN_ACK_MASK ( IEP_PWM_GBL_EN_ACK_MASK << PWM_STAT_IEP0_PWM_GBL_EN_ACK_SHIFT )
128#define PWM_STAT_IEP1_PWM_GBL_EN_ACK_SHIFT ( 1 ) 138#define PWM_STAT_IEP1_PWM_GBL_EN_ACK_SHIFT ( 2 )
129#define PWM_STAT_IEP1_PWM_GBL_EN_ACK_MASK ( IEP_PWM_GBL_EN_ACK_MASK << PWM_STAT_IEP1_PWM_GBL_EN_ACK_SHIFT ) 139#define PWM_STAT_IEP1_PWM_GBL_EN_ACK_MASK ( IEP_PWM_GBL_EN_ACK_MASK << PWM_STAT_IEP1_PWM_GBL_EN_ACK_SHIFT )
130#define PWM_STAT_FW_INIT_SHIFT ( 2 ) 140#define PWM_STAT_FW_INIT_SHIFT ( 3 )
131#define PWM_STAT_FW_INIT_MASK ( FW_INIT_MASK << PWM_STAT_FW_INIT_SHIFT ) 141#define PWM_STAT_FW_INIT_MASK ( FW_INIT_MASK << PWM_STAT_FW_INIT_SHIFT )
132 142
133/* 143/*
diff --git a/example/apps/icssg_pwm/firmware/src/iepPwm.c b/example/apps/icssg_pwm/firmware/src/iepPwm.c
index db7e62f..a1a999a 100644
--- a/example/apps/icssg_pwm/firmware/src/iepPwm.c
+++ b/example/apps/icssg_pwm/firmware/src/iepPwm.c
@@ -627,6 +627,24 @@ Int32 resetIepPwmObj(
627 return IEP_STS_NERR; 627 return IEP_STS_NERR;
628} 628}
629 629
630/* Wait for PWM enable flag from Host.
631 Flag indicates to FW that initialization can commence. */
632Int32 waitPwmEnFlag(
633 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj
634)
635{
636 IepPwmCtrlFwRegs *pIepPwmCtrlFwRegs = pIcssgIepPwmCtrlObj->pIepPwmCtrlFwRegs;
637 Uint8 pwmEn;
638
639 do {
640 pwmEn = (pIepPwmCtrlFwRegs->PWM_CTRL & PWM_CTRL_PWM_EN_MASK) >> PWM_CTRL_PWM_EN_SHIFT;
641 } while (pwmEn == BF_PWM_EN_DISABLE);
642
643 pIepPwmCtrlFwRegs->PWM_STAT |= BF_PWM_EN_ACK_ENABLE << PWM_STAT_PWM_EN_ACK_SHIFT; /* PWM_STAT:PWM_EN_ACK=1 */
644
645 return IEP_STS_NERR;
646}
647
630/* Initialize PWM FW control */ 648/* Initialize PWM FW control */
631Int32 initPwmCtrl( 649Int32 initPwmCtrl(
632 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj 650 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj
@@ -644,9 +662,9 @@ Int32 initPwmCtrl(
644 /* Latch IEP PWM global enable. 662 /* Latch IEP PWM global enable.
645 Global enable can't change after Initialization. */ 663 Global enable can't change after Initialization. */
646 pIcssgIepPwmCtrlObj->iepPwmGblEn[i] = 664 pIcssgIepPwmCtrlObj->iepPwmGblEn[i] =
647 (Bool)((pIepPwmCtrlFwRegs->PWM_CTRL >> i ) & IEP_PWM_GBL_EN_MASK); 665 (Bool)((pIepPwmCtrlFwRegs->PWM_CTRL >> (PWM_CTRL_IEP0_PWM_GBL_EN_SHIFT+i) ) & IEP_PWM_GBL_EN_MASK);
648 /* Acknowledge IEP PWM global enable */ 666 /* Acknowledge IEP PWM global enable */
649 pIepPwmCtrlFwRegs->PWM_STAT |= (Uint32)pIcssgIepPwmCtrlObj->iepPwmGblEn[i] << i; 667 pIepPwmCtrlFwRegs->PWM_STAT |= (Uint32)pIcssgIepPwmCtrlObj->iepPwmGblEn[i] << (PWM_CTRL_IEP0_PWM_GBL_EN_SHIFT+i);
650 } 668 }
651 669
652#ifdef IEP_SYNC_CLK_EN 670#ifdef IEP_SYNC_CLK_EN
@@ -744,13 +762,13 @@ Int32 initIepPwm(
744} 762}
745 763
746/* Set PWM FW initialization flag. 764/* Set PWM FW initialization flag.
747 Flag indicates to Host FW initialization is complete. */ 765 Flag indicates to Host that FW initialization is complete. */
748Int32 setPwmFwInitFlag( 766Int32 setPwmFwInitFlag(
749 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj 767 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj
750) 768)
751{ 769{
752 IepPwmCtrlFwRegs *pIepPwmCtrlFwRegs = pIcssgIepPwmCtrlObj->pIepPwmCtrlFwRegs; 770 IepPwmCtrlFwRegs *pIepPwmCtrlFwRegs = pIcssgIepPwmCtrlObj->pIepPwmCtrlFwRegs;
753 pIepPwmCtrlFwRegs->PWM_STAT |= 0x1 << PWM_STAT_FW_INIT_SHIFT; /* PWM_STAT:FW_INIT=1 */ 771 pIepPwmCtrlFwRegs->PWM_STAT |= BF_PWM_FW_INIT_INIT << PWM_STAT_FW_INIT_SHIFT; /* PWM_STAT:FW_INIT=1 */
754 772
755 return IEP_STS_NERR; 773 return IEP_STS_NERR;
756} 774}
diff --git a/example/apps/icssg_pwm/firmware/src/iepPwm.h b/example/apps/icssg_pwm/firmware/src/iepPwm.h
index 4b9ec5a..61673a8 100644
--- a/example/apps/icssg_pwm/firmware/src/iepPwm.h
+++ b/example/apps/icssg_pwm/firmware/src/iepPwm.h
@@ -187,6 +187,12 @@ Int32 resetPwmCtrlObj(
187 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj 187 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj
188); 188);
189 189
190/* Wait for PWM enable flag from Host.
191 Flag indicates to FW that initialization can commence. */
192Int32 waitPwmEnFlag(
193 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj
194);
195
190/* Initialize PWM FW control */ 196/* Initialize PWM FW control */
191Int32 initPwmCtrl( 197Int32 initPwmCtrl(
192 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj 198 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj
@@ -213,7 +219,7 @@ Int32 initIepPwm(
213); 219);
214 220
215/* Set PWM FW initialization flag. 221/* Set PWM FW initialization flag.
216 Flag indicates to Host FW initialization is complete. */ 222 Flag indicates to Host that FW initialization is complete. */
217Int32 setPwmFwInitFlag( 223Int32 setPwmFwInitFlag(
218 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj 224 IcssgIepPwmCtrlObj *pIcssgIepPwmCtrlObj
219); 225);
diff --git a/example/apps/icssg_pwm/firmware/src/iepPwmFwRegs.c b/example/apps/icssg_pwm/firmware/src/iepPwmFwRegs.c
index a8e57ae..f672bd0 100644
--- a/example/apps/icssg_pwm/firmware/src/iepPwmFwRegs.c
+++ b/example/apps/icssg_pwm/firmware/src/iepPwmFwRegs.c
@@ -39,7 +39,7 @@
39#define DEF_FW_TYPE ( 0x00000000 ) /* Firmware Type - TBD */ 39#define DEF_FW_TYPE ( 0x00000000 ) /* Firmware Type - TBD */
40#define DEF_FW_VERSION ( 0x00000000 ) /* Firmware Version - TBD */ 40#define DEF_FW_VERSION ( 0x00000000 ) /* Firmware Version - TBD */
41#define DEF_FW_FEATURE ( 0x00001998 ) /* Firmware Feature - support for 24 PWMs, 12 IEP0 PWMs, 12 IEP1 PWMs */ 41#define DEF_FW_FEATURE ( 0x00001998 ) /* Firmware Feature - support for 24 PWMs, 12 IEP0 PWMs, 12 IEP1 PWMs */
42#define DEF_FW_EXTENDED_FEATURE ( 0x00000000 ) /* Firmware Extended Feature - TBD */ 42#define DEF_FW_EXTENDED_FEATURE ( 0x00000000 ) /* Firmware Extended Feature - Reserved for future use */
43 43
44/* PWM control defaults */ 44/* PWM control defaults */
45#define DEF_PWM_CTRL ( 0x00000000 ) /* PWM control - IEP0 & IEP1 PWMs disabled */ 45#define DEF_PWM_CTRL ( 0x00000000 ) /* PWM control - IEP0 & IEP1 PWMs disabled */
diff --git a/example/apps/icssg_pwm/firmware/src/main.c b/example/apps/icssg_pwm/firmware/src/main.c
index d0183b4..2ca14aa 100644
--- a/example/apps/icssg_pwm/firmware/src/main.c
+++ b/example/apps/icssg_pwm/firmware/src/main.c
@@ -65,6 +65,14 @@ void main(void)
65 ; 65 ;
66 } 66 }
67 67
68 /* Wait for PWM enable flag from Host, indicates FW init can commence */
69 status = waitPwmEnFlag(&gIcssgIepPwmCtrlObj);
70 if (status != IEP_STS_NERR)
71 {
72 /* Indicate Error to Host */
73 ;
74 }
75
68 /* Initialize PWM FW control */ 76 /* Initialize PWM FW control */
69 status = initPwmCtrl(&gIcssgIepPwmCtrlObj); 77 status = initPwmCtrl(&gIcssgIepPwmCtrlObj);
70 if (status != IEP_STS_NERR) 78 if (status != IEP_STS_NERR)
@@ -89,7 +97,7 @@ void main(void)
89 ; 97 ;
90 } 98 }
91 99
92 /* Set PWM FW init flag, indicate to Host FW init complete */ 100 /* Set PWM FW init flag, indicate FW init complete to Host */
93 status = setPwmFwInitFlag(&gIcssgIepPwmCtrlObj); 101 status = setPwmFwInitFlag(&gIcssgIepPwmCtrlObj);
94 if (status != IEP_STS_NERR) 102 if (status != IEP_STS_NERR)
95 { 103 {