summaryrefslogtreecommitdiffstats
path: root/bsps/arm/beagle/pwm/pwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/arm/beagle/pwm/pwm.c')
-rw-r--r--bsps/arm/beagle/pwm/pwm.c60
1 files changed, 2 insertions, 58 deletions
diff --git a/bsps/arm/beagle/pwm/pwm.c b/bsps/arm/beagle/pwm/pwm.c
index 81ace1254e..4bd09293e8 100644
--- a/bsps/arm/beagle/pwm/pwm.c
+++ b/bsps/arm/beagle/pwm/pwm.c
@@ -23,6 +23,7 @@
#include <bsp/gpio.h>
#include <bsp/bbb-gpio.h>
#include <bsp.h>
+#include <bsp/pwmss.h>
#include <bsp/bbb-pwm.h>
#include <bsp/beagleboneblack.h>
@@ -38,7 +39,7 @@
* @param pwm_id It is the instance number of EPWM of pwm sub system.
*
* @return Base Address of respective pwm instant.
-*/
+ */
static uint32_t select_pwm(BBB_PWMSS pwm_id)
{
uint32_t baseAddr=0;
@@ -181,63 +182,6 @@ static bool pwm_clock_enable(BBB_PWMSS pwm_id)
return status;
}
-/**
- * @brief This function configures the L3 and L4_PER system clocks.
- * It also configures the system clocks for the specified ePWMSS
- * instance.
- *
- * @param pwmss_id The instance number of ePWMSS whose system clocks
- * have to be configured.
- *
- * 'pwmss_id' can take one of the following values:
- * (0 <= pwmss_id <= 2)
- *
- * @return True if successful
- * False if Unsuccessful
- */
-static bool pwmss_module_clk_config(BBB_PWMSS pwmss_id)
-{
- bool is_valid = true;
-
- if(pwmss_id == BBB_PWMSS0) {
- const uint32_t is_functional = AM335X_CM_PER_EPWMSS0_CLKCTRL_IDLEST_FUNC <<
- AM335X_CM_PER_EPWMSS0_CLKCTRL_IDLEST_SHIFT;
- const uint32_t clkctrl = AM335X_CM_PER_ADDR + AM335X_CM_PER_EPWMSS0_CLKCTRL;
- const uint32_t idle_bits = AM335X_CM_PER_EPWMSS0_CLKCTRL_IDLEST;
- const uint32_t is_enable = AM335X_CM_PER_EPWMSS0_CLKCTRL_MODULEMODE_ENABLE;
- const uint32_t module_mode = AM335X_CM_PER_EPWMSS0_CLKCTRL_MODULEMODE;
-
- REG(clkctrl) |= is_enable;
- while((REG(clkctrl) & module_mode) != is_enable);
- while((REG(clkctrl) & idle_bits) != is_functional);
- }
- else if(pwmss_id == BBB_PWMSS1) {
- const uint32_t is_functional = AM335X_CM_PER_EPWMSS1_CLKCTRL_IDLEST_FUNC <<
- AM335X_CM_PER_EPWMSS1_CLKCTRL_IDLEST_SHIFT;
- const uint32_t clkctrl = AM335X_CM_PER_ADDR + AM335X_CM_PER_EPWMSS1_CLKCTRL;
- const uint32_t idle_bits = AM335X_CM_PER_EPWMSS1_CLKCTRL_IDLEST;
- const uint32_t is_enable = AM335X_CM_PER_EPWMSS1_CLKCTRL_MODULEMODE_ENABLE;
- const uint32_t module_mode = AM335X_CM_PER_EPWMSS1_CLKCTRL_MODULEMODE;
-
- REG(clkctrl) |= is_enable;
- while((REG(clkctrl) & module_mode) != is_enable);
- while((REG(clkctrl) & idle_bits) != is_functional);
- } else if(pwmss_id == BBB_PWMSS2) {
- const uint32_t is_functional = AM335X_CM_PER_EPWMSS2_CLKCTRL_IDLEST_FUNC <<
- AM335X_CM_PER_EPWMSS2_CLKCTRL_IDLEST_SHIFT;
- const uint32_t clkctrl = AM335X_CM_PER_ADDR + AM335X_CM_PER_EPWMSS2_CLKCTRL;
- const uint32_t idle_bits = AM335X_CM_PER_EPWMSS2_CLKCTRL_IDLEST;
- const uint32_t is_enable = AM335X_CM_PER_EPWMSS2_CLKCTRL_MODULEMODE_ENABLE;
- const uint32_t module_mode = AM335X_CM_PER_EPWMSS2_CLKCTRL_MODULEMODE;
-
- REG(clkctrl) |= is_enable;
- while((REG(clkctrl) & module_mode) != is_enable);
- while((REG(clkctrl) & idle_bits) != is_functional);
- } else
- is_valid = false;
- return is_valid;
-}
-
bool beagle_pwm_init(BBB_PWMSS pwmss_id)
{
const bool id_is_valid = pwmss_id < BBB_PWMSS_COUNT;