forgot to add the pwm code
[my-code/arm.git] / betty / pwm.h
diff --git a/betty/pwm.h b/betty/pwm.h
new file mode 100644 (file)
index 0000000..9d1903f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * pwm.h - arm pwm interface header file
+ *
+ * author: hackbard@hackdaworld.org
+ *
+ */
+
+#ifndef PWM_H
+#define PWM_H
+
+#include "lpc2xxx.h"
+#include "types.h"
+
+/* macros */
+#define pwm_enable PWMTCR=0x0b
+
+/* defines */
+#define PWM_SINGLE_EDGE                0x00
+#define PWM_DOUBLE_EDGE                0x01
+
+#define PWM_MATCH_INTERRUPT    0x01
+#define PWM_MATCH_RESET                0x02
+#define PWM_MATCH_STOP         0x04
+
+#define PWM_SET                        0x00
+#define PWM_INVALID_CHAN       0x01
+#define PWM_STUPID             0x02
+
+#define PWM_CHAN0              0
+#define PWM_CHAN1              1
+#define PWM_CHAN2              2
+#define PWM_CHAN3              3
+#define PWM_CHAN4              4
+#define PWM_CHAN5              5
+#define PWM_CHAN6              6
+
+/* function prototypes */
+
+void pwm_set_rate_and_prescaler(u32 rate,u32 prescaler);
+int pwm_config(u8 pwmchan,u8 mode,u32 val1,u32 val2);
+int pwm_update_match(u8 pwmchan,u8 mode,u32 val1,u32 val2);
+void pwm_match_ctrl_config(u8 matchreg,u8 ctrl);
+
+#endif