1 | /*
|
---|
2 | * Copyright (c) 2012 Maurizio Lombardi
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 | /** @addtogroup genarch
|
---|
29 | * @{
|
---|
30 | */
|
---|
31 | /**
|
---|
32 | * @file
|
---|
33 | * @brief Texas Instruments AM335x timer driver.
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef _KERN_AM335X_TIMER_H_
|
---|
37 | #define _KERN_AM335X_TIMER_H_
|
---|
38 |
|
---|
39 | #include "timer_regs.h"
|
---|
40 |
|
---|
41 | #define AM335x_DMTIMER0_BASE_ADDRESS 0x44E05000
|
---|
42 | #define AM335x_DMTIMER0_SIZE 4096
|
---|
43 | #define AM335x_DMTIMER0_IRQ 66
|
---|
44 |
|
---|
45 | #define AM335x_DMTIMER2_BASE_ADDRESS 0x48040000
|
---|
46 | #define AM335x_DMTIMER2_SIZE 4096
|
---|
47 | #define AM335x_DMTIMER2_IRQ 68
|
---|
48 |
|
---|
49 | #define AM335x_DMTIMER3_BASE_ADDRESS 0x48042000
|
---|
50 | #define AM335x_DMTIMER3_SIZE 4096
|
---|
51 | #define AM335x_DMTIMER3_IRQ 69
|
---|
52 |
|
---|
53 | #define AM335x_DMTIMER4_BASE_ADDRESS 0x48044000
|
---|
54 | #define AM335x_DMTIMER4_SIZE 4096
|
---|
55 | #define AM335x_DMTIMER4_IRQ 92
|
---|
56 |
|
---|
57 | #define AM335x_DMTIMER5_BASE_ADDRESS 0x48046000
|
---|
58 | #define AM335x_DMTIMER5_SIZE 4096
|
---|
59 | #define AM335x_DMTIMER5_IRQ 93
|
---|
60 |
|
---|
61 | #define AM335x_DMTIMER6_BASE_ADDRESS 0x48048000
|
---|
62 | #define AM335x_DMTIMER6_SIZE 4096
|
---|
63 | #define AM335x_DMTIMER6_IRQ 94
|
---|
64 |
|
---|
65 | #define AM335x_DMTIMER7_BASE_ADDRESS 0x4804A000
|
---|
66 | #define AM335x_DMTIMER7_SIZE 4096
|
---|
67 | #define AM335x_DMTIMER7_IRQ 95
|
---|
68 |
|
---|
69 | typedef enum {
|
---|
70 | DMTIMER0 = 0,
|
---|
71 | DMTIMER1_1MS,
|
---|
72 | DMTIMER2,
|
---|
73 | DMTIMER3,
|
---|
74 | DMTIMER4,
|
---|
75 | DMTIMER5,
|
---|
76 | DMTIMER6,
|
---|
77 | DMTIMER7,
|
---|
78 |
|
---|
79 | TIMERS_MAX
|
---|
80 | } am335x_timer_id_t;
|
---|
81 |
|
---|
82 | typedef struct am335x_timer {
|
---|
83 | am335x_timer_regs_t *regs;
|
---|
84 | am335x_timer_id_t id;
|
---|
85 | } am335x_timer_t;
|
---|
86 |
|
---|
87 | extern void am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id,
|
---|
88 | unsigned hz);
|
---|
89 | extern void am335x_timer_intr_ack(am335x_timer_t *timer);
|
---|
90 | extern void am335x_timer_reset(am335x_timer_t *timer);
|
---|
91 | extern void am335x_timer_start(am335x_timer_t *timer);
|
---|
92 | extern void am335x_timer_stop(am335x_timer_t *timer);
|
---|
93 |
|
---|
94 |
|
---|
95 | #endif
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * @}
|
---|
99 | */
|
---|
100 |
|
---|