MotorWare f2806x Driver API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

osc.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2 * Copyright (c) 2015, Texas Instruments Incorporated
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 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
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,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * --/COPYRIGHT--*/
32 #ifndef _OSC_H_
33 #define _OSC_H_
34
40
41
42 // **************************************************************************
43 // the includes
44
45 // drivers
46 #include "sw/drivers/cpu/src/32b/f28x/f2806x/cpu.h"
47
48
49 // modules
50 #include "sw/modules/types/src/types.h"
51
56
57
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63
64 // **************************************************************************
65 // the defines
66
67
70 #define OSC_BASE_ADDR (0x00007014)
71
72
75 #define OSC_INTOSCnTRIM_COARSE_BITS (255 << 0)
76
79 #define OSC_INTOSCnTRIM_FINE_BITS (63 << 9)
80
81
82 // **************************************************************************
83 // the typedefs
84
85
88 typedef enum
89 {
90 OSC_Src_Internal=(0 << 0),
91 OSC_Src_External=(1 << 0)
92 } OSC_Src_e;
93
94
97 typedef enum
98 {
99 OSC_Osc2Src_Internal=(0 << 1),
100 OSC_Osc2Src_External=(1 << 1)
101 } OSC_Osc2Src_e;
102
103
106 typedef enum
107 {
108 OSC_Number_1=1,
109 OSC_Number_2
110 } OSC_Number_e;
111
112
115 typedef struct _OSC_Obj_
116 {
117 volatile uint16_t INTOSC1TRIM;
118 volatile uint16_t rsvd_1;
119 volatile uint16_t INTOSC2TRIM;
120 } OSC_Obj;
121
122
125 typedef struct _OSC_Obj_ *OSC_Handle;
126
127
128 // **************************************************************************
129 // the globals
130
131
132 // **************************************************************************
133 // the function prototypes
134
135
136
141 extern OSC_Handle OSC_init(void *pMemory,const size_t numBytes);
142
143
148 extern void OSC_setCoarseTrim(OSC_Handle clkHandle,
149 const OSC_Number_e oscNumber,
150 const uint_least8_t trimValue);
151
152
157 extern void OSC_setFineTrim(OSC_Handle clkHandle,
158 const OSC_Number_e oscNumber,
159 const uint_least8_t trimValue);
160
161
166 extern void OSC_setTrim(OSC_Handle clkHandle,
167 const OSC_Number_e oscNumber,
168 const uint16_t trimValue);
169
170
171 #ifdef __cplusplus
172 }
173 #endif // extern "C"
174
176 #endif // end of _OSC_H_ definition
177
OSC_init
OSC_Handle OSC_init(void *pMemory, const size_t numBytes)
Initializes the oscillator (OSC) handle.
Definition: osc.c:57
OSC_Handle
struct _OSC_Obj_ * OSC_Handle
Defines the oscillator (OSC) handle.
Definition: osc.h:125
OSC_Number_2
Denotes oscillator number 2.
Definition: osc.h:109
_OSC_Obj_::INTOSC1TRIM
volatile uint16_t INTOSC1TRIM
Internal Oscillator 1 Trim Register.
Definition: osc.h:117
OSC_Src_Internal
Denotes an internal oscillator.
Definition: osc.h:90
_OSC_Obj_
Defines the oscillator (OSC) object.
Definition: osc.h:115
OSC_Src_e
OSC_Src_e
Enumeration to define the oscillator (OSC) source.
Definition: osc.h:88
OSC_setCoarseTrim
void OSC_setCoarseTrim(OSC_Handle clkHandle, const OSC_Number_e oscNumber, const uint_least8_t trimValue)
Sets the coarse trim value for a specified oscillator.
Definition: osc.c:72
OSC_Osc2Src_Internal
Denotes an internal oscillator source for oscillator 2.
Definition: osc.h:99
OSC_Osc2Src_External
Denotes an external oscillator source for oscillator 2.
Definition: osc.h:100
OSC_Osc2Src_e
OSC_Osc2Src_e
Enumeration to define the oscillator (OSC) 2 source.
Definition: osc.h:97
OSC_Number_1
Denotes oscillator number 1.
Definition: osc.h:108
OSC_setTrim
void OSC_setTrim(OSC_Handle clkHandle, const OSC_Number_e oscNumber, const uint16_t trimValue)
Sets the trim value for a specified oscillator.
Definition: osc.c:134
_OSC_Obj_::INTOSC2TRIM
volatile uint16_t INTOSC2TRIM
Internal Oscillator 2 Trim Register.
Definition: osc.h:119
OSC_setFineTrim
void OSC_setFineTrim(OSC_Handle clkHandle, const OSC_Number_e oscNumber, const uint_least8_t trimValue)
Sets the fine trim value for a specified oscillator.
Definition: osc.c:103
OSC_Number_e
OSC_Number_e
Enumeration to define the oscillator (OSC) number.
Definition: osc.h:106
cpu.h
Contains public interface to various functions related to the central processing unit (CPU) object...
OSC_Src_External
Denotes an external oscillator.
Definition: osc.h:91
_OSC_Obj_::rsvd_1
volatile uint16_t rsvd_1
Reserved.
Definition: osc.h:118
OSC_Obj
struct _OSC_Obj_ OSC_Obj
Defines the oscillator (OSC) object.