source: rtems/c/src/lib/libbsp/arm/lpc176x/include/pwmout-defs.h @ 7b35a36

4.115
Last change on this file since 7b35a36 was 7b35a36, checked in by Martin Galvan <martin.galvan@…>, on 03/11/15 at 19:57:23

Add CAN, PWM, ADC and UART1/2/3 support to the LPC176x BSP.

This patch adds support for the following devices to the LPC176x BSP:

  • CAN
  • PWM
  • ADC

It also adds the probe routines for UART1/2/3 to the console_device_table in console-config.c, and enables UART1 in configure.ac.

  • Property mode set to 100755
File size: 2.2 KB
RevLine 
[7b35a36]1/**
2 * @file pwmout-defs.h
3 *
4 * @ingroup lpc176x
5 *
6 * @brief PWM-Out controller for the mbed lpc1768 board.
7 */
8
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.com/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
26extern "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
41/**
42 * @brief The low-level PWM output device.
43 */
44typedef 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;
68} lpc176x_pwm_device;
69
70/**
71 * @brief Represents one pin and the respective function to be set
72 *  for each PWM output.
73 */
74typedef struct {
75  uint32_t pin_number;
76  lpc176x_pin_function pin_function;
77} lpc176x_pwm_pin;
78
79/**
80 * @brief The PWM outputs of the board.
81 */
82typedef enum {
83  PWMO_1,
84  PWMO_2,
85  PWMO_3,
86  PWMO_4,
87  PWMO_5,
88  PWMO_6,
89  PWM_OUTPUT_NUMBER
90} lpc176x_pwm_number;
91
92/**
93 * @brief A pin for each PWM output.
94 */
95typedef enum {
96  PWM_FIRST_PIN,
97  PWM_SECOND_PIN,
98  PWM_NUMBER_OF_PINS
99} lpc176x_pwm_pin_number;
100
101#ifdef __cplusplus
102}
103#endif /* __cplusplus */
104
105#endif
Note: See TracBrowser for help on using the repository browser.