2c9411b30815285d52707ee59aedb630ff8eabc7
[matches/MCTX3420.git] / BBB code / pwm.h
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <errno.h>
4 #include <unistd.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <sys/mman.h>
8 #include <fcntl.h>
9 #include <sys/wait.h>
10 #include <sched.h>
11 #include <stdint.h>
12
13 #define START           0x44e00000    // see datasheet of AM335x
14 #define LENGTH          1024
15 #define OFFSET_1        0xcc          // offset of PWM1 clock (see datasheet of AM335x p.1018)
16 #define FREQ            50                         //50Hz pwm frequency for pressure regulator
17 #define PWMMuxPath      "/sys/kernel/debug/omap_mux/gpmc_a2"
18 #define PWMRunPath      "/sys/class/pwm/ehrpwm.1:0/run"
19 #define PWMDutyPath     "/sys/class/pwm/ehrpwm.1:0/duty_percent"
20 #define PWMFreqPath     "/sys/class/pwm/ehrpwm.1:0/period_freq"
21
22 void pwm_init(void);
23 void pwm_start(void);
24 void pwm_stop(void);
25 void pwm_set_duty(int duty_percent);
26 void pwm_set_period(int freq);

UCC git Repository :: git.ucc.asn.au