RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Enumerations | Functions
raspberrypi-pwm.h File Reference

Raspberry Pi specific PWM definitions. More...

#include "bsp/raspberrypi.h"
#include "bsp/rpi-gpio.h"
#include "bsp/utility.h"

Go to the source code of this file.

Macros

PWM_CONTROL register bits
#define C_MSEN2   BSP_BIT32( 15 )
 
#define C_USEF2   BSP_BIT32( 13 )
 
#define C_POLA2   BSP_BIT32( 12 )
 
#define C_SBIT2   BSP_BIT32( 11 )
 
#define C_RPTL2   BSP_BIT32( 10 )
 
#define C_MODE2   BSP_BIT32( 9 )
 
#define C_PWEN2   BSP_BIT32( 8 )
 
#define C_MSEN1   BSP_BIT32( 7 )
 
#define C_CLRF   BSP_BIT32( 6 )
 
#define C_USEF1   BSP_BIT32( 5 )
 
#define C_POLA1   BSP_BIT32( 4 )
 
#define C_SBIT1   BSP_BIT32( 3 )
 
#define C_RPTL1   BSP_BIT32( 2 )
 
#define C_MODE1   BSP_BIT32( 1 )
 
#define C_PWEN1   BSP_BIT32( 0 )
 

Enumerations

enum  raspberrypi_pwm_channel { raspberrypi_pwm0 , raspberrypi_pwm1 }
 
enum  raspberrypi_pwm_master { raspberrypi_pwm_master0 , raspberrypi_pwm_master1 }
 

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

Raspberry Pi specific PWM definitions.

Macro Definition Documentation

◆ C_CLRF

#define C_CLRF   BSP_BIT32( 6 )

Clear FIFO

◆ C_MODE1

#define C_MODE1   BSP_BIT32( 1 )

Channel 1 serializer mode

◆ C_MODE2

#define C_MODE2   BSP_BIT32( 9 )

Channel 2 serializer mode

◆ C_MSEN1

#define C_MSEN1   BSP_BIT32( 7 )

Channel 1 Mark-Space enable

◆ C_MSEN2

#define C_MSEN2   BSP_BIT32( 15 )

Channel 2 Mark-Space enable

◆ C_POLA1

#define C_POLA1   BSP_BIT32( 4 )

Channel 1 invert polarity

◆ C_POLA2

#define C_POLA2   BSP_BIT32( 12 )

Channel 2 invert polarity

◆ C_PWEN1

#define C_PWEN1   BSP_BIT32( 0 )

Channel 1 enable output

◆ C_PWEN2

#define C_PWEN2   BSP_BIT32( 8 )

Channel 2 enable output

◆ C_RPTL1

#define C_RPTL1   BSP_BIT32( 2 )

Channel 1 repeat underrun

◆ C_RPTL2

#define C_RPTL2   BSP_BIT32( 10 )

Channel 2 repeat on underrun

◆ C_SBIT1

#define C_SBIT1   BSP_BIT32( 3 )

Channel 1 silence bit high

◆ C_SBIT2

#define C_SBIT2   BSP_BIT32( 11 )

Channel 2 silence bit high

◆ C_USEF1

#define C_USEF1   BSP_BIT32( 5 )

Channel 1 use FIFO

◆ C_USEF2

#define C_USEF2   BSP_BIT32( 13 )

Channel 2 use FIFO

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)