Skip to content

Commit 0a063a0

Browse files
Merge pull request #4840 from ganesh-ramachandran/master
Add Support for TOSHIBA TMPM066 board
2 parents dd0a0fc + f79216c commit 0a063a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+13198
-0
lines changed
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
/**
2+
*******************************************************************************
3+
* @file tmpm066_adc.h
4+
* @brief This file provides all the functions prototypes for ADC driver.
5+
* @version V2.0.2.1
6+
* @date 2015/10/09
7+
*
8+
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
9+
*******************************************************************************
10+
*/
11+
12+
/* Define to prevent recursive inclusion -------------------------------------*/
13+
#ifndef __TMPM066_ADC_H
14+
#define __TMPM066_ADC_H
15+
16+
#ifdef __cplusplus
17+
extern "C" {
18+
#endif
19+
20+
/* Includes ------------------------------------------------------------------*/
21+
#include "TMPM066.h"
22+
#include "tx00_common.h"
23+
24+
#if defined(__TMPM066_ADC_H)
25+
26+
/** @addtogroup TX00_Periph_Driver
27+
* @{
28+
*/
29+
30+
/** @addtogroup ADC
31+
* @{
32+
*/
33+
34+
/** @defgroup ADC_Exported_Types
35+
* @{
36+
*/
37+
38+
#define ADC_CONVERSION_35_CLOCK ((uint32_t)0x00000000) /* 35.5 conversion clock */
39+
#define ADC_CONVERSION_42_CLOCK ((uint32_t)0x00000040) /* 42 conversion clock */
40+
#define ADC_CONVERSION_68_CLOCK ((uint32_t)0x00000080) /* 68 conversion clock */
41+
#define ADC_CONVERSION_81_CLOCK ((uint32_t)0x000000C0) /* 81 conversion clock */
42+
#define IS_ADC_CONVERSION_TIME(param) (((param) == ADC_CONVERSION_35_CLOCK) || \
43+
((param) == ADC_CONVERSION_42_CLOCK) || \
44+
((param) == ADC_CONVERSION_68_CLOCK) || \
45+
((param) == ADC_CONVERSION_81_CLOCK))
46+
47+
#define ADC_FC_DIVIDE_LEVEL_1 ((uint32_t)0x00000000)
48+
#define ADC_FC_DIVIDE_LEVEL_2 ((uint32_t)0x00000001)
49+
#define ADC_FC_DIVIDE_LEVEL_4 ((uint32_t)0x00000002)
50+
#define ADC_FC_DIVIDE_LEVEL_6 ((uint32_t)0x00000008)
51+
#define ADC_FC_DIVIDE_LEVEL_8 ((uint32_t)0x00000003)
52+
#define ADC_FC_DIVIDE_LEVEL_12 ((uint32_t)0x00000009)
53+
#define ADC_FC_DIVIDE_LEVEL_16 ((uint32_t)0x00000004)
54+
#define ADC_FC_DIVIDE_LEVEL_24 ((uint32_t)0x0000000A)
55+
#define ADC_FC_DIVIDE_LEVEL_48 ((uint32_t)0x0000000B)
56+
#define ADC_FC_DIVIDE_LEVEL_96 ((uint32_t)0x0000000C)
57+
#define IS_ADC_PRESCALER(param) (((param) == ADC_FC_DIVIDE_LEVEL_1) || \
58+
((param) == ADC_FC_DIVIDE_LEVEL_2) || \
59+
((param) == ADC_FC_DIVIDE_LEVEL_4) || \
60+
((param) == ADC_FC_DIVIDE_LEVEL_6) || \
61+
((param) == ADC_FC_DIVIDE_LEVEL_8) || \
62+
((param) == ADC_FC_DIVIDE_LEVEL_12) || \
63+
((param) == ADC_FC_DIVIDE_LEVEL_16) || \
64+
((param) == ADC_FC_DIVIDE_LEVEL_24) || \
65+
((param) == ADC_FC_DIVIDE_LEVEL_48) || \
66+
((param) == ADC_FC_DIVIDE_LEVEL_96))
67+
68+
#define ADC_INT_SINGLE ((uint32_t)0x00000000)
69+
#define ADC_INT_CONVERSION_4 ((uint32_t)0x00000008)
70+
#define ADC_INT_CONVERSION_8 ((uint32_t)0x00000010)
71+
#define IS_ADC_INT_MODE(param) (((param) == ADC_INT_SINGLE) || \
72+
((param) == ADC_INT_CONVERSION_4) || \
73+
((param) == ADC_INT_CONVERSION_8))
74+
75+
#define ADC_AN_0 ((uint32_t)0x00000000)
76+
#define ADC_AN_1 ((uint32_t)0x00000001)
77+
#define ADC_AN_2 ((uint32_t)0x00000002)
78+
#define ADC_AN_3 ((uint32_t)0x00000003)
79+
#define ADC_AN_4 ((uint32_t)0x00000004)
80+
#define ADC_AN_5 ((uint32_t)0x00000005)
81+
#define ADC_AN_6 ((uint32_t)0x00000006)
82+
#define ADC_AN_7 ((uint32_t)0x00000007)
83+
84+
#define IS_ADC_INPUT_CH(param) (((param) == ADC_AN_0) || \
85+
((param) == ADC_AN_1) || \
86+
((param) == ADC_AN_2) || \
87+
((param) == ADC_AN_3) || \
88+
((param) == ADC_AN_4) || \
89+
((param) == ADC_AN_5) || \
90+
((param) == ADC_AN_6) || \
91+
((param) == ADC_AN_7))
92+
93+
94+
#define ADC_CMP_0 ((uint8_t)0x00)
95+
#define ADC_CMP_1 ((uint8_t)0x01)
96+
#define IS_ADC_CMP(param) (((param) == ADC_CMP_0) || \
97+
((param) == ADC_CMP_1))
98+
99+
#define ADC_REG_0 ((uint32_t)0x00000000)
100+
#define ADC_REG_1 ((uint32_t)0x00000001)
101+
#define ADC_REG_2 ((uint32_t)0x00000002)
102+
#define ADC_REG_3 ((uint32_t)0x00000003)
103+
#define ADC_REG_4 ((uint32_t)0x00000004)
104+
#define ADC_REG_5 ((uint32_t)0x00000005)
105+
#define ADC_REG_6 ((uint32_t)0x00000006)
106+
#define ADC_REG_7 ((uint32_t)0x00000007)
107+
#define ADC_REG_SP ((uint32_t)0x00000008)
108+
#define IS_ADC_REG(param) ((param) <= ADC_REG_SP)
109+
110+
#define IS_ADC_RESULT_CMP_REG(param) ((param) <= ADC_REG_SP)
111+
112+
#define ADC_EXT_TRG ((uint32_t)0x00000000)
113+
#define ADC_MATCH_TB_0 ((uint32_t)0x00000020)
114+
#define IS_ADC_HW_TRG_NORMAL(param) (((param) == ADC_EXT_TRG) || \
115+
((param) == ADC_MATCH_TB_0))
116+
117+
#define ADC_MATCH_TB_1 ((uint32_t)0x00000080)
118+
#define IS_ADC_HW_TRG_TOP(param) (((param) == ADC_EXT_TRG) || \
119+
((param) == ADC_MATCH_TB_1))
120+
121+
#define IS_ADC_CMP_VALUE(param) ((param) <= (uint16_t)0x03ff)
122+
123+
typedef enum {
124+
ADC_NO_OVERRUN = 0U,
125+
ADC_OVERRUN = 1U
126+
} ADC_OverrunState;
127+
128+
typedef enum {
129+
ADC_SCAN_4CH = 0U,
130+
ADC_SCAN_8CH = 1U
131+
} ADC_ChannelScanMode;
132+
#define IS_ADC_CH_SCAN_MODE(param) (((param) == ADC_SCAN_4CH) || \
133+
((param) == ADC_SCAN_8CH))
134+
135+
typedef enum {
136+
ADC_COMPARISON_SMALLER = 0U,
137+
ADC_COMPARISON_LARGER = 1U
138+
} ADC_ComparisonState;
139+
#define IS_ADC_CMP_INT(param) (((param) == ADC_COMPARISON_SMALLER) || \
140+
((param) == ADC_COMPARISON_LARGER))
141+
142+
typedef struct {
143+
WorkState ADCResultStored; /*!< ADC result storage flag */
144+
ADC_OverrunState ADCOverrunState; /*!< ADC overrun flag */
145+
uint16_t ADCResultValue; /*!< ADC result value */
146+
} ADC_ResultTypeDef;
147+
148+
#define ADC_DMA_REQ_NORMAL ((uint8_t)0x00)
149+
#define ADC_DMA_REQ_TOP ((uint8_t)0x01)
150+
#define ADC_DMA_REQ_MONITOR1 ((uint8_t)0x02)
151+
#define ADC_DMA_REQ_MONITOR2 ((uint8_t)0x03)
152+
#define IS_ADC_DMA_REQ(param) ((param) <= ADC_DMA_REQ_MONITOR2)
153+
154+
typedef union {
155+
uint32_t All;
156+
struct {
157+
uint32_t NormalBusy:1; /*!< bit0, Normal A/D conversion busy flag (MOD0<ADBFN>) */
158+
uint32_t NormalComplete:1; /*!< bit1, Normal AD conversion complete flag (MOD0<EOCFN>) */
159+
uint32_t TopBusy:1; /*!< bit2, Top-priority A/D conversion busy flag (MOD2<ADBFHP>) */
160+
uint32_t TopComplete:1; /*!< bit3, Top-priority AD conversion complete flag (MOD2<EOCFHP>) */
161+
uint32_t Reserved:28; /*!< bit4 to bit 31, reserved */
162+
} Bit;
163+
} ADC_State;
164+
165+
/** @} */
166+
/* End of group ADC_Exported_Types */
167+
168+
/** @defgroup ADC_Exported_FunctionPrototypes
169+
* @{
170+
*/
171+
void ADC_SWReset(void);
172+
void ADC_SetClk(uint32_t Conversion_Time, uint32_t Prescaler_Output);
173+
void ADC_Start(void);
174+
void ADC_SetScanMode(FunctionalState NewState);
175+
void ADC_SetRepeatMode(FunctionalState NewState);
176+
void ADC_SetINTMode(uint32_t INTMode);
177+
ADC_State ADC_GetConvertState(void);
178+
void ADC_SetInputChannel(uint32_t InputChannel);
179+
void ADC_SetChannelScanMode(ADC_ChannelScanMode ScanMode);
180+
void ADC_SetIdleMode(FunctionalState NewState);
181+
void ADC_SetVref(FunctionalState NewState);
182+
void ADC_SetInputChannelTop(uint32_t TopInputChannel);
183+
void ADC_StartTopConvert(void);
184+
void ADC_SetMonitor(uint8_t ADCMPx, FunctionalState NewState);
185+
void ADC_SetResultCmpReg(uint8_t ADCMPx, uint32_t ResultComparison);
186+
void ADC_SetMonitorINT(uint8_t ADCMPx, ADC_ComparisonState NewState);
187+
void ADC_SetHWTrg(uint32_t HwSource, FunctionalState NewState);
188+
void ADC_SetHWTrgTop(uint32_t HwSource, FunctionalState NewState);
189+
ADC_ResultTypeDef ADC_GetConvertResult(uint32_t ADREGx);
190+
void ADC_SetCmpValue(uint8_t ADCMPx, uint16_t value);
191+
void ADC_SetDMAReq(uint8_t DMAReq, FunctionalState NewState);
192+
193+
/** @} */
194+
/* End of group ADC_Exported_FunctionPrototypes */
195+
196+
/** @} */
197+
/* End of group ADC */
198+
199+
/** @} */
200+
/* End of group TX00_Periph_Driver */
201+
202+
#endif /* (__TMPM066_ADC_H) */
203+
204+
#ifdef __cplusplus
205+
}
206+
#endif
207+
#endif /* __TMPM066_ADC_H */
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/**
2+
*******************************************************************************
3+
* @file tmpm066_cg.h
4+
* @brief This file provides all the functions prototypes for CG driver.
5+
* @version V2.0.2.1
6+
* @date 2015/09/29
7+
*
8+
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
9+
*******************************************************************************
10+
*/
11+
12+
/* Define to prevent recursive inclusion -------------------------------------*/
13+
#ifndef __TMPM066_CG_H
14+
#define __TMPM066_CG_H
15+
16+
#ifdef __cplusplus
17+
extern "C" {
18+
#endif /* __cplusplus */
19+
20+
/* Includes ------------------------------------------------------------------*/
21+
#include "TMPM066.h"
22+
#include "tx00_common.h"
23+
24+
/** @addtogroup TX00_Periph_Driver
25+
* @{
26+
*/
27+
28+
/** @addtogroup CG
29+
* @{
30+
*/
31+
32+
/** @addtogroup CG_Exported_types
33+
* @{
34+
*/
35+
36+
typedef enum {
37+
CG_DIVIDE_1 = 0U,
38+
CG_DIVIDE_2 = 1U,
39+
CG_DIVIDE_4 = 2U,
40+
CG_DIVIDE_8 = 3U,
41+
CG_DIVIDE_16 = 4U,
42+
CG_DIVIDE_32 = 5U,
43+
CG_DIVIDE_64 = 6U,
44+
CG_DIVIDE_128 = 7U,
45+
CG_DIVIDE_256 = 8U,
46+
CG_DIVIDE_512 = 9U,
47+
CG_DIVIDE_UNKNOWN = 10U,
48+
CG_DIVIDE_MAX = 16U
49+
} CG_DivideLevel;
50+
#define IS_CG_GEAR_DIVIDE_LEVEL(param) (((param) == CG_DIVIDE_1) || \
51+
((param) == CG_DIVIDE_2) || \
52+
((param) == CG_DIVIDE_4) || \
53+
((param) == CG_DIVIDE_8) || \
54+
((param) == CG_DIVIDE_16))
55+
56+
#define IS_CG_DIVIDE_FC_LEVEL(param) (((param) == CG_DIVIDE_1) || \
57+
((param) == CG_DIVIDE_2) || \
58+
((param) == CG_DIVIDE_4) || \
59+
((param) == CG_DIVIDE_8) || \
60+
((param) == CG_DIVIDE_16) || \
61+
((param) == CG_DIVIDE_32) || \
62+
((param) == CG_DIVIDE_64)|| \
63+
((param) == CG_DIVIDE_128) || \
64+
((param) == CG_DIVIDE_256) || \
65+
((param) == CG_DIVIDE_512))
66+
67+
typedef enum {
68+
CG_FOSC_OSC_INT = 0U,
69+
CG_FOSC_OSC_EXT = 1U,
70+
CG_FOSC_CLKIN_EXT = 2U
71+
} CG_FoscSrc;
72+
#define IS_CG_FOSC_SRC(param) (((param) == CG_FOSC_OSC_EXT) || \
73+
((param) == CG_FOSC_OSC_INT) || \
74+
((param) == CG_FOSC_CLKIN_EXT))
75+
76+
#define IS_CG_FOSC_STATE(param) (((param) == CG_FOSC_OSC_EXT) || \
77+
((param) == CG_FOSC_OSC_INT) )
78+
79+
typedef enum {
80+
CG_WARM_UP_SRC_OSC_INT_HIGH = 0U,
81+
CG_WARM_UP_SRC_OSC_EXT_HIGH = 1U,
82+
} CG_WarmUpSrc;
83+
#define IS_CG_WARM_UP_SRC(param) (((param) == CG_WARM_UP_SRC_OSC_INT_HIGH) || \
84+
((param) == CG_WARM_UP_SRC_OSC_EXT_HIGH))
85+
86+
typedef enum {
87+
CG_FC_SRC_FOSC = 0U,
88+
CG_FC_SRC_FPLL = 1U
89+
} CG_FcSrc;
90+
#define IS_CG_FC_SRC(param) (((param) == CG_FC_SRC_FOSC) || \
91+
((param) == CG_FC_SRC_FPLL))
92+
93+
#define CG_8M_MUL_12_FPLL (0x00C60B00UL<<8U) /* 12 fold, input 8MHz, output 96MHz */
94+
#define CG_10M_MUL_8_FPLL (0x00C60700UL<<8U) /* 10 fold, input 10MHz, output 80MHz */
95+
#define CG_12M_MUL_8_FPLL (0x00C60700UL<<8U) /* 12 fold, input 12MHz, output 96MHz */
96+
#define CG_16M_MUL_6_FPLL (0x00C60500UL<<8U) /* 16 fold, input 16MHz, output 96MHz */
97+
98+
#define IS_CG_FPLL_VALUE(param) (((param) == CG_8M_MUL_12_FPLL) || \
99+
((param) == CG_10M_MUL_8_FPLL) || \
100+
((param) == CG_12M_MUL_8_FPLL) || \
101+
((param) == CG_16M_MUL_6_FPLL))
102+
typedef enum {
103+
CG_STBY_MODE_IDLE = 0U,
104+
CG_STBY_MODE_STOP1 = 1U,
105+
CG_STBY_MODE_UNKNOWN = 2U,
106+
CG_STBY_MODE_MAX = 4U
107+
} CG_STBYMode;
108+
#define IS_CG_STBY_MODE(param) (((param) == CG_STBY_MODE_STOP1) || \
109+
((param) == CG_STBY_MODE_IDLE))
110+
#define CG_FC_PERIPH_PORTH (0x00000001U << 7U)
111+
#define CG_FC_PERIPH_PORTJ (0x00000001U << 8U)
112+
#define CG_FC_PERIPH_TMRB0_3 (0x00000001U << 9U)
113+
#define CG_FC_PERIPH_TMRB4_6 (0x00000001U << 10U)
114+
#define CG_FC_PERIPH_TMR16A (0x00000001U << 11U)
115+
#define CG_FC_PERIPH_I2C0 (0x00000001U << 12U)
116+
#define CG_FC_PERIPH_SIO0 (0x00000001U << 13U)
117+
#define CG_FC_PERIPH_TSPI (0x00000001U << 14U)
118+
#define CG_FC_PERIPH_DMAC (0x00000001U << 15U)
119+
#define CG_FC_PERIPH_ADC (0x00000001U << 16U)
120+
#define CG_FC_PERIPH_USBD (0x00000001U << 17U)
121+
#define CG_FC_PERIPH_TMRD (0x00000001U << 18U)
122+
#define CG_FC_PERIPHA_ALL (0xFFFFFFFFU)
123+
#define IS_CG_FC_PERIPHA(param) ( ((param) >= CG_FC_PERIPH_PORTH) && ((param) <= CG_FC_PERIPH_TMRD ))
124+
125+
#define CG_FC_PERIPH_TMRB7 (0x00000001U << 28U)
126+
#define CG_FC_PERIPH_SIO1 (0x00000001U << 29U)
127+
#define CG_FC_PERIPH_WDT (0x00000001U << 30U)
128+
#define CG_FC_PERIPH_I2C1 (0x00000001U << 31U)
129+
#define CG_FC_PERIPHB_ALL (0xFFFFFFFFU)
130+
#define IS_CG_FC_PERIPHB(param) (((param) >= CG_FC_PERIPH_TMRB7))
131+
132+
#define CG_FPLL_PERIPH_TMRD (0x00000001U << 5U)
133+
#define CG_EHCLKSEL_8_24_48MHZ (0x00000001U << 4U)
134+
#define CG_USBSEL_PLL_CLOCKIN (0x00000001U << 1U)
135+
#define CG_USBENA_USB (0x00000001U)
136+
#define CG_FPLL_OPTIONAL_ALL (0x0FFFFFFFU)
137+
#define IS_CG_FPLL_OPTIONAL(param) (((param) > 0U) && ((param) <= CG_FPLL_OPTIONAL_ALL))
138+
139+
/** @} */
140+
/* End of group CG_Exported_types */
141+
142+
/** @defgroup CG_Exported_FunctionPrototypes
143+
* @{
144+
*/
145+
void CG_SetFgearLevel(CG_DivideLevel DivideFgearFromFc);
146+
CG_DivideLevel CG_GetFgearLevel(void);
147+
Result CG_SetPhiT0Level(CG_DivideLevel DividePhiT0FromFc);
148+
CG_DivideLevel CG_GetPhiT0Level(void);
149+
void CG_SetWarmUpTime(CG_WarmUpSrc Source, uint16_t Time);
150+
void CG_StartWarmUp(void);
151+
WorkState CG_GetWarmUpState(void);
152+
Result CG_SetFPLLValue(uint32_t NewValue);
153+
uint32_t CG_GetFPLLValue(void);
154+
Result CG_SetPLL(FunctionalState NewState);
155+
FunctionalState CG_GetPLLState(void);
156+
void CG_SetFoscSrc(CG_FoscSrc Source);
157+
CG_FoscSrc CG_GetFoscSrc(void);
158+
void CG_SetSTBYMode(CG_STBYMode Mode);
159+
CG_STBYMode CG_GetSTBYMode(void);
160+
void CG_SetFcSrc(CG_FcSrc Source);
161+
CG_FcSrc CG_GetFcSrc(void);
162+
void CG_SetProtectCtrl(FunctionalState NewState);
163+
void CG_SetFcPeriphA(uint32_t Periph, FunctionalState NewState);
164+
void CG_SetFcPeriphB(uint32_t Periph, FunctionalState NewState);
165+
void CG_SetFcOptional(uint32_t Periph, FunctionalState NewState);
166+
void CG_SetADCClkSupply(FunctionalState NewState);
167+
168+
/** @} */
169+
/* End of group CG_Exported_FunctionPrototype */
170+
171+
/** @} */
172+
/* End of group CG */
173+
174+
/** @} */
175+
/* End of group TX00_Periph_Driver */
176+
177+
#ifdef __cplusplus
178+
}
179+
#endif /* __cplusplus */
180+
#endif /* __TMPM066_CG_H */

0 commit comments

Comments
 (0)