9d1903f82b30018f206a37632c584915c62f3e0c
[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=0x0b
16
17 /* defines */
18 #define PWM_SINGLE_EDGE         0x00
19 #define PWM_DOUBLE_EDGE         0x01
20
21 #define PWM_MATCH_INTERRUPT     0x01
22 #define PWM_MATCH_RESET         0x02
23 #define PWM_MATCH_STOP          0x04
24
25 #define PWM_SET                 0x00
26 #define PWM_INVALID_CHAN        0x01
27 #define PWM_STUPID              0x02
28
29 #define PWM_CHAN0               0
30 #define PWM_CHAN1               1
31 #define PWM_CHAN2               2
32 #define PWM_CHAN3               3
33 #define PWM_CHAN4               4
34 #define PWM_CHAN5               5
35 #define PWM_CHAN6               6
36
37 /* function prototypes */
38
39 void pwm_set_rate_and_prescaler(u32 rate,u32 prescaler);
40 int pwm_config(u8 pwmchan,u8 mode,u32 val1,u32 val2);
41 int pwm_update_match(u8 pwmchan,u8 mode,u32 val1,u32 val2);
42 void pwm_match_ctrl_config(u8 matchreg,u8 ctrl);
43
44 #endif