RTEMS  5.1
pwmout-defs.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2014 Taller Technologies.
11  *
12  * @author Diaz Marcos (marcos.diaz@tallertechnologies.com)
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #ifndef LPC176X_PWMOUT_DEFS_H
20 #define LPC176X_PWMOUT_DEFS_H
21 
22 #include <bsp/lpc176x.h>
23 #include <bsp/pwmout.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 
29 #define PWM_DEFAULT_PERIOD 20000u
30 #define PWM_DEFAULT_PULSEWIDTH 0u
31 
32 #define PWM_PRESCALER_USECOND ( LPC176X_CCLK / 1000000 )
33 #define PWM_MCR_RESET_ON_MATCH0 ( 1 << 1 )
34 #define PWM_PCR_ENABLE_PWM( pwmout ) ( 1 << ( 9 + pwmout ) )
35 #define PWM_TCR_RESET ( 1 << 1 )
36 #define PWM_TCR_ENABLE ( 1u )
37 #define PWM_TCR_PWM ( 1 << 3 )
38 #define PWM_LER_LATCH_MATCH_0 1u
39 #define PWM_LER_LATCH( match ) ( 1 << ( ( match ) + 1 ) )
40 
44 typedef struct {
45  volatile uint32_t IR;
46  volatile uint32_t TCR;
47  volatile uint32_t TC;
48  volatile uint32_t PR;
49  volatile uint32_t PC;
50  volatile uint32_t MCR;
51  volatile uint32_t MR0;
52  volatile uint32_t MR1;
53  volatile uint32_t MR2;
54  volatile uint32_t MR3;
55  volatile uint32_t CCR;
56  volatile uint32_t CR0;
57  volatile uint32_t CR1;
58  volatile uint32_t CR2;
59  volatile uint32_t CR3;
60  volatile uint32_t RESERVED0;
61  volatile uint32_t MR4;
62  volatile uint32_t MR5;
63  volatile uint32_t MR6;
64  volatile uint32_t PCR;
65  volatile uint32_t LER;
66  volatile uint32_t RESERVED1[ 7 ];
67  volatile uint32_t CTCR;
69 
74 typedef struct {
75  uint32_t pin_number;
76  lpc176x_pin_function pin_function;
78 
82 typedef enum {
83  PWMO_1,
84  PWMO_2,
85  PWMO_3,
86  PWMO_4,
87  PWMO_5,
88  PWMO_6,
89  PWM_OUTPUT_NUMBER
91 
95 typedef enum {
96  PWM_FIRST_PIN,
97  PWM_SECOND_PIN,
98  PWM_NUMBER_OF_PINS
100 
101 #ifdef __cplusplus
102 }
103 #endif /* __cplusplus */
104 
105 #endif
#define TCR
tx configuration reg
Definition: wd80x3.h:99
Definition: hexdump.h:39
lpc176x_pwm_pin_number
A pin for each PWM output.
Definition: pwmout-defs.h:95
lpc176x_pin_function
Defines the functions according to the pin.
Definition: io-defs.h:68
Specific register definitions according to lpc176x family boards.
Represents one pin and the respective function to be set for each PWM output.
Definition: pwmout-defs.h:74
The low-level PWM output device.
Definition: pwmout-defs.h:44
PWM-Out controller for the mbed lpc1768 board.
#define MCR
Modem Control Register.
Definition: uart.h:91
lpc176x_pwm_number
The PWM outputs of the board.
Definition: pwmout-defs.h:82