RocketLogger  1.0
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 range_clock_setup (int sample_rate)
 
void adc_clock_setup (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 adc_clock_setup ( void  )

Setup PWMSS0 for ADC master clock

Definition at line 84 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_close ( void  )

Unmap PWM registers from user space

Definition at line 48 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 18 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 range_clock_setup ( int  sample_rate)

Setup PWMSS1 for range latch reset clock

Parameters
sample_rateADC sampling rate in Sps

Definition at line 64 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-2017, ETH Zurich, Computer Engineering Group

Definition at line 8 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 10 of file pwm.c.

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

volatile uint16_t* pwmss1_regs

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

Definition at line 12 of file pwm.c.

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