RocketLogger  2.0.2
pwm.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PWMSS0_SYSFS_PATH   "/sys/class/pwm/pwmchip0/"
 
#define PWMSS1_SYSFS_PATH   "/sys/class/pwm/pwmchip2/"
 Path to the Linux sysfs PWMSS1 module device files. More...
 
#define EPWM0A_SYSFS_INDEX   0
 Index of the Linux sysfs ePWM0A module. More...
 
#define EPWM1A_SYSFS_INDEX   0
 Index of the Linux sysfs ePWM1A module. More...
 
#define EPWM1B_SYSFS_INDEX   1
 Index of the Linux sysfs ePWM1B module. More...
 
#define EPWM0A_SYSFS_PATH   PWMSS0_SYSFS_PATH "pwm-0:0/"
 Path to the Linux sysfs ePWM0A module. More...
 
#define EPWM1A_SYSFS_PATH   PWMSS1_SYSFS_PATH "pwm-2:0/"
 Path to the Linux sysfs ePWM1A module. More...
 
#define EPWM1B_SYSFS_PATH   PWMSS1_SYSFS_PATH "pwm-2:1/"
 Path to the Linux sysfs ePWM1B module. More...
 
#define PWM_PERIOD_DEFAULT   490
 Default PWM period in nanoseconds. More...
 
#define PWM_DUTY_CYCLE_DEFAULT   (PWM_PERIOD_DEFAULT / 2)
 Default PWM period in nanoseconds. More...
 

Functions

int pwm_init (void)
 
void pwm_deinit (void)
 

Macro Definition Documentation

◆ EPWM0A_SYSFS_INDEX

#define EPWM0A_SYSFS_INDEX   0

Index of the Linux sysfs ePWM0A module.

Definition at line 42 of file pwm.h.

◆ EPWM0A_SYSFS_PATH

#define EPWM0A_SYSFS_PATH   PWMSS0_SYSFS_PATH "pwm-0:0/"

Path to the Linux sysfs ePWM0A module.

Definition at line 49 of file pwm.h.

◆ EPWM1A_SYSFS_INDEX

#define EPWM1A_SYSFS_INDEX   0

Index of the Linux sysfs ePWM1A module.

Definition at line 44 of file pwm.h.

◆ EPWM1A_SYSFS_PATH

#define EPWM1A_SYSFS_PATH   PWMSS1_SYSFS_PATH "pwm-2:0/"

Path to the Linux sysfs ePWM1A module.

Definition at line 51 of file pwm.h.

◆ EPWM1B_SYSFS_INDEX

#define EPWM1B_SYSFS_INDEX   1

Index of the Linux sysfs ePWM1B module.

Definition at line 46 of file pwm.h.

◆ EPWM1B_SYSFS_PATH

#define EPWM1B_SYSFS_PATH   PWMSS1_SYSFS_PATH "pwm-2:1/"

Path to the Linux sysfs ePWM1B module.

Definition at line 53 of file pwm.h.

◆ PWM_DUTY_CYCLE_DEFAULT

#define PWM_DUTY_CYCLE_DEFAULT   (PWM_PERIOD_DEFAULT / 2)

Default PWM period in nanoseconds.

Definition at line 58 of file pwm.h.

◆ PWM_PERIOD_DEFAULT

#define PWM_PERIOD_DEFAULT   490

Default PWM period in nanoseconds.

Definition at line 56 of file pwm.h.

◆ PWMSS0_SYSFS_PATH

#define PWMSS0_SYSFS_PATH   "/sys/class/pwm/pwmchip0/"

Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Linux sysfs paths device files Path to the Linux sysfs PWMSS0 module device files

Definition at line 37 of file pwm.h.

◆ PWMSS1_SYSFS_PATH

#define PWMSS1_SYSFS_PATH   "/sys/class/pwm/pwmchip2/"

Path to the Linux sysfs PWMSS1 module device files.

Definition at line 39 of file pwm.h.

Function Documentation

◆ pwm_deinit()

void pwm_deinit ( void  )

Deinitialize PWM modules.

Disable and unexport peripheral via sysfs interface.

Definition at line 60 of file pwm.c.

References EPWM0A_SYSFS_INDEX, EPWM0A_SYSFS_PATH, EPWM1A_SYSFS_INDEX, EPWM1A_SYSFS_PATH, EPWM1B_SYSFS_INDEX, EPWM1B_SYSFS_PATH, PWMSS0_SYSFS_PATH, PWMSS1_SYSFS_PATH, sysfs_unexport(), and sysfs_write_int().

+ Here is the call graph for this function:

◆ pwm_init()

int pwm_init ( void  )

Initialize PWM modules.

Export and enable PWM peripherals via sysfs interface.

Returns
Returns 0 on success, negative on failure with errno set accordingly

Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 37 of file pwm.c.

References EPWM0A_SYSFS_INDEX, EPWM0A_SYSFS_PATH, EPWM1A_SYSFS_INDEX, EPWM1A_SYSFS_PATH, EPWM1B_SYSFS_INDEX, EPWM1B_SYSFS_PATH, PWM_DUTY_CYCLE_DEFAULT, PWM_PERIOD_DEFAULT, PWMSS0_SYSFS_PATH, PWMSS1_SYSFS_PATH, SUCCESS, sysfs_export_unexported(), and sysfs_write_int().

+ Here is the call graph for this function: