1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @brief Header file for timer functions. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2008 embedded brains GmbH & Co. KG |
---|
11 | * Redistribution and use in source and binary forms, with or without |
---|
12 | * modification, are permitted provided that the following conditions |
---|
13 | * are met: |
---|
14 | * 1. Redistributions of source code must retain the above copyright |
---|
15 | * notice, this list of conditions and the following disclaimer. |
---|
16 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
17 | * notice, this list of conditions and the following disclaimer in the |
---|
18 | * documentation and/or other materials provided with the distribution. |
---|
19 | * |
---|
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
30 | * POSSIBILITY OF SUCH DAMAGE. |
---|
31 | */ |
---|
32 | |
---|
33 | #ifndef LIBBSP_POWERPC_MPC83XX_TIMER_H |
---|
34 | #define LIBBSP_POWERPC_MPC83XX_TIMER_H |
---|
35 | |
---|
36 | #include <stdint.h> |
---|
37 | #include <stdbool.h> |
---|
38 | |
---|
39 | #include <rtems.h> |
---|
40 | |
---|
41 | #define MPC83XX_GTM_NUMBER 8 |
---|
42 | |
---|
43 | #define MPC83XX_GTM_CLOCK_CASCADED 0x0000 |
---|
44 | #define MPC83XX_GTM_CLOCK_SYSTEM 0x0002 |
---|
45 | #define MPC83XX_GTM_CLOCK_SYSTEM_SLOW 0x0004 |
---|
46 | #define MPC83XX_GTM_CLOCK_EXTERN 0x0006 |
---|
47 | |
---|
48 | rtems_status_code mpc83xx_gtm_initialize( int timer, int clock); |
---|
49 | |
---|
50 | rtems_status_code mpc83xx_gtm_enable_restart( int timer, bool enable); |
---|
51 | |
---|
52 | rtems_status_code mpc83xx_gtm_set_clock( int timer, int clock); |
---|
53 | |
---|
54 | rtems_status_code mpc83xx_gtm_get_clock( int timer, int *clock); |
---|
55 | |
---|
56 | rtems_status_code mpc83xx_gtm_start( int timer); |
---|
57 | |
---|
58 | rtems_status_code mpc83xx_gtm_stop( int timer); |
---|
59 | |
---|
60 | rtems_status_code mpc83xx_gtm_set_value( int timer, uint16_t value); |
---|
61 | |
---|
62 | rtems_status_code mpc83xx_gtm_get_value( int timer, uint16_t *value); |
---|
63 | |
---|
64 | rtems_status_code mpc83xx_gtm_set_reference( int timer, uint16_t reference); |
---|
65 | |
---|
66 | rtems_status_code mpc83xx_gtm_get_reference( int timer, uint16_t *reference); |
---|
67 | |
---|
68 | rtems_status_code mpc83xx_gtm_set_prescale( int timer, uint8_t prescale); |
---|
69 | |
---|
70 | rtems_status_code mpc83xx_gtm_get_prescale( int timer, uint8_t *prescale); |
---|
71 | |
---|
72 | rtems_status_code mpc83xx_gtm_interrupt_get_vector( int timer, rtems_vector_number *vector); |
---|
73 | |
---|
74 | rtems_status_code mpc83xx_gtm_interrupt_enable( int timer); |
---|
75 | |
---|
76 | rtems_status_code mpc83xx_gtm_interrupt_disable( int timer); |
---|
77 | |
---|
78 | rtems_status_code mpc83xx_gtm_interrupt_clear( int timer); |
---|
79 | |
---|
80 | #endif /* LIBBSP_POWERPC_MPC83XX_TIMER_H */ |
---|