tao_z
2022-05-25 1044ba0d2286698d0da28112bffc0f114bef2134
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
  ******************************************************************************
  * @file     xl_osc.h
  * @author   software group
  * @brief    This file contains all the functions prototypes for the OSC 
  *           firmware library.
  ******************************************************************************
  * @attention
    *
  * 2019 by Chipways Communications,Inc. All Rights Reserved.
  * This software is supplied under the terms of a license
  * agreement or non-disclosure agreement with Chipways.
  * Passing on and copying of this document,and communication
  * of its contents is not permitted without prior written
  * authorization.
  *
  * <h2><center>&copy; COPYRIGHT 2019 Chipways</center></h2>
  ******************************************************************************
  */
    
    
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef XL_OSC_H_
#define XL_OSC_H_
 
#ifdef __cplusplus
extern "C" {
#endif
    
 
/* Includes ------------------------------------------------------------------*/
#include "XL6600.h"
 
/* Register define ------------------------------------------------------------*/
#define OSC_CR_OSCINIT_MASK                      0x1u
#define OSC_CR_OSCINIT_SHIFT                     0u
 
#define OSC_CR_HGO_MASK                          0x2u
#define OSC_CR_HGO_SHIFT                         1u
 
#define OSC_CR_RANGE_MASK                        0x4u
#define OSC_CR_RANGE_SHIFT                       2u
 
#define OSC_CR_OSCOS_MASK                        0x10u
#define OSC_CR_OSCOS_SHIFT                       4u
 
#define OSC_CR_OSCSTEN_MASK                      0x20u
#define OSC_CR_OSCSTEN_SHIFT                     5u
 
#define OSC_CR_OSCEN_MASK                        0x80u
#define OSC_CR_OSCEN_SHIFT                       7u
 
/* TCR Bit Fields */
#define OSC_TCR_ECLK_MASK                        0x7FFFu
#define OSC_TCR_ECLK_SHIFT                       0u
 
#define OSC_TCR_CV_MASK                          0x8000u
#define OSC_TCR_CV_SHIFT                         15u
 
/** OSC - Register Layout Typedef */
typedef struct {
  __IO uint32_t CR;                                 /*!< OSC ¿ØÖƼĴæÆ÷, offset: 0x0 */
    __IO uint32_t TCR;                                /*!< OSC À©Õ¹Ê±¼ä¿ØÖƼĴæÆ÷, offset: 0x4 */
} OSC_Type;
 
extern  OSC_Type*    OSC;
 
/** @addtogroup XL6600_StdPeriph_Driver
  * @{
  */
 
/** @addtogroup OSC 
  * @{
  */
 
/* Exported types ------------------------------------------------------------*/ 
 
/** 
  * @brief OSC³õʼ»¯½á¹¹Ì嶨Òå
  */ 
typedef struct 
{
        uint8_t   OSC_OutputSelect;                /*!< OSC Êä³öÑ¡Ôñ */
        uint8_t   OSC_RangeSelect;                 /*!< ÆµÂÊ·¶Î§Ñ¡Ôñ */
        uint8_t   OSC_ModeSelect;                  /*!< ¸ßÔöÒæÕñµ´Æ÷Ñ¡Ôñ */
    
}OSC_InitTypeDef;
 
/** @defgroup OSC_Exported_Constants OSCÄ£¿éʹÓòÎÊý¶¨Òå
  * @{
  */
 
/** @defgroup OSC_OutSelect OSCÊä³öÑ¡Ôñ
  * @{
  */
#define OSC_EXTERNAL_COLOCK                                  ((uint8_t)0x00)   /*!< Ñ¡ÔñÍⲿʱÖÓÔ´        */
#define OSC_OSCCILLATOR_COLOR                              ((uint8_t)0x10)   /*!< Ñ¡ÔñOSCʱÖÓÔ´ */
/**
  * @}
  */
 
/** @defgroup OSC_RangeSelect OSCƵÂÊ·¶Î§Ñ¡Ôñ
  * @{
  */
#define OSC_RANGE_LOW                                           ((uint8_t)0x00)   /*!< 32kHz */
#define OSC_RANGE_HIGH                                             ((uint8_t)0x04)   /*!< 4 to 24MHz */
/**
  * @}
  */
/** @defgroup OSC_WorkMode OSC¹¤×÷ģʽ
  * @{
  */
#define OSC_LP_MODE                                                  ((uint8_t)0x00)   /*!< µÍ¹¦ºÄģʽ */
#define OSC_HG_MODE                                                    ((uint8_t)0x02)   /*!< ¸ßÔöÒæÄ£Ê½ */
/**
  * @}
  */    
 
/** @defgroup OSC_InitResult OSC³õʼ»¯½á¹û
  * @{
  */
#define OSC_INITSTATUS_FAILED                                ((uint8_t)0x00)       /*!< OSC ³õʼ»¯Ê§°Ü      */
#define OSC_INITSTATUS_SUCESS                                ((uint8_t)0x01)       /*!< OSC ³õʼ»¯³É¹¦      */
 
/**
* @}
*/
 
/**
* @}
*/
 
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/ 
void OSC_Deinit(void);
void OSC_Init(const OSC_InitTypeDef *OSC_InitStruct);
void OSC_EnableCmd(FunctionalState State);
void OSC_ModuleInStopModeCmd(FunctionalState NewState);
void OSC_SetExtTime(uint32_t ExpTime);
uint8_t OSC_GetInitStatus(void);
uint8_t OSC_GetRange(void);
 
#ifdef __cplusplus
}
#endif        
    
#endif   /*__XL_OSC_H__ */
/**
* @}
*/
 
/**
* @}
*/