RocketLogger  1.1.5
pwm.c File Reference
#include "pwm.h"
+ Include dependency graph for pwm.c:

Go to the source code of this file.

Functions

int pwm_setup (void)
 
void pwm_close (void)
 
void pwm_setup_range_clock (int sample_rate)
 
void pwm_setup_adc_clock (void)
 

Variables

int mem_fd
 Physical memory file descriptor. More...
 
volatile uint16_t * pwmss0_regs
 Pointer to PWMSS0 (PWM-Sub-System) registers. More...
 
volatile uint16_t * pwmss1_regs
 Pointer to PWMSS1 (PWM-Sub-System) registers. More...
 

Function Documentation

void pwm_close ( void  )

Unmap PWM registers from user space

Definition at line 80 of file pwm.c.

References mem_fd, PWM_SIZE, pwmss0_regs, and pwmss1_regs.

Referenced by hw_close().

int pwm_setup ( void  )

Map PWM registers into user space (on pwmss0_regs and pwmss1_regs pointer)

Returns
SUCCESS in case of success, FAILURE otherwise

Definition at line 46 of file pwm.c.

References ERROR, FAILURE, mem_fd, PWM_SIZE, PWMSS0_BASE, pwmss0_regs, PWMSS1_BASE, pwmss1_regs, rl_log(), and SUCCESS.

Referenced by hw_init().

+ Here is the call graph for this function:

void pwm_setup_adc_clock ( void  )

Setup PWMSS0 for ADC master clock

Definition at line 115 of file pwm.c.

References ADC_AQ, ADC_CLOCK_PERIOD, AQCTLA, CMPA, pwmss0_regs, TBCTL, TBCTL_DEFAULT, and TBPRD.

Referenced by hw_init().

void pwm_setup_range_clock ( int  sample_rate)

Setup PWMSS1 for range latch reset clock

Parameters
sample_rateADC sampling rate in Sps

Definition at line 94 of file pwm.c.

References AQCTLA, AQCTLB, CMPA, CMPB, PRESCALE2, PULSE_WIDTH, PWM_PERIOD_SCALE, pwmss1_regs, RWC_AQ_A, RWC_AQ_B, TBCTL, TBCTL_DEFAULT, TBPRD, and UP_DOWN_COUNT.

Referenced by hw_init().

Variable Documentation

int mem_fd

Physical memory file descriptor.

Copyright (c) 2016-2019, Swiss Federal Institute of Technology (ETH Zurich) 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 35 of file pwm.c.

Referenced by pwm_close(), and pwm_setup().

volatile uint16_t* pwmss0_regs

Pointer to PWMSS0 (PWM-Sub-System) registers.

Definition at line 37 of file pwm.c.

Referenced by pwm_close(), pwm_setup(), and pwm_setup_adc_clock().

volatile uint16_t* pwmss1_regs

Pointer to PWMSS1 (PWM-Sub-System) registers.

Definition at line 39 of file pwm.c.

Referenced by pwm_close(), pwm_setup(), and pwm_setup_range_clock().