bullshit commit, sync for travel (to zn00H!) :)
[my-code/arm.git] / betty / pwm.h
1 /*
2  * pwm.h - arm pwm interface header file
3  *
4  * author: hackbard@hackdaworld.org
5  *
6  */
7
8 #ifndef PWM_H
9 #define PWM_H
10
11 #include "lpc2xxx.h"
12 #include "types.h"
13
14 /* macros */
15 #define pwm_enable PWMTCR=0x09
16 #define pwm_reset PWMTCR=0x03
17 #define pwm_disable PWMTCR=0x00
18
19 /* defines */
20 #define PWM_SINGLE_EDGE         0x00
21 #define PWM_DOUBLE_EDGE         0x01
22
23 #define PWM_MATCH_INTERRUPT     0x01
24 #define PWM_MATCH_RESET         0x02
25 #define PWM_MATCH_STOP          0x04
26
27 #define PWM_SET                 0x00
28 #define PWM_INVALID_CHAN        0x01
29 #define PWM_STUPID              0x02
30
31 #define PWM_CHAN0               0
32 #define PWM_CHAN1               1
33 #define PWM_CHAN2               2
34 #define PWM_CHAN3               3
35 #define PWM_CHAN4               4
36 #define PWM_CHAN5               5
37 #define PWM_CHAN6               6
38
39 /* function prototypes */
40
41 void pwm_set_rate_and_prescaler(u32 rate,u32 prescaler);
42 int pwm_config(u8 pwmchan,u8 mode,u32 val1,u32 val2);
43 int pwm_update_match(u8 pwmchan,u8 mode,u32 val1,u32 val2);
44 void pwm_match_ctrl_config(u8 matchreg,u8 ctrl);
45
46 #endif