1 //###########################################################################
2 //
3 // FILE:    F2837xD_cputimer.h
4 //
5 // TITLE:   CPUTIMER Register Definitions.
6 //
7 //###########################################################################
8 // $TI Release: F2837xD Support Library v3.05.00.00 $
9 // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
10 // $Copyright:
11 // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
12 //
13 // Redistribution and use in source and binary forms, with or without
14 // modification, are permitted provided that the following conditions
15 // are met:
16 //
17 //   Redistributions of source code must retain the above copyright
18 //   notice, this list of conditions and the following disclaimer.
19 //
20 //   Redistributions in binary form must reproduce the above copyright
21 //   notice, this list of conditions and the following disclaimer in the
22 //   documentation and/or other materials provided with the
23 //   distribution.
24 //
25 //   Neither the name of Texas Instruments Incorporated nor the names of
26 //   its contributors may be used to endorse or promote products derived
27 //   from this software without specific prior written permission.
28 //
29 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 // $
41 //###########################################################################
42 
43 #ifndef __F2837xD_CPUTIMER_H__
44 #define __F2837xD_CPUTIMER_H__
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 
51 //---------------------------------------------------------------------------
52 // CPUTIMER Individual Register Bit Definitions:
53 
54 struct TIM_BITS {                       // bits description
55     Uint16 LSW:16;                      // 15:0 CPU-Timer Counter Registers
56     Uint16 MSW:16;                      // 31:16 CPU-Timer Counter Registers High
57 };
58 
59 union TIM_REG {
60     Uint32  all;
61     struct  TIM_BITS  bit;
62 };
63 
64 struct PRD_BITS {                       // bits description
65     Uint16 LSW:16;                      // 15:0 CPU-Timer Period Registers
66     Uint16 MSW:16;                      // 31:16 CPU-Timer Period Registers High
67 };
68 
69 union PRD_REG {
70     Uint32  all;
71     struct  PRD_BITS  bit;
72 };
73 
74 struct TCR_BITS {                       // bits description
75     Uint16 rsvd1:4;                     // 3:0 Reserved
76     Uint16 TSS:1;                       // 4 CPU-Timer stop status bit.
77     Uint16 TRB:1;                       // 5 Timer reload
78     Uint16 rsvd2:4;                     // 9:6 Reserved
79     Uint16 SOFT:1;                      // 10 Emulation modes
80     Uint16 FREE:1;                      // 11 Emulation modes
81     Uint16 rsvd3:2;                     // 13:12 Reserved
82     Uint16 TIE:1;                       // 14 CPU-Timer Interrupt Enable.
83     Uint16 TIF:1;                       // 15 CPU-Timer Interrupt Flag.
84 };
85 
86 union TCR_REG {
87     Uint16  all;
88     struct  TCR_BITS  bit;
89 };
90 
91 struct TPR_BITS {                       // bits description
92     Uint16 TDDR:8;                      // 7:0 CPU-Timer Divide-Down.
93     Uint16 PSC:8;                       // 15:8 CPU-Timer Prescale Counter.
94 };
95 
96 union TPR_REG {
97     Uint16  all;
98     struct  TPR_BITS  bit;
99 };
100 
101 struct TPRH_BITS {                      // bits description
102     Uint16 TDDRH:8;                     // 7:0 CPU-Timer Divide-Down.
103     Uint16 PSCH:8;                      // 15:8 CPU-Timer Prescale Counter.
104 };
105 
106 union TPRH_REG {
107     Uint16  all;
108     struct  TPRH_BITS  bit;
109 };
110 
111 struct CPUTIMER_REGS {
112     union   TIM_REG                          TIM;                          // CPU-Timer, Counter Register
113     union   PRD_REG                          PRD;                          // CPU-Timer, Period Register
114     union   TCR_REG                          TCR;                          // CPU-Timer, Control Register
115     Uint16                                   rsvd1;                        // Reserved
116     union   TPR_REG                          TPR;                          // CPU-Timer, Prescale Register
117     union   TPRH_REG                         TPRH;                         // CPU-Timer, Prescale Register High
118 };
119 
120 //---------------------------------------------------------------------------
121 // CPUTIMER External References & Function Declarations:
122 //
123 #ifdef CPU1
124 extern volatile struct CPUTIMER_REGS CpuTimer0Regs;
125 extern volatile struct CPUTIMER_REGS CpuTimer1Regs;
126 extern volatile struct CPUTIMER_REGS CpuTimer2Regs;
127 #endif
128 #ifdef CPU2
129 extern volatile struct CPUTIMER_REGS CpuTimer0Regs;
130 extern volatile struct CPUTIMER_REGS CpuTimer1Regs;
131 extern volatile struct CPUTIMER_REGS CpuTimer2Regs;
132 #endif
133 #ifdef __cplusplus
134 }
135 #endif                                  /* extern "C" */
136 
137 #endif
138 
139 //===========================================================================
140 // End of file.
141 //===========================================================================
142