00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef INC_LPC_TMR_H
00015 #define INC_LPC_TMR_H
00016
00017
00018 typedef struct
00019 {
00020 REG32 ir;
00021 REG32 tcr;
00022 REG32 tc;
00023 REG32 pr;
00024 REG32 pc;
00025 REG32 mcr;
00026 REG32 mr0;
00027 REG32 mr1;
00028 REG32 mr2;
00029 REG32 mr3;
00030 REG32 ccr;
00031 REG32 cr0;
00032 REG32 cr1;
00033 REG32 cr2;
00034 REG32 cr3;
00035 REG32 emr;
00036 REG32 mr4;
00037 REG32 mr5;
00038 REG32 mr6;
00039 REG32 pcr;
00040 REG32 ler;
00041 } pwmTmrRegs_t;
00042
00043
00044 #define TIR_MR0I (1 << 0) // Interrupt flag for match channel 0
00045 #define TIR_MR1I (1 << 1) // Interrupt flag for match channel 1
00046 #define TIR_MR2I (1 << 2) // Interrupt flag for match channel 2
00047 #define TIR_MR3I (1 << 3) // Interrupt flag for match channel 3
00048 #define TIR_CR0I (1 << 4) // Interrupt flag for capture channel 0 event
00049 #define TIR_CR1I (1 << 5) // Interrupt flag for capture channel 1 event
00050 #define TIR_CR2I (1 << 6) // Interrupt flag for capture channel 2 event
00051 #define TIR_CR3I (1 << 7) // Interrupt flag for capture channel 3 event
00052
00053
00054 #define PWMIR_MR0I (1 << 0) // Interrupt flag for match channel 0
00055 #define PWMIR_MR1I (1 << 1) // Interrupt flag for match channel 1
00056 #define PWMIR_MR2I (1 << 2) // Interrupt flag for match channel 2
00057 #define PWMIR_MR3I (1 << 3) // Interrupt flag for match channel 3
00058 #define PWMIR_MR4I (1 << 8) // Interrupt flag for match channel 4
00059 #define PWMIR_MR5I (1 << 9) // Interrupt flag for match channel 5
00060 #define PWMIR_MR6I (1 << 10) // Interrupt flag for match channel 6
00061 #define PWMIR_MASK (0x070F)
00062
00063
00064 #define TCR_ENABLE (1 << 0)
00065 #define TCR_RESET (1 << 1)
00066
00067
00068 #define PWMCR_ENABLE (1 << 0)
00069 #define PWMCR_RESET (1 << 1)
00070
00071
00072 #define TMCR_MR0_I (1 << 0) // Enable Interrupt when MR0 matches TC
00073 #define TMCR_MR0_R (1 << 1) // Enable Reset of TC upon MR0 match
00074 #define TMCR_MR0_S (1 << 2) // Enable Stop of TC upon MR0 match
00075 #define TMCR_MR1_I (1 << 3) // Enable Interrupt when MR1 matches TC
00076 #define TMCR_MR1_R (1 << 4) // Enable Reset of TC upon MR1 match
00077 #define TMCR_MR1_S (1 << 5) // Enable Stop of TC upon MR1 match
00078 #define TMCR_MR2_I (1 << 6) // Enable Interrupt when MR2 matches TC
00079 #define TMCR_MR2_R (1 << 7) // Enable Reset of TC upon MR2 match
00080 #define TMCR_MR2_S (1 << 8) // Enable Stop of TC upon MR2 match
00081 #define TMCR_MR3_I (1 << 9) // Enable Interrupt when MR3 matches TC
00082 #define TMCR_MR3_R (1 << 10) // Enable Reset of TC upon MR3 match
00083 #define TMCR_MR3_S (1 << 11) // Enable Stop of TC upon MR3 match
00084
00085
00086 #define TCCR_CR0_R (1 << 0) // Enable Rising edge on CAPn.0 will load TC to CR0
00087 #define TCCR_CR0_F (1 << 1) // Enable Falling edge on CAPn.0 will load TC to CR0
00088 #define TCCR_CR0_I (1 << 2) // Enable Interrupt on load of CR0
00089 #define TCCR_CR1_R (1 << 3) // Enable Rising edge on CAPn.1 will load TC to CR1
00090 #define TCCR_CR1_F (1 << 4) // Enable Falling edge on CAPn.1 will load TC to CR1
00091 #define TCCR_CR1_I (1 << 5) // Enable Interrupt on load of CR1
00092 #define TCCR_CR2_R (1 << 6) // Enable Rising edge on CAPn.2 will load TC to CR2
00093 #define TCCR_CR2_F (1 << 7) // Enable Falling edge on CAPn.2 will load TC to CR2
00094 #define TCCR_CR2_I (1 << 8) // Enable Interrupt on load of CR2
00095 #define TCCR_CR3_R (1 << 9) // Enable Rising edge on CAPn.3 will load TC to CR3
00096 #define TCCR_CR3_F (1 << 10) // Enable Falling edge on CAPn.3 will load TC to CR3
00097 #define TCCR_CR3_I (1 << 11) // Enable Interrupt on load of CR3
00098
00099
00100 #define PWMSEL2 (1 << 2) // Select double edge controlled mode for PWM2 output
00101 #define PWMSEL3 (1 << 3) // Select double edge controlled mode for PWM3 output
00102 #define PWMSEL4 (1 << 4) // Select double edge controlled mode for PWM3 output
00103 #define PWMSEL5 (1 << 5) // Select double edge controlled mode for PWM5 output
00104 #define PWMSEL6 (1 << 6) // Select double edge controlled mode for PWM6 output
00105 #define PWMENA1 (1 << 9) // Enable PWM1 output
00106 #define PWMENA2 (1 << 10) // Enable PWM2 output
00107 #define PWMENA3 (1 << 11) // Enable PWM3 output
00108 #define PWMENA4 (1 << 12) // Enable PWM4 output
00109 #define PWMENA5 (1 << 13) // Enable PWM5 output
00110 #define PWMENA6 (1 << 14) // Enable PWM6 output
00111
00112 #endif