summaryrefslogtreecommitdiffstats
path: root/bsps/arm/lpc176x/include/bsp/timer.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-12-23 18:18:56 +1100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-01-25 08:45:26 +0100
commit2afb22b7e1ebcbe40373ff7e0efae7d207c655a9 (patch)
tree44759efe9374f13200a97e96d91bd9a2b7e5ce2a /bsps/arm/lpc176x/include/bsp/timer.h
parentMAINTAINERS: Add myself to Write After Approval. (diff)
downloadrtems-2afb22b7e1ebcbe40373ff7e0efae7d207c655a9.tar.bz2
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.
Diffstat (limited to 'bsps/arm/lpc176x/include/bsp/timer.h')
-rw-r--r--bsps/arm/lpc176x/include/bsp/timer.h195
1 files changed, 195 insertions, 0 deletions
diff --git a/bsps/arm/lpc176x/include/bsp/timer.h b/bsps/arm/lpc176x/include/bsp/timer.h
new file mode 100644
index 0000000000..6805b55f0e
--- /dev/null
+++ b/bsps/arm/lpc176x/include/bsp/timer.h
@@ -0,0 +1,195 @@
+/**
+ * @file timer.h
+ *
+ * @ingroup lpc176x
+ *
+ * @brief Timer API for the lpc176x bsp.
+ */
+
+/*
+ * Copyright (c) 2014 Taller Technologies.
+ *
+ * @author Boretto Martin (martin.boretto@tallertechnologies.com)
+ * @author Diaz Marcos (marcos.diaz@tallertechnologies.com)
+ * @author Lenarduzzi Federico (federico.lenarduzzi@tallertechnologies.com)
+ * @author Daniel Chicco (daniel.chicco@tallertechnologies.com)
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef LIBBSP_ARM_LPC176X_TIMER_H
+#define LIBBSP_ARM_LPC176X_TIMER_H
+
+#include <bsp/timer-defs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief resets timer counter and stops it.
+ *
+ * @param tnumber the device to be reseted
+ * @return RTEMS_SUCCESSFUL if the timer was reseted successfuly.
+ */
+rtems_status_code lpc176x_timer_reset( lpc176x_timer_number tnumber );
+
+/**
+ * @brief Sets mode of the timer (timer, counter rising, counter falling
+ * or counter both edges)
+ *
+ * @param tnumber: the device to be setted
+ * @param mode: the desired mode
+ * @return RTEMS_SUCCESSFUL if the timer's mode was setted successfuly.
+ */
+rtems_status_code lpc176x_timer_set_mode(
+ lpc176x_timer_number tnumber,
+ lpc176x_timer_mode mode
+);
+
+/**
+ * @brief Starts the timer counter
+ *
+ * @param tnumber: the device to be started
+ * @return RTEMS_SUCCESSFUL if the timer's was started successfuly.
+ */
+rtems_status_code lpc176x_timer_start( lpc176x_timer_number tnumber );
+
+/**
+ * @brief true if timer is started.
+ *
+ * @param tnumber: the timer number to check.
+ * @param is_started: TRUE if the timer is running.
+ * @return RTEMS_SUCCESSFUL if the started timer check was successfuly.
+ */
+rtems_status_code lpc176x_timer_is_started(
+ lpc176x_timer_number tnumber,
+ bool *is_started
+);
+
+/**
+ * @brief sets the resolution in microseconds of the timer
+ *
+ * @param tnumber: the device to be modified.
+ * @param resolution: how many microseconds will mean each timer
+ * counter unit.
+ * @return RTEMS_SUCCESSFUL if the timer resolution was setted successfuly.
+ */
+rtems_status_code lpc176x_timer_set_resolution(
+ lpc176x_timer_number tnumber,
+ lpc176x_microseconds resolution
+);
+
+/**
+ * @brief Configures the timer match
+ *
+ * @param tnumber: the device to be modified
+ * @param match_port: which port of this timer will be setted
+ * @param function: what the timer should do when match: stop timer, clear,
+ * and/or interrupt
+ * @param match_value: the value that the timer should match.
+ * @return RTEMS_SUCCESSFUL if the timer was configured successfuly.
+ */
+rtems_status_code lpc176x_timer_match_config(
+ lpc176x_timer_number tnumber,
+ lpc176x_match_port match_port,
+ lpc176x_match_function function,
+ uint32_t match_value
+);
+
+/**
+ * @brief Configures the capture ports
+ *
+ * @param tnumber: the device to be modified
+ * @param capture_port: which port of this timer will be setted
+ * @param function: At which edge/s will the capture work, and
+ * if it will interrupt
+ */
+rtems_status_code lpc176x_timer_capture_config(
+ lpc176x_timer_number tnumber,
+ lpc176x_capture_port capture_port,
+ lpc176x_capture_function function
+);
+
+/**
+ * @brief Configures the external match ports
+ *
+ * @param tnumber: the device to be modified
+ * @param match_port: which match for this timer
+ * @param function: what should do when match: set, clear toggle or nothing
+ */
+rtems_status_code lpc176x_timer_external_match_config(
+ lpc176x_timer_number tnumber,
+ lpc176x_match_port match_port,
+ lpc176x_ext_match_function function
+);
+
+/**
+ * @brief Gets the captured value
+ *
+ * @param tnumber: the device to be modified
+ * @param capnumber: which capture port for this timer
+ * @return the captured value
+ */
+uint32_t lpc176x_timer_get_capvalue(
+ lpc176x_timer_number tnumber,
+ lpc176x_capture_port capnumber
+);
+
+/**
+ * @brief Gets the timer value
+ *
+ * @param tnumber: the device
+ * @return the timer value
+ */
+uint32_t lpc176x_timer_get_timer_value( lpc176x_timer_number tnumber );
+
+/**
+ * @brief Sets the timer value
+ *
+ * @param tnumber: the timer to modify.
+ * @param timer_value the value to set.
+ */
+rtems_status_code lpc176x_timer_set_timer_value(
+ lpc176x_timer_number tnumber,
+ uint32_t lpc176x_timer_value
+);
+
+/**
+ * @brief Timer generic isroutine.
+ *
+ * @param timernumber the number of timer.
+ */
+void lpc176x_timer_isr( void *lpc176x_timer_number );
+
+/**
+ * @brief Initializes timer in timer mode and resets counter but
+ * without starting it, and without any capture or
+ * match function.
+ *
+ * @param tnumber which timer
+ * @return RTEMS_SUCCESSFUL when everything ok.
+ */
+rtems_status_code lpc176x_timer_init( lpc176x_timer_number tnumber );
+
+/**
+ * @brief Initializes timer in timer mode and resets counter but
+ * without starting it, and without any capture or
+ * match function.
+ *
+ * @param tnumber which timer to init
+ * @param vector the functions to be used by the isr.
+ * @return RTEMS_SUCCESSFUL when everything ok.
+ */
+rtems_status_code lpc176x_timer_init_with_interrupt(
+ lpc176x_timer_number tnumber,
+ const lpc176x_isr_funct_vector *vector
+);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_ARM_LPC176X_TIMER_H */ \ No newline at end of file