Lines Matching refs:pwm
49 int32_t hal_pwm_init(pwm_dev_t *pwm) in hal_pwm_init() argument
52 if (pwm->priv != NULL) { in hal_pwm_init()
53 printf("%s priv=%p, SHOULD be NULL!\n", __FUNCTION__, pwm->priv); in hal_pwm_init()
61 if (inited[pwm->port] == 0) { in hal_pwm_init()
62 hal_iomux_init(&pinmux_pwm[pwm->port], 1); in hal_pwm_init()
64 hal_gpio_pin_set_dir(pinmux_pwm[pwm->port].pin, HAL_GPIO_DIR_OUT, 1); in hal_pwm_init()
72 inited[pwm->port] = 1; in hal_pwm_init()
74 _cfg->chan = __hal_pwm_port2chan(pwm->port); in hal_pwm_init()
76 __hal_pwm_pram2cfg(&_cfg->pwm_cfg, &pwm->config); in hal_pwm_init()
77 pwm->priv = (void *)_cfg; in hal_pwm_init()
89 int32_t hal_pwm_start(pwm_dev_t *pwm) in hal_pwm_start() argument
92 _HAL_PWM_PRIV_T *_cfg = (_HAL_PWM_PRIV_T *)pwm->priv; in hal_pwm_start()
108 int32_t hal_pwm_stop(pwm_dev_t *pwm) in hal_pwm_stop() argument
111 _HAL_PWM_PRIV_T *_cfg = (_HAL_PWM_PRIV_T *)pwm->priv; in hal_pwm_stop()
128 int32_t hal_pwm_para_chg(pwm_dev_t *pwm, pwm_config_t para) in hal_pwm_para_chg() argument
132 _HAL_PWM_PRIV_T *_cfg = (_HAL_PWM_PRIV_T *)pwm->priv; in hal_pwm_para_chg()
133 memcpy(&pwm->config, ¶, sizeof(pwm_config_t)); in hal_pwm_para_chg()
134 __hal_pwm_pram2cfg(&_cfg->pwm_cfg, &pwm->config); in hal_pwm_para_chg()
148 int32_t hal_pwm_finalize(pwm_dev_t *pwm) in hal_pwm_finalize() argument
151 _HAL_PWM_PRIV_T *_cfg = (_HAL_PWM_PRIV_T *)pwm->priv; in hal_pwm_finalize()
154 hal_pwm_stop(pwm); in hal_pwm_finalize()
157 pwm->priv = NULL; in hal_pwm_finalize()