source: rtems/bsps/arm/lpc176x/include/bsp/timer.h @ 9964895

5
Last change on this file since 9964895 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/**
2 * @file timer.h
3 *
4 * @ingroup lpc176x
5 *
6 * @brief Timer API for the lpc176x bsp.
7 */
8
9/*
10 * Copyright (c) 2014 Taller Technologies.
11 *
12 * @author  Boretto Martin    (martin.boretto@tallertechnologies.com)
13 * @author  Diaz Marcos (marcos.diaz@tallertechnologies.com)
14 * @author  Lenarduzzi Federico  (federico.lenarduzzi@tallertechnologies.com)
15 * @author  Daniel Chicco  (daniel.chicco@tallertechnologies.com)
16 *
17 * The license and distribution terms for this file may be
18 * found in the file LICENSE in this distribution or at
19 * http://www.rtems.org/license/LICENSE.
20 */
21
22#ifndef LIBBSP_ARM_LPC176X_TIMER_H
23#define LIBBSP_ARM_LPC176X_TIMER_H
24
25#include <bsp/timer-defs.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif /* __cplusplus */
30
31/**
32 * @brief resets timer counter and stops it.
33 *
34 * @param tnumber the device to be reseted
35 * @return RTEMS_SUCCESSFUL if the timer was reseted successfuly.
36 */
37rtems_status_code lpc176x_timer_reset( lpc176x_timer_number tnumber );
38
39/**
40 * @brief Sets mode of the timer (timer, counter rising, counter falling
41 *        or counter both edges)
42 *
43 * @param tnumber: the device to be setted
44 * @param mode: the desired mode
45 * @return RTEMS_SUCCESSFUL if the timer's mode was setted successfuly.
46 */
47rtems_status_code lpc176x_timer_set_mode(
48  lpc176x_timer_number tnumber,
49  lpc176x_timer_mode   mode
50);
51
52/**
53 * @brief Starts the timer counter
54 *
55 * @param tnumber: the device to be started
56 * @return RTEMS_SUCCESSFUL if the timer's was started successfuly.
57 */
58rtems_status_code lpc176x_timer_start( lpc176x_timer_number tnumber );
59
60/**
61 * @brief true if timer is started.
62 *
63 * @param tnumber: the timer number to check.
64 * @param is_started: TRUE if the timer is running.
65 * @return RTEMS_SUCCESSFUL if the started timer check was successfuly.
66 */
67rtems_status_code lpc176x_timer_is_started(
68  lpc176x_timer_number tnumber,
69  bool                *is_started
70);
71
72/**
73 * @brief sets the resolution in microseconds of the timer
74 *
75 * @param tnumber: the device to be modified.
76 * @param resolution: how many microseconds will mean each timer
77 *                    counter unit.
78 * @return RTEMS_SUCCESSFUL if the timer resolution was setted successfuly.
79 */
80rtems_status_code lpc176x_timer_set_resolution(
81  lpc176x_timer_number tnumber,
82  lpc176x_microseconds resolution
83);
84
85/**
86 * @brief Configures the timer match
87 *
88 * @param tnumber: the device to be modified
89 * @param match_port: which port of this timer will be setted
90 * @param function: what the timer should do when match: stop timer, clear,
91 *                  and/or interrupt
92 * @param match_value: the value that the timer should match.
93 * @return RTEMS_SUCCESSFUL if the timer was configured successfuly.
94 */
95rtems_status_code lpc176x_timer_match_config(
96  lpc176x_timer_number   tnumber,
97  lpc176x_match_port     match_port,
98  lpc176x_match_function function,
99  uint32_t               match_value
100);
101
102/**
103 * @brief Configures the capture ports
104 *
105 * @param tnumber: the device to be modified
106 * @param capture_port: which port of this timer will be setted
107 * @param function: At which edge/s will the capture work, and
108 *                  if it will interrupt
109 */
110rtems_status_code lpc176x_timer_capture_config(
111  lpc176x_timer_number     tnumber,
112  lpc176x_capture_port     capture_port,
113  lpc176x_capture_function function
114);
115
116/**
117 * @brief Configures the external match ports
118 *
119 * @param tnumber: the device to be modified
120 * @param match_port: which match for this timer
121 * @param function: what should do when match: set, clear toggle or nothing
122 */
123rtems_status_code lpc176x_timer_external_match_config(
124  lpc176x_timer_number       tnumber,
125  lpc176x_match_port         match_port,
126  lpc176x_ext_match_function function
127);
128
129/**
130 * @brief Gets the captured value
131 *
132 * @param tnumber: the device to be modified
133 * @param capnumber: which capture port for this timer
134 * @return the captured value
135 */
136uint32_t lpc176x_timer_get_capvalue(
137  lpc176x_timer_number tnumber,
138  lpc176x_capture_port capnumber
139);
140
141/**
142 * @brief Gets the timer value
143 *
144 * @param tnumber: the device
145 * @return the timer value
146 */
147uint32_t lpc176x_timer_get_timer_value( lpc176x_timer_number tnumber );
148
149/**
150 * @brief Sets the timer value
151 *
152 * @param tnumber: the timer to modify.
153 * @param timer_value the value to set.
154 */
155rtems_status_code lpc176x_timer_set_timer_value(
156  lpc176x_timer_number tnumber,
157  uint32_t             lpc176x_timer_value
158);
159
160/**
161 * @brief Timer generic isroutine.
162 *
163 * @param timernumber the number of timer.
164 */
165void lpc176x_timer_isr( void *lpc176x_timer_number );
166
167/**
168 * @brief Initializes timer in timer mode and resets counter but
169 *        without starting it, and without any capture or
170 *        match function.
171 *
172 * @param tnumber which timer
173 * @return RTEMS_SUCCESSFUL when everything ok.
174 */
175rtems_status_code lpc176x_timer_init( lpc176x_timer_number tnumber );
176
177/**
178 * @brief Initializes timer in timer mode and resets counter but
179 *        without starting it, and without any capture or
180 *        match function.
181 *
182 * @param tnumber which timer to init
183 * @param vector the functions to be used by the isr.
184 * @return RTEMS_SUCCESSFUL when everything ok.
185 */
186rtems_status_code lpc176x_timer_init_with_interrupt(
187  lpc176x_timer_number            tnumber,
188  const lpc176x_isr_funct_vector *vector
189);
190
191#ifdef __cplusplus
192}
193#endif /* __cplusplus */
194
195#endif /* LIBBSP_ARM_LPC176X_TIMER_H */
Note: See TracBrowser for help on using the repository browser.