#ifndef __SITARA_PWMSS_HEADER__ #define __SITARA_PWMSS_HEADER__ #include #include #include #include #include #include #include #include #include "../../general/sitara-am437x.h" #include "../../general/am437x_cm.h" #include "sys_pwmss.h" #include "hw_ehrpwm.h" #ifdef CLI_NCURSES #include "../../../../cli/cli.h" #endif #define SOC_EHRPWM_1_MODULE_FREQ 100000000 // SYSCLKOUT [10 ns/tick] #define PWM_PRESCALE 224 // pwm clk divider - TBCLK #define TICKS_PER_MS 446 // ticks per msec pwm output period #define PWM_PERIOD_MS 20 // desired pwm output period in ms // PWM_PRESCALE of 224 = 14 * X (X = 1, 2, 4...128), see TBCTL Register // TICKS_PER_MS * PWM_PERIOD_MS = period of pwm output in ticks = TBPRD (only 16 bits) // FINITO bool init_PWM_SS0( void ); bool init_PWM_SS1( void ); bool init_PWM_SS2( void ); bool pwm_disable( uint8_t system ); bool pwm_enable( uint8_t system ); bool pwm_clk_disable( uint8_t system ); bool pwm_clk_enable( uint8_t system, uint8_t preScaler, uint32_t pwmPeriod ); bool pwm_set( uint8_t system, uint32_t dutyCycle ); bool pwm_run( uint8_t system, uint32_t dutyCycle ); bool pwm_stop( uint8_t system ); #ifdef CLI_NCURSES void print_PWM_info( uint8_t system ); void wprint_PWM_info( WINDOW *wnd, int shX, int shY, uint8_t system ); #endif void close_PWM_SS0( void ); void close_PWM_SS1( void ); void close_PWM_SS2( void ); #endif