RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Macros | Functions
raspberrypi-pwm.c File Reference

PWM Support. More...

#include "bsp/raspberrypi-pwm.h"

Macros

#define BCM2711_CM_PWM(x)   BCM2835_REG( BCM2711_CM_PWM_BASE + ( x ) )
 
#define CM_PWM_CTL_ENABLE_OSC    ( CM_PWM_PASSWD | CM_PWM_CTL_ENAB | CM_PWM_CTL_SRC_OSC )
 
#define CM_PWM_CTL_DISABLE   ( CM_PWM_PASSWD | CM_PWM_CTL_SRC_OSC )
 

Functions

rtems_status_code rpi_pwm_set_clock (uint32_t divisor)
 Set PWM clock divider.
 
rtems_status_code rpi_pwm_set_data (raspberrypi_pwm_master master, raspberrypi_pwm_channel channel, uint32_t data)
 Update duty-cycle register.
 
rtems_status_code rpi_pwm_init (raspberrypi_pwm_master master, raspberrypi_pwm_channel channel, uint32_t range, uint32_t data)
 Main PWM initialization function. This functions sets up the PWM master, channel, duty cycle and GPIO pin.
 

Detailed Description

PWM Support.

Function Documentation

◆ rpi_pwm_init()

rtems_status_code rpi_pwm_init ( raspberrypi_pwm_master  master,
raspberrypi_pwm_channel  channel,
uint32_t  range,
uint32_t  data 
)

Main PWM initialization function. This functions sets up the PWM master, channel, duty cycle and GPIO pin.

Parameters
masterSelects the hardware instance to be used (raspberrypi_pwm_master0 = PWM0, raspberrypi_pwm_master1 = PWM1)
channelSelects the channel for master (raspberrypi_pwm0 = PWMx_0, raspberrypi_pwm1 = PWMx_1)
rangePeriod register value (> 0)
dataInitial duty count, 1 – range (0 rejected)

◆ rpi_pwm_set_clock()

rtems_status_code rpi_pwm_set_clock ( uint32_t  divisor)

Set PWM clock divider.

Parameters
divisor1 – 4095; PWMCLK = 19.2 MHz / divisor.
Return values
RTEMS_SUCCESSFULOK
RTEMS_INVALID_NUMBER0 or >4095

◆ rpi_pwm_set_data()

rtems_status_code rpi_pwm_set_data ( raspberrypi_pwm_master  master,
raspberrypi_pwm_channel  channel,
uint32_t  data 
)

Update duty-cycle register.

Parameters
masterSelects the hardware instance to be used (raspberrypi_pwm_master0 = PWM0, raspberrypi_pwm_master1 = PWM1)
channelSelects the channel for master (raspberrypi_pwm0 = PWMx_0, raspberrypi_pwm1 = PWMx_1)
dataInitial duty count, 1 – current range value.(0 rejected)