Import Mbed OS hard-float snapshot
This commit is contained in:
@@ -0,0 +1,236 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_adc.h
|
||||
* @brief This file provides all the functions prototypes for ADC driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/11
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_ADC_H
|
||||
#define __TMPM46B_ADC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ADC
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ADC_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
#define IS_ADC_UNIT(param) (((param) == TSB_AD))
|
||||
|
||||
#define ADC_CONVERSION_CLK_10 ((uint32_t)0x00000000)
|
||||
#define ADC_CONVERSION_CLK_20 ((uint32_t)0x00000010)
|
||||
#define ADC_CONVERSION_CLK_30 ((uint32_t)0x00000020)
|
||||
#define ADC_CONVERSION_CLK_40 ((uint32_t)0x00000030)
|
||||
#define ADC_CONVERSION_CLK_80 ((uint32_t)0x00000040)
|
||||
#define ADC_CONVERSION_CLK_160 ((uint32_t)0x00000050)
|
||||
#define ADC_CONVERSION_CLK_320 ((uint32_t)0x00000060)
|
||||
#define IS_ADC_HOLD_TIME(param) (((param) == ADC_CONVERSION_CLK_10) || \
|
||||
((param) == ADC_CONVERSION_CLK_20) || \
|
||||
((param) == ADC_CONVERSION_CLK_30) || \
|
||||
((param) == ADC_CONVERSION_CLK_40) || \
|
||||
((param) == ADC_CONVERSION_CLK_80) || \
|
||||
((param) == ADC_CONVERSION_CLK_160)|| \
|
||||
((param) == ADC_CONVERSION_CLK_320))
|
||||
|
||||
#define ADC_FC_DIVIDE_LEVEL_1 ((uint32_t)0x00000000)
|
||||
#define ADC_FC_DIVIDE_LEVEL_2 ((uint32_t)0x00000001)
|
||||
#define ADC_FC_DIVIDE_LEVEL_4 ((uint32_t)0x00000002)
|
||||
#define ADC_FC_DIVIDE_LEVEL_8 ((uint32_t)0x00000003)
|
||||
#define ADC_FC_DIVIDE_LEVEL_16 ((uint32_t)0x00000004)
|
||||
#define IS_ADC_PRESCALER(param) ((param) <= ADC_FC_DIVIDE_LEVEL_16)
|
||||
|
||||
/* Interrupt generation timing in fixed channel mode */
|
||||
#define ADC_INT_SINGLE ((uint32_t)0x00000000)
|
||||
#define ADC_INT_CONVERSION_2 ((uint32_t)0x00000010)
|
||||
#define ADC_INT_CONVERSION_3 ((uint32_t)0x00000020)
|
||||
#define ADC_INT_CONVERSION_4 ((uint32_t)0x00000030)
|
||||
#define ADC_INT_CONVERSION_5 ((uint32_t)0x00000040)
|
||||
#define ADC_INT_CONVERSION_6 ((uint32_t)0x00000050)
|
||||
#define ADC_INT_CONVERSION_7 ((uint32_t)0x00000060)
|
||||
#define ADC_INT_CONVERSION_8 ((uint32_t)0x00000070)
|
||||
#define IS_ADC_INT_MODE(param) (((param) == ADC_INT_SINGLE) || \
|
||||
((param) == ADC_INT_CONVERSION_2) || \
|
||||
((param) == ADC_INT_CONVERSION_3) || \
|
||||
((param) == ADC_INT_CONVERSION_4) || \
|
||||
((param) == ADC_INT_CONVERSION_5) || \
|
||||
((param) == ADC_INT_CONVERSION_6) || \
|
||||
((param) == ADC_INT_CONVERSION_7) || \
|
||||
((param) == ADC_INT_CONVERSION_8))
|
||||
|
||||
typedef enum {
|
||||
ADC_AN_00 = 0U, /*!< define for Analog Input channel */
|
||||
ADC_AN_01 = 1U,
|
||||
ADC_AN_02 = 2U,
|
||||
ADC_AN_03 = 3U,
|
||||
ADC_AN_04 = 4U,
|
||||
ADC_AN_05 = 5U,
|
||||
ADC_AN_06 = 6U,
|
||||
ADC_AN_07 = 7U,
|
||||
} ADC_AINx;
|
||||
#define IS_ADC_INPUT_CHANNEL(param) ((param) <= ADC_AN_07)
|
||||
#define IS_ADC_SCAN_CHANNEL(start, range) (((start) <= ADC_AN_07) && \
|
||||
((range) >= 1U) && \
|
||||
(((start) + (range)) <= 8U))
|
||||
|
||||
|
||||
typedef enum {
|
||||
ADC_REG_00 = 0U,
|
||||
ADC_REG_01 = 1U,
|
||||
ADC_REG_02 = 2U,
|
||||
ADC_REG_03 = 3U,
|
||||
ADC_REG_04 = 4U,
|
||||
ADC_REG_05 = 5U,
|
||||
ADC_REG_06 = 6U,
|
||||
ADC_REG_07 = 7U,
|
||||
ADC_REG_SP = 8U
|
||||
} ADC_REGx;
|
||||
#define IS_ADC_REG(param) ((param) <= ADC_REG_SP)
|
||||
|
||||
#define ADC_APPLY_VREF_IN_CONVERSION ((uint32_t)0x00000000)
|
||||
#define ADC_APPLY_VREF_AT_ANY_TIME ((uint32_t)0x00000001)
|
||||
#define IS_ADC_VREF_CTRL(param) (((param) == ADC_APPLY_VREF_IN_CONVERSION) || \
|
||||
((param) == ADC_APPLY_VREF_AT_ANY_TIME))
|
||||
|
||||
typedef enum {
|
||||
ADC_CMPCR_0 = 0U,
|
||||
ADC_CMPCR_1 = 1U
|
||||
} ADC_CMPCRx;
|
||||
#define IS_ADC_CMPCRx(param) ((param) <= ADC_CMPCR_1)
|
||||
|
||||
#define ADC_EXTERADTRG ((uint32_t)0x00000000)
|
||||
#define ADC_INTERTRIGGER ((uint32_t)0x00000001)
|
||||
#define IS_ADC_EXTERADTRG(param) (((param) == ADC_EXTERADTRG)|| \
|
||||
((param) == ADC_INTERTRIGGER))
|
||||
|
||||
#define IS_ADC_EXTERADTRG_TOP(param) (((param) == ADC_EXTERADTRG)|| \
|
||||
((param) == ADC_INTERTRIGGER))
|
||||
|
||||
|
||||
typedef enum {
|
||||
ADC_LARGER_THAN_CMP_REG = 0U,
|
||||
ADC_SMALLER_THAN_CMP_REG = 1U
|
||||
} ADC_CmpCondition;
|
||||
#define IS_ADC_CMPCONDITION(param) ((param) <= ADC_SMALLER_THAN_CMP_REG)
|
||||
|
||||
typedef enum {
|
||||
ADC_SEQUENCE_CMP_MODE = 0U,
|
||||
ADC_CUMULATION_CMP_MODE = 1U
|
||||
} ADC_CmpCntMode;
|
||||
#define IS_ADC_CMPMODE(param) ((param) <= ADC_CUMULATION_CMP_MODE)
|
||||
|
||||
typedef enum {
|
||||
ADC_TRG_00 = 0U,
|
||||
ADC_TRG_01 = 1U,
|
||||
ADC_TRG_02 = 2U,
|
||||
ADC_TRG_03 = 3U,
|
||||
ADC_TRG_04 = 4U,
|
||||
ADC_TRG_05 = 5U,
|
||||
ADC_TRG_06 = 6U,
|
||||
ADC_TRG_07 = 7U,
|
||||
ADC_TRG_08 = 8U,
|
||||
ADC_TRG_09 = 9U
|
||||
} ADC_TRGx;
|
||||
#define IS_ADC_TRG(param) ((param) <= ADC_TRG_09)
|
||||
|
||||
/**
|
||||
* @brief ADC Monitor Configuration Structure definition
|
||||
*/
|
||||
typedef struct {
|
||||
ADC_AINx CmpChannel; /*!< Select which ADC channel will be used */
|
||||
uint32_t CmpCnt; /*!< How many times will valid comparisons be counted, range from 1 to 16 */
|
||||
ADC_CmpCondition Condition; /*!< Condition to compare ADC channel with Compare Register */
|
||||
ADC_CmpCntMode CntMode; /*!< Mode to compare ADC channel with Compare Register */
|
||||
uint32_t CmpValue; /*!< Comparison value to be set in Compare Register, max value is 4095 */
|
||||
} ADC_MonitorTypeDef;
|
||||
|
||||
#define IS_ADC_CMPCNT(param) (((param) >= 1U) && ((param) <= 16U))
|
||||
#define IS_ADC_CMPVALUE_12BIT(param) ((param) <= 4095U)
|
||||
|
||||
/**
|
||||
* @brief Union to store ADC state
|
||||
*/
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t NormalBusy:1; /*!< bit0, Normal A/D conversion busy flag (ADBF) */
|
||||
uint32_t NormalComplete:1; /*!< bit1, Normal AD conversion complete flag (EOCF) */
|
||||
uint32_t TopBusy:1; /*!< bit2, Top-priority A/D conversion busy flag (HPADBF) */
|
||||
uint32_t TopComplete:1; /*!< bit3, Top-priority AD conversion complete flag (HPEOCF) */
|
||||
uint32_t Reserved:28; /*!< bit4 to bit 31, reserved */
|
||||
} Bit;
|
||||
} ADC_State;
|
||||
|
||||
/**
|
||||
* @brief Union to store ADC result
|
||||
*/
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t ADResult:12; /*!< bit0 to bit11, store AD result */
|
||||
uint32_t Stored:1; /*!< bit12, AD result has been stored */
|
||||
uint32_t OverRun:1; /*!< bit13, new AD result is stored before the old one is read */
|
||||
uint32_t Reserved:18; /*!< bit14 to bit31, reserved */
|
||||
} Bit;
|
||||
} ADC_Result;
|
||||
|
||||
|
||||
/** @} */
|
||||
/* End of group ADC_Exported_Types */
|
||||
|
||||
/** @defgroup ADC_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
void ADC_SWReset(TSB_AD_TypeDef * ADx);
|
||||
void ADC_SetClk(TSB_AD_TypeDef * ADx, uint32_t Sample_HoldTime, uint32_t Prescaler_Output);
|
||||
void ADC_Start(TSB_AD_TypeDef * ADx);
|
||||
void ADC_SetScanMode(TSB_AD_TypeDef * ADx, FunctionalState NewState);
|
||||
void ADC_SetRepeatMode(TSB_AD_TypeDef * ADx, FunctionalState NewState);
|
||||
void ADC_SetINTMode(TSB_AD_TypeDef * ADx, uint32_t INTMode);
|
||||
void ADC_SetInputChannel(TSB_AD_TypeDef * ADx, ADC_AINx InputChannel);
|
||||
void ADC_SetScanChannel(TSB_AD_TypeDef * ADx, ADC_AINx StartChannel, uint32_t Range);
|
||||
void ADC_SetVrefCut(TSB_AD_TypeDef * ADx, uint32_t VrefCtrl);
|
||||
void ADC_SetIdleMode(TSB_AD_TypeDef * ADx, FunctionalState NewState);
|
||||
void ADC_SetVref(TSB_AD_TypeDef * ADx, FunctionalState NewState);
|
||||
void ADC_SetInputChannelTop(TSB_AD_TypeDef * ADx, ADC_AINx TopInputChannel);
|
||||
void ADC_StartTopConvert(TSB_AD_TypeDef * ADx);
|
||||
void ADC_SetMonitor(TSB_AD_TypeDef * ADx, ADC_CMPCRx ADCMPx, FunctionalState NewState);
|
||||
void ADC_ConfigMonitor(TSB_AD_TypeDef * ADx, ADC_CMPCRx ADCMPx, ADC_MonitorTypeDef * Monitor);
|
||||
void ADC_SetHWTrg(TSB_AD_TypeDef * ADx, uint32_t HWSrc, FunctionalState NewState);
|
||||
void ADC_SetHWTrgTop(TSB_AD_TypeDef * ADx, uint32_t HWSrc, FunctionalState NewState);
|
||||
ADC_State ADC_GetConvertState(TSB_AD_TypeDef * ADx);
|
||||
ADC_Result ADC_GetConvertResult(TSB_AD_TypeDef * ADx, ADC_REGx ADREGx);
|
||||
void ADC_EnableTrigger(void);
|
||||
void ADC_DisableTrigger(void);
|
||||
void ADC_SetTriggerStartup(ADC_TRGx TriggerStartup);
|
||||
void ADC_SetTriggerStartupTop(ADC_TRGx TopTriggerStartup);
|
||||
|
||||
/** @} */
|
||||
/* End of group ADC_Exported_FunctionPrototypes */
|
||||
/** @} */
|
||||
/* End of group ADC */
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __TMPM46B_ADC_H */
|
||||
@@ -0,0 +1,342 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_cg.h
|
||||
* @brief This file provides all the functions prototypes for CG driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/26
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_CG_H
|
||||
#define __TMPM46B_CG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup CG
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup CG_Exported_types
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
CG_DIVIDE_1 = 0U,
|
||||
CG_DIVIDE_2 = 1U,
|
||||
CG_DIVIDE_4 = 2U,
|
||||
CG_DIVIDE_8 = 3U,
|
||||
CG_DIVIDE_16 = 4U,
|
||||
CG_DIVIDE_32 = 5U,
|
||||
CG_DIVIDE_64 = 6U,
|
||||
CG_DIVIDE_128 = 7U,
|
||||
CG_DIVIDE_256 = 8U,
|
||||
CG_DIVIDE_512 = 9U,
|
||||
CG_DIVIDE_UNKNOWN = 10U,
|
||||
CG_DIVIDE_MAX = 11U
|
||||
} CG_DivideLevel;
|
||||
#define IS_CG_GEAR_DIVIDE_LEVEL(param) (((param) == CG_DIVIDE_1) || \
|
||||
((param) == CG_DIVIDE_2) || \
|
||||
((param) == CG_DIVIDE_4) || \
|
||||
((param) == CG_DIVIDE_8) || \
|
||||
((param) == CG_DIVIDE_16))
|
||||
|
||||
#define IS_CG_FC_DIVIDE_LEVEL(param) (((param) == CG_DIVIDE_1) || \
|
||||
((param) == CG_DIVIDE_2) || \
|
||||
((param) == CG_DIVIDE_4) || \
|
||||
((param) == CG_DIVIDE_8) || \
|
||||
((param) == CG_DIVIDE_16)|| \
|
||||
((param) == CG_DIVIDE_32))
|
||||
|
||||
#define IS_CG_DIVIDE_FC_LEVEL(param) (((param) == CG_DIVIDE_1) || \
|
||||
((param) == CG_DIVIDE_2) || \
|
||||
((param) == CG_DIVIDE_4) || \
|
||||
((param) == CG_DIVIDE_8) || \
|
||||
((param) == CG_DIVIDE_16) || \
|
||||
((param) == CG_DIVIDE_32) || \
|
||||
((param) == CG_DIVIDE_64)|| \
|
||||
((param) == CG_DIVIDE_128) || \
|
||||
((param) == CG_DIVIDE_256) || \
|
||||
((param) == CG_DIVIDE_512))
|
||||
|
||||
typedef enum {
|
||||
CG_FOSC_OSC_EXT = 0U,
|
||||
CG_FOSC_OSC_INT = 1U,
|
||||
CG_FOSC_CLKIN_EXT = 2U
|
||||
} CG_FoscSrc;
|
||||
#define IS_CG_FOSC_SRC(param) (((param) == CG_FOSC_OSC_EXT) || \
|
||||
((param) == CG_FOSC_OSC_INT) || \
|
||||
((param) == CG_FOSC_CLKIN_EXT))
|
||||
|
||||
#define IS_CG_FOSC_STATE(param) (((param) == CG_FOSC_OSC_EXT) || \
|
||||
((param) == CG_FOSC_OSC_INT) )
|
||||
|
||||
typedef enum {
|
||||
CG_SCOUT_SRC_FS = 0U,
|
||||
CG_SCOUT_SRC_FSYS_DIVIDE_8 = 1U,
|
||||
CG_SCOUT_SRC_FSYS_DIVIDE_4 = 2U,
|
||||
CG_SCOUT_SRC_FOSC = 3U
|
||||
} CG_SCOUTSrc;
|
||||
#define IS_CG_SCOUT_SRC(param) (((param) == CG_SCOUT_SRC_FS) || \
|
||||
((param) == CG_SCOUT_SRC_FSYS_DIVIDE_8) || \
|
||||
((param) == CG_SCOUT_SRC_FSYS_DIVIDE_4) || \
|
||||
((param) == CG_SCOUT_SRC_FOSC))
|
||||
|
||||
typedef enum {
|
||||
CG_WARM_UP_SRC_OSC_INT_HIGH = 0U,
|
||||
CG_WARM_UP_SRC_OSC_EXT_HIGH = 1U,
|
||||
CG_WARM_UP_SRC_OSC_EXT_LOW = 2U
|
||||
} CG_WarmUpSrc;
|
||||
#define IS_CG_WARM_UP_SRC(param) (((param) == CG_WARM_UP_SRC_OSC_INT_HIGH) || \
|
||||
((param) == CG_WARM_UP_SRC_OSC_EXT_HIGH) || \
|
||||
((param) == CG_WARM_UP_SRC_OSC_EXT_LOW))
|
||||
|
||||
typedef enum {
|
||||
CG_FC_SRC_FOSC = 0U,
|
||||
CG_FC_SRC_FPLL = 1U
|
||||
} CG_FcSrc;
|
||||
#define IS_CG_FC_SRC(param) (((param) == CG_FC_SRC_FOSC) || \
|
||||
((param) == CG_FC_SRC_FPLL))
|
||||
|
||||
#define CG_8M_MUL_4_FPLL (0x00006A0FUL<<1U) /* 4 fold, input 8MHz, output 32MHz */
|
||||
#define CG_8M_MUL_5_FPLL (0x00006A13UL<<1U) /* 5 fold, input 8MHz, output 40MHz */
|
||||
#define CG_8M_MUL_6_FPLL (0x00006917UL<<1U) /* 6 fold, input 8MHz, output 48MHz */
|
||||
#define CG_8M_MUL_8_FPLL (0x0000691FUL<<1U) /* 8 fold, input 8MHz, output 64MHz */
|
||||
#define CG_8M_MUL_10_FPLL (0x00006A26UL<<1U) /* 10 fold, input 8MHz, output 80MHz */
|
||||
#define CG_8M_MUL_12_FPLL (0x0000692EUL<<1U) /* 12 fold, input 8MHz, output 96MHz */
|
||||
#define CG_10M_MUL_4_FPLL (0x00006A0FUL<<1U) /* 4 fold, input 10MHz, output 40MHz */
|
||||
#define CG_10M_MUL_5_FPLL (0x00006A13UL<<1U) /* 5 fold, input 10MHz, output 50MHz */
|
||||
#define CG_10M_MUL_6_FPLL (0x00006917UL<<1U) /* 6 fold, input 10MHz, output 60MHz */
|
||||
#define CG_10M_MUL_8_FPLL (0x0000691FUL<<1U) /* 8 fold, input 10MHz, output 80MHz */
|
||||
#define CG_10M_MUL_10_FPLL (0x00006A26UL<<1U) /* 10 fold, input 10MHz, output 100MHz */
|
||||
#define CG_10M_MUL_12_FPLL (0x0000692EUL<<1U) /* 12 fold, input 10MHz, output 120MHz */
|
||||
#define CG_12M_MUL_4_FPLL (0x00006A0FUL<<1U) /* 4 fold, input 12MHz, output 48MHz */
|
||||
#define CG_12M_MUL_5_FPLL (0x00006A13UL<<1U) /* 5 fold, input 12MHz, output 60MHz */
|
||||
#define CG_12M_MUL_6_FPLL (0x00006917UL<<1U) /* 6 fold, input 12MHz, output 72MHz */
|
||||
#define CG_12M_MUL_8_FPLL (0x0000691FUL<<1U) /* 8 fold, input 12MHz, output 96MHz */
|
||||
#define CG_12M_MUL_10_FPLL (0x00006A26UL<<1U) /* 10 fold, input 12MHz, output 120MHz */
|
||||
#define CG_16M_MUL_4_FPLL (0x00006A0FUL<<1U) /* 4 fold, input 16MHz, output 64MHz */
|
||||
#define CG_16M_MUL_5_FPLL (0x00006A13UL<<1U) /* 5 fold, input 16MHz, output 80MHz */
|
||||
#define IS_CG_FPLL_VALUE(param) (((param) == CG_8M_MUL_4_FPLL) || \
|
||||
((param) == CG_8M_MUL_5_FPLL) || \
|
||||
((param) == CG_8M_MUL_6_FPLL) || \
|
||||
((param) == CG_8M_MUL_8_FPLL) || \
|
||||
((param) == CG_8M_MUL_10_FPLL) || \
|
||||
((param) == CG_8M_MUL_12_FPLL) || \
|
||||
((param) == CG_10M_MUL_4_FPLL) || \
|
||||
((param) == CG_10M_MUL_5_FPLL) || \
|
||||
((param) == CG_10M_MUL_6_FPLL) || \
|
||||
((param) == CG_10M_MUL_8_FPLL) || \
|
||||
((param) == CG_10M_MUL_10_FPLL) || \
|
||||
((param) == CG_10M_MUL_12_FPLL) || \
|
||||
((param) == CG_12M_MUL_4_FPLL) || \
|
||||
((param) == CG_12M_MUL_5_FPLL) || \
|
||||
((param) == CG_12M_MUL_6_FPLL) || \
|
||||
((param) == CG_12M_MUL_8_FPLL) || \
|
||||
((param) == CG_12M_MUL_10_FPLL) || \
|
||||
((param) == CG_16M_MUL_4_FPLL) || \
|
||||
((param) == CG_16M_MUL_5_FPLL))
|
||||
|
||||
typedef enum {
|
||||
CG_STBY_MODE_UNKNOWN = 0U,
|
||||
CG_STBY_MODE_STOP1 = 1U,
|
||||
CG_STBY_MODE_IDLE = 3U,
|
||||
CG_STBY_MODE_STOP2 = 5U,
|
||||
CG_STBY_MODE_MAX = 8U
|
||||
} CG_STBYMode;
|
||||
#define IS_CG_STBY_MODE(param) (((param) == CG_STBY_MODE_STOP1) || \
|
||||
((param) == CG_STBY_MODE_IDLE)|| \
|
||||
((param) == CG_STBY_MODE_STOP2))
|
||||
|
||||
typedef enum {
|
||||
CG_PHIT0_SRC_FGEAR = 0U,
|
||||
CG_PHIT0_SRC_FC = 1U,
|
||||
CG_PHIT0_SRC_MAX = 2U
|
||||
} CG_PhiT0Src;
|
||||
#define IS_CG_PHIT0_SRC(param) (((param) == CG_PHIT0_SRC_FGEAR) || \
|
||||
((param) == CG_PHIT0_SRC_FC))
|
||||
|
||||
typedef enum {
|
||||
CG_INT_SRC_1 = 0U,
|
||||
CG_INT_SRC_2 = 1U,
|
||||
CG_INT_SRC_7 = 2U,
|
||||
CG_INT_SRC_8 = 3U,
|
||||
CG_INT_SRC_D = 4U,
|
||||
CG_INT_SRC_E = 5U,
|
||||
CG_INT_SRC_F = 6U,
|
||||
CG_INT_SRC_RTC = 7U
|
||||
} CG_INTSrc;
|
||||
|
||||
#define IS_CG_INT_SRC(param) (((param) == CG_INT_SRC_1) || \
|
||||
((param) == CG_INT_SRC_2) || \
|
||||
((param) == CG_INT_SRC_7) || \
|
||||
((param) == CG_INT_SRC_8) || \
|
||||
((param) == CG_INT_SRC_D) || \
|
||||
((param) == CG_INT_SRC_E) || \
|
||||
((param) == CG_INT_SRC_F) || \
|
||||
((param) == CG_INT_SRC_RTC))
|
||||
|
||||
typedef enum {
|
||||
CG_INT_ACTIVE_STATE_L = 0x00U,
|
||||
CG_INT_ACTIVE_STATE_H = 0x10U,
|
||||
CG_INT_ACTIVE_STATE_FALLING = 0x20U,
|
||||
CG_INT_ACTIVE_STATE_RISING = 0x30U,
|
||||
CG_INT_ACTIVE_STATE_BOTH_EDGES = 0x40U,
|
||||
CG_INT_ACTIVE_STATE_INVALID = 0x50U
|
||||
} CG_INTActiveState;
|
||||
#define IS_CG_INT_ACTIVE_STATE(param) (((param) == CG_INT_ACTIVE_STATE_L) || \
|
||||
((param) == CG_INT_ACTIVE_STATE_H) || \
|
||||
((param) == CG_INT_ACTIVE_STATE_FALLING) || \
|
||||
((param) == CG_INT_ACTIVE_STATE_RISING) || \
|
||||
((param) == CG_INT_ACTIVE_STATE_BOTH_EDGES))
|
||||
|
||||
#define IS_CG_INT_RTC_ACTIVE_STATE(param) ((param) == CG_INT_ACTIVE_STATE_FALLING)
|
||||
|
||||
#define CG_FC_PERIPH_PORTA (0x00000001U << 0U)
|
||||
#define CG_FC_PERIPH_PORTB (0x00000001U << 1U)
|
||||
#define CG_FC_PERIPH_PORTC (0x00000001U << 2U)
|
||||
#define CG_FC_PERIPH_PORTD (0x00000001U << 3U)
|
||||
#define CG_FC_PERIPH_PORTE (0x00000001U << 4U)
|
||||
#define CG_FC_PERIPH_PORTF (0x00000001U << 5U)
|
||||
#define CG_FC_PERIPH_PORTG (0x00000001U << 6U)
|
||||
#define CG_FC_PERIPH_PORTH (0x00000001U << 7U)
|
||||
#define CG_FC_PERIPH_PORTJ (0x00000001U << 8U)
|
||||
#define CG_FC_PERIPH_PORTK (0x00000001U << 9U)
|
||||
#define CG_FC_PERIPH_PORTL (0x00000001U << 10U)
|
||||
#define CG_FC_PERIPH_TMRB0 (0x00000001U << 13U)
|
||||
#define CG_FC_PERIPH_TMRB1 (0x00000001U << 14U)
|
||||
#define CG_FC_PERIPH_TMRB2 (0x00000001U << 15U)
|
||||
#define CG_FC_PERIPH_TMRB3 (0x00000001U << 16U)
|
||||
#define CG_FC_PERIPH_TMRB4 (0x00000001U << 17U)
|
||||
#define CG_FC_PERIPH_TMRB5 (0x00000001U << 18U)
|
||||
#define CG_FC_PERIPH_TMRB6 (0x00000001U << 19U)
|
||||
#define CG_FC_PERIPH_TMRB7 (0x00000001U << 20U)
|
||||
#define CG_FC_PERIPH_MPT0 (0x00000001U << 27U)
|
||||
#define CG_FC_PERIPH_MPT1 (0x00000001U << 28U)
|
||||
#define CG_FC_PERIPH_MPT2 (0x00000001U << 29U)
|
||||
#define CG_FC_PERIPH_MPT3 (0x00000001U << 30U)
|
||||
#define CG_FC_PERIPH_TRACE (0x00000001U << 31U)
|
||||
#define CG_FC_PERIPHA_ALL (0xF81FE7FFU)
|
||||
#define IS_CG_FC_PERIPHA(param) ((param) > 0U)
|
||||
|
||||
#define CG_FC_PERIPH_SIO_UART0 (0x00000001U << 0U)
|
||||
#define CG_FC_PERIPH_SIO_UART1 (0x00000001U << 1U)
|
||||
#define CG_FC_PERIPH_SIO_UART2 (0x00000001U << 2U)
|
||||
#define CG_FC_PERIPH_SIO_UART3 (0x00000001U << 3U)
|
||||
#define CG_FC_PERIPH_UART0 (0x00000001U << 10U)
|
||||
#define CG_FC_PERIPH_UART1 (0x00000001U << 11U)
|
||||
#define CG_FC_PERIPH_I2C0 (0x00000001U << 12U)
|
||||
#define CG_FC_PERIPH_I2C1 (0x00000001U << 13U)
|
||||
#define CG_FC_PERIPH_I2C2 (0x00000001U << 14U)
|
||||
#define CG_FC_PERIPH_SSP0 (0x00000001U << 17U)
|
||||
#define CG_FC_PERIPH_SSP1 (0x00000001U << 18U)
|
||||
#define CG_FC_PERIPH_SSP2 (0x00000001U << 19U)
|
||||
#define CG_FC_PERIPH_EBIF (0x00000001U << 20U)
|
||||
#define CG_FC_PERIPH_DMACA (0x00000001U << 21U)
|
||||
#define CG_FC_PERIPH_DMACB (0x00000001U << 22U)
|
||||
#define CG_FC_PERIPH_DMACC (0x00000001U << 23U)
|
||||
#define CG_FC_PERIPH_DMAIF (0x00000001U << 24U)
|
||||
#define CG_FC_PERIPH_ADC (0x00000001U << 25U)
|
||||
#define CG_FC_PERIPH_WDT (0x00000001U << 26U)
|
||||
#define CG_FC_PERIPH_MLA (0x00000001U << 28U)
|
||||
#define CG_FC_PERIPH_ESG (0x00000001U << 29U)
|
||||
#define CG_FC_PERIPH_SHA (0x00000001U << 30U)
|
||||
#define CG_FC_PERIPH_AES (0x00000001U << 31U)
|
||||
#define CG_FC_PERIPHB_ALL (0xF7FE7C0FU)
|
||||
#define IS_CG_FC_PERIPHB(param) (((param) > 0U) && ((param) <= CG_FC_PERIPHB_ALL))
|
||||
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t WDT:1;
|
||||
uint32_t Reserved0:1;
|
||||
uint32_t DetectLowVoltage:1;
|
||||
uint32_t Reserved1:29;
|
||||
} Bit;
|
||||
} CG_NMIFactor;
|
||||
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t PinReset:1;
|
||||
uint32_t OSCFLF:1;
|
||||
uint32_t WDTReset:1;
|
||||
uint32_t STOP2Reset:1;
|
||||
uint32_t DebugReset:1;
|
||||
uint32_t Reserved0:1;
|
||||
uint32_t LVDReset:1;
|
||||
uint32_t Reserved1:25;
|
||||
} Bit;
|
||||
} CG_ResetFlag;
|
||||
|
||||
/** @} */
|
||||
/* End of group CG_Exported_types */
|
||||
|
||||
/** @defgroup CG_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
void CG_SetFgearLevel(CG_DivideLevel DivideFgearFromFc);
|
||||
CG_DivideLevel CG_GetFgearLevel(void);
|
||||
void CG_SetPhiT0Src(CG_PhiT0Src PhiT0Src);
|
||||
CG_PhiT0Src CG_GetPhiT0Src(void);
|
||||
Result CG_SetPhiT0Level(CG_DivideLevel DividePhiT0FromFc);
|
||||
CG_DivideLevel CG_GetPhiT0Level(void);
|
||||
void CG_SetSCOUTSrc(CG_SCOUTSrc Source);
|
||||
CG_SCOUTSrc CG_GetSCOUTSrc(void);
|
||||
void CG_SetWarmUpTime(CG_WarmUpSrc Source, uint16_t Time);
|
||||
void CG_StartWarmUp(void);
|
||||
WorkState CG_GetWarmUpState(void);
|
||||
Result CG_SetFPLLValue(uint32_t NewValue);
|
||||
uint32_t CG_GetFPLLValue(void);
|
||||
Result CG_SetPLL(FunctionalState NewState);
|
||||
FunctionalState CG_GetPLLState(void);
|
||||
Result CG_SetFosc(CG_FoscSrc Source, FunctionalState NewState);
|
||||
void CG_SetFoscSrc(CG_FoscSrc Source);
|
||||
CG_FoscSrc CG_GetFoscSrc(void);
|
||||
FunctionalState CG_GetFoscState(CG_FoscSrc Source);
|
||||
void CG_SetSTBYMode(CG_STBYMode Mode);
|
||||
CG_STBYMode CG_GetSTBYMode(void);
|
||||
void CG_SetPortKeepInStop2Mode(FunctionalState NewState);
|
||||
FunctionalState CG_GetPortKeepInStop2Mode(void);
|
||||
Result CG_SetFcSrc(CG_FcSrc Source);
|
||||
CG_FcSrc CG_GetFcSrc(void);
|
||||
void CG_SetProtectCtrl(FunctionalState NewState);
|
||||
void CG_SetSTBYReleaseINTSrc(CG_INTSrc INTSource,
|
||||
CG_INTActiveState ActiveState, FunctionalState NewState);
|
||||
CG_INTActiveState CG_GetSTBYReleaseINTState(CG_INTSrc INTSource);
|
||||
void CG_ClearINTReq(CG_INTSrc INTSource);
|
||||
CG_NMIFactor CG_GetNMIFlag(void);
|
||||
FunctionalState CG_GetIOSCFlashFlag(void);
|
||||
CG_ResetFlag CG_GetResetFlag(void);
|
||||
void CG_SetADCClkSupply(FunctionalState NewState);
|
||||
void CG_SetFcPeriphA(uint32_t Periph, FunctionalState NewState);
|
||||
void CG_SetFcPeriphB(uint32_t Periph, FunctionalState NewState);
|
||||
void CG_SetFs(FunctionalState NewState);
|
||||
|
||||
/** @} */
|
||||
/* End of group CG_Exported_FunctionPrototype */
|
||||
|
||||
/** @} */
|
||||
/* End of group CG */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __TMPM46B_CG_H */
|
||||
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_esg.h
|
||||
* @brief This file provides all the functions prototypes for ESG driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/04
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_ESG_H
|
||||
#define __TMPM46B_ESG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ESG
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ESG_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
/* End of ESG_Exported_Constants */
|
||||
|
||||
/** @defgroup ESG_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
ESG_CALCULATION_COMPLETE = 0U,
|
||||
ESG_CALCULATION_PROCESS = 1U
|
||||
} ESG_CalculationStatus;
|
||||
|
||||
typedef enum {
|
||||
ESG_LATCH_TIMING_1 = 0U,
|
||||
ESG_LATCH_TIMING_2 = 1U,
|
||||
ESG_LATCH_TIMING_3 = 2U,
|
||||
ESG_LATCH_TIMING_4 = 3U,
|
||||
ESG_LATCH_TIMING_5 = 4U,
|
||||
ESG_LATCH_TIMING_6 = 5U,
|
||||
ESG_LATCH_TIMING_7 = 6U,
|
||||
ESG_LATCH_TIMING_8 = 7U,
|
||||
ESG_LATCH_TIMING_9 = 8U,
|
||||
ESG_LATCH_TIMING_10 = 9U,
|
||||
ESG_LATCH_TIMING_11 = 10U,
|
||||
ESG_LATCH_TIMING_12 = 11U,
|
||||
ESG_LATCH_TIMING_13 = 12U,
|
||||
ESG_LATCH_TIMING_14 = 13U,
|
||||
ESG_LATCH_TIMING_15 = 14U,
|
||||
ESG_LATCH_TIMING_16 = 15U
|
||||
} ESG_LatchTiming;
|
||||
#define IS_ESG_LATCH_TIMING(param) ((param) <= ESG_LATCH_TIMING_16)
|
||||
|
||||
/** @} */
|
||||
/* End of ESG_Exported_types */
|
||||
|
||||
/** @addtogroup ESG_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief ESG Init Structure definition
|
||||
*/
|
||||
/** @} */
|
||||
/* End of group ESG_Exported_Types */
|
||||
|
||||
/** @defgroup ESG_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
Result ESG_Startup(void);
|
||||
Result ESG_SetLatchTiming(ESG_LatchTiming Value);
|
||||
uint32_t ESG_GetLatchTiming(void);
|
||||
Result ESG_SetFintiming(uint16_t Fintming);
|
||||
uint16_t ESG_GetFintiming(void);
|
||||
Result ESG_ClrInt(void);
|
||||
FunctionalState ESG_GetIntStatus(void);
|
||||
void ESG_IPReset(void);
|
||||
ESG_CalculationStatus ESG_GetCalculationStatus(void);
|
||||
void ESG_GetResult(uint32_t Seed[16U]);
|
||||
|
||||
/** @} */
|
||||
/* End of ESG_Exported_FunctionPrototypes */
|
||||
|
||||
/** @} */
|
||||
/* End of group ESG */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __TMPM46B_ESG_H */
|
||||
@@ -0,0 +1,256 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_fc.h
|
||||
* @brief This file provides all the functions prototypes for FC driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/27
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_FC_H
|
||||
#define __TMPM46B_FC_H
|
||||
|
||||
|
||||
/* #define SINGLE_BOOT_MODE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup FC
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FC_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
FC_SUCCESS = 0U,
|
||||
FC_ERROR_PROTECTED = 1U,
|
||||
FC_ERROR_OVER_TIME = 2U
|
||||
} FC_Result;
|
||||
|
||||
/** @} */
|
||||
/* End of group FC_Exported_Types */
|
||||
|
||||
/** @defgroup FC_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define FLASH_PAGE_SIZE ((uint32_t)0x00001000) /* Page Size 4096 Bytes/1024 words */
|
||||
#define PROGRAM_UNIT 4U /* Page program could be written 16 bytes/4 words once */
|
||||
|
||||
#define FC_PAGE_0 ((uint8_t)0x00)
|
||||
#define FC_PAGE_1 ((uint8_t)0x01)
|
||||
#define FC_PAGE_2 ((uint8_t)0x02)
|
||||
#define FC_PAGE_3 ((uint8_t)0x03)
|
||||
#define FC_PAGE_4 ((uint8_t)0x04)
|
||||
#define FC_PAGE_5 ((uint8_t)0x05)
|
||||
#define FC_PAGE_6 ((uint8_t)0x06)
|
||||
#define FC_PAGE_7 ((uint8_t)0x07)
|
||||
|
||||
#define FC_PAGE_MAX FC_PAGE_7
|
||||
#define IS_FC_PAGE_NUM(param) ((param) <= FC_PAGE_MAX)
|
||||
|
||||
#define FC_BLOCK_0 ((uint8_t)0x00)
|
||||
#define FC_BLOCK_1 ((uint8_t)0x01)
|
||||
#define FC_BLOCK_2 ((uint8_t)0x02)
|
||||
#define FC_BLOCK_3 ((uint8_t)0x03)
|
||||
#define FC_BLOCK_4 ((uint8_t)0x04)
|
||||
#define FC_BLOCK_5 ((uint8_t)0x05)
|
||||
#define FC_BLOCK_6 ((uint8_t)0x06)
|
||||
#define FC_BLOCK_7 ((uint8_t)0x07)
|
||||
#define FC_BLOCK_8 ((uint8_t)0x08)
|
||||
#define FC_BLOCK_9 ((uint8_t)0x09)
|
||||
#define FC_BLOCK_10 ((uint8_t)0x0A)
|
||||
#define FC_BLOCK_11 ((uint8_t)0x0B)
|
||||
#define FC_BLOCK_12 ((uint8_t)0x0C)
|
||||
#define FC_BLOCK_13 ((uint8_t)0x0D)
|
||||
#define FC_BLOCK_14 ((uint8_t)0x0E)
|
||||
#define FC_BLOCK_15 ((uint8_t)0x0F)
|
||||
#define FC_BLOCK_16 ((uint8_t)0x10)
|
||||
#define FC_BLOCK_17 ((uint8_t)0x11)
|
||||
#define FC_BLOCK_18 ((uint8_t)0x12)
|
||||
#define FC_BLOCK_19 ((uint8_t)0x13)
|
||||
#define FC_BLOCK_20 ((uint8_t)0x14)
|
||||
#define FC_BLOCK_21 ((uint8_t)0x15)
|
||||
#define FC_BLOCK_22 ((uint8_t)0x16)
|
||||
#define FC_BLOCK_23 ((uint8_t)0x17)
|
||||
#define FC_BLOCK_24 ((uint8_t)0x18)
|
||||
#define FC_BLOCK_25 ((uint8_t)0x19)
|
||||
#define FC_BLOCK_26 ((uint8_t)0x1A)
|
||||
#define FC_BLOCK_27 ((uint8_t)0x1B)
|
||||
#define FC_BLOCK_28 ((uint8_t)0x1C)
|
||||
#define FC_BLOCK_29 ((uint8_t)0x1D)
|
||||
#define FC_BLOCK_30 ((uint8_t)0x1E)
|
||||
#define FC_BLOCK_31 ((uint8_t)0x1F)
|
||||
|
||||
#define FLASH_CHIP_SIZE ((uint32_t)0x00100000) /* Flash chip size is 1024KByte */
|
||||
#define FC_BLOCK_MAX FC_BLOCK_31
|
||||
|
||||
#define IS_FC_BLOCK_NUM(param) (((param) <= FC_BLOCK_MAX) && ((param) >= FC_BLOCK_1))
|
||||
|
||||
#define FC_AREA_ALL ((uint8_t)0x00)
|
||||
#define FC_AREA_0 ((uint8_t)0x01)
|
||||
#define FC_AREA_1 ((uint8_t)0x02)
|
||||
|
||||
#define IS_FC_AREA(param) ((param) <= FC_AREA_1)
|
||||
|
||||
#define FC_SWAP_SIZE_4K ((uint32_t)0x00000000)
|
||||
#define FC_SWAP_SIZE_8K ((uint32_t)0x00000001)
|
||||
#define FC_SWAP_SIZE_16K ((uint32_t)0x00000002)
|
||||
#define FC_SWAP_SIZE_32K ((uint32_t)0x00000003)
|
||||
#define FC_SWAP_SIZE_512K ((uint32_t)0x00000004)
|
||||
|
||||
#define FC_SWAP_INITIAL ((uint32_t)0x00000000)
|
||||
#define FC_SWAPPING ((uint32_t)0x00000001)
|
||||
#define FC_SWAP_PROHIBIT ((uint32_t)0x00000002)
|
||||
#define FC_SWAP_RELEASE ((uint32_t)0x00000003)
|
||||
|
||||
#define FC_Clk_Div_1 ((uint8_t) 0x00)
|
||||
#define FC_Clk_Div_2 ((uint8_t) 0x01)
|
||||
#define FC_Clk_Div_3 ((uint8_t) 0x02)
|
||||
#define FC_Clk_Div_4 ((uint8_t) 0x03)
|
||||
#define FC_Clk_Div_5 ((uint8_t) 0x04)
|
||||
#define FC_Clk_Div_6 ((uint8_t) 0x05)
|
||||
#define FC_Clk_Div_7 ((uint8_t) 0x06)
|
||||
#define FC_Clk_Div_8 ((uint8_t) 0x07)
|
||||
#define FC_Clk_Div_9 ((uint8_t) 0x08)
|
||||
#define FC_Clk_Div_10 ((uint8_t) 0x09)
|
||||
#define FC_Clk_Div_11 ((uint8_t) 0x0A)
|
||||
#define FC_Clk_Div_12 ((uint8_t) 0x0B)
|
||||
#define FC_Clk_Div_13 ((uint8_t) 0x0C)
|
||||
#define FC_Clk_Div_14 ((uint8_t) 0x0D)
|
||||
#define FC_Clk_Div_15 ((uint8_t) 0x0E)
|
||||
#define FC_Clk_Div_16 ((uint8_t) 0x0F)
|
||||
#define FC_Clk_Div_17 ((uint8_t) 0x10)
|
||||
#define FC_Clk_Div_18 ((uint8_t) 0x11)
|
||||
#define FC_Clk_Div_19 ((uint8_t) 0x12)
|
||||
#define FC_Clk_Div_20 ((uint8_t) 0x13)
|
||||
#define FC_Clk_Div_21 ((uint8_t) 0x14)
|
||||
#define FC_Clk_Div_22 ((uint8_t) 0x15)
|
||||
#define FC_Clk_Div_23 ((uint8_t) 0x16)
|
||||
#define FC_Clk_Div_24 ((uint8_t) 0x17)
|
||||
#define FC_Clk_Div_25 ((uint8_t) 0x18)
|
||||
#define FC_Clk_Div_26 ((uint8_t) 0x19)
|
||||
#define FC_Clk_Div_27 ((uint8_t) 0x1A)
|
||||
#define FC_Clk_Div_28 ((uint8_t) 0x1B)
|
||||
#define FC_Clk_Div_29 ((uint8_t) 0x1C)
|
||||
#define FC_Clk_Div_30 ((uint8_t) 0x1D)
|
||||
#define FC_Clk_Div_31 ((uint8_t) 0x1E)
|
||||
#define FC_Clk_Div_32 ((uint8_t) 0x1F)
|
||||
#define IS_FC_WCLK_DIV(param) ((param) <= FC_Clk_Div_32)
|
||||
|
||||
#define FC_PROG_CNT_250 ((uint8_t) 0x00)
|
||||
#define FC_PROG_CNT_300 ((uint8_t) 0x01)
|
||||
#define FC_PROG_CNT_350 ((uint8_t) 0x02)
|
||||
#define IS_FC_PROG_CNT(param) ((param) <= (FC_PROG_CNT_350))
|
||||
|
||||
#define FC_ERAS_CNT_85 ((uint8_t) 0x00)
|
||||
#define FC_ERAS_CNT_90 ((uint8_t) 0x01)
|
||||
#define FC_ERAS_CNT_95 ((uint8_t) 0x02)
|
||||
#define FC_ERAS_CNT_100 ((uint8_t) 0x03)
|
||||
#define FC_ERAS_CNT_105 ((uint8_t) 0x04)
|
||||
#define FC_ERAS_CNT_110 ((uint8_t) 0x05)
|
||||
#define FC_ERAS_CNT_115 ((uint8_t) 0x06)
|
||||
#define FC_ERAS_CNT_120 ((uint8_t) 0x07)
|
||||
#define FC_ERAS_CNT_125 ((uint8_t) 0x08)
|
||||
#define FC_ERAS_CNT_130 ((uint8_t) 0x09)
|
||||
#define FC_ERAS_CNT_135 ((uint8_t) 0x0A)
|
||||
#define FC_ERAS_CNT_140 ((uint8_t) 0x0B)
|
||||
#define IS_FC_ERASE_CNT(param) ((param) <= FC_ERAS_CNT_140)
|
||||
|
||||
#define FC_SWPSR_BIT_0 ((uint8_t) 0x00)
|
||||
#define FC_SWPSR_BIT_1 ((uint8_t) 0x01)
|
||||
#define FC_SWPSR_BIT_2 ((uint8_t) 0x02)
|
||||
#define FC_SWPSR_BIT_3 ((uint8_t) 0x03)
|
||||
#define FC_SWPSR_BIT_4 ((uint8_t) 0x04)
|
||||
#define FC_SWPSR_BIT_5 ((uint8_t) 0x05)
|
||||
#define FC_SWPSR_BIT_6 ((uint8_t) 0x06)
|
||||
#define FC_SWPSR_BIT_7 ((uint8_t) 0x07)
|
||||
#define FC_SWPSR_BIT_8 ((uint8_t) 0x08)
|
||||
#define FC_SWPSR_BIT_9 ((uint8_t) 0x09)
|
||||
#define FC_SWPSR_BIT_10 ((uint8_t) 0x0A)
|
||||
#define IS_FC_SWPSR_BIT_NUM(param) ((param) <= FC_SWPSR_BIT_10)
|
||||
|
||||
#define FC_BIT_VALUE_0 ((uint32_t)0x00000000)
|
||||
#define FC_BIT_VALUE_1 ((uint32_t)0x00000001)
|
||||
|
||||
#ifdef SINGLE_BOOT_MODE
|
||||
#define FLASH_START_ADDR ((uint32_t)0x5E000000) /* SINGLE_BOOT_MODE */
|
||||
#else
|
||||
#define FLASH_START_ADDR ((uint32_t)0x00000000) /* User Boot Mode As Default */
|
||||
#endif
|
||||
|
||||
#define FLASH_END_ADDR (FLASH_START_ADDR + FLASH_CHIP_SIZE - 1U)
|
||||
|
||||
#ifdef SINGLE_BOOT_MODE
|
||||
#define IS_FC_ADDR(param) (((param) >= FLASH_START_ADDR) && \
|
||||
((param) <= FLASH_END_ADDR))
|
||||
#else
|
||||
#define IS_FC_ADDR(param) ((param) <= FLASH_END_ADDR)
|
||||
#endif
|
||||
|
||||
#define IS_FC_PAGE_ADDR(param) ((((param) > FLASH_START_ADDR) || ((param) == FLASH_START_ADDR)) && \
|
||||
((param) <= (FLASH_END_ADDR - PROGRAM_UNIT)))
|
||||
|
||||
|
||||
/** @} */
|
||||
/* End of group FC_Exported_Constants */
|
||||
|
||||
|
||||
/** @defgroup FC_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
void FC_SetSecurityBit(FunctionalState NewState);
|
||||
FunctionalState FC_GetSecurityBit(void);
|
||||
WorkState FC_GetBusyState(void);
|
||||
FunctionalState FC_GetBlockProtectState(uint8_t BlockNum);
|
||||
FunctionalState FC_GetPageProtectState(uint8_t PageNum);
|
||||
FunctionalState FC_GetAbortState(void);
|
||||
uint32_t FC_GetSwapSize(void);
|
||||
uint32_t FC_GetSwapState(void);
|
||||
void FC_SelectArea(uint8_t AreaNum, FunctionalState NewState);
|
||||
void FC_SetAbortion(void);
|
||||
void FC_ClearAbortion(void);
|
||||
void FC_SetClkDiv(uint8_t ClkDiv);
|
||||
void FC_SetProgramCount(uint8_t ProgramCount);
|
||||
void FC_SetEraseCounter(uint8_t EraseCounter);
|
||||
FC_Result FC_ProgramBlockProtectState(uint8_t BlockNum);
|
||||
FC_Result FC_ProgramPageProtectState(uint8_t PageNum);
|
||||
FC_Result FC_EraseProtectState(void);
|
||||
FC_Result FC_WritePage(uint32_t PageAddr, uint32_t * Data);
|
||||
FC_Result FC_EraseBlock(uint32_t BlockAddr);
|
||||
FC_Result FC_EraseArea(uint32_t AreaAddr);
|
||||
FC_Result FC_ErasePage(uint32_t PageAddr);
|
||||
FC_Result FC_EraseChip(void);
|
||||
FC_Result FC_SetSwpsrBit(uint8_t BitNum);
|
||||
uint32_t FC_GetSwpsrBitValue(uint8_t BitNum);
|
||||
|
||||
/** @} */
|
||||
/* End of group FC_Exported_FunctionPrototypes */
|
||||
|
||||
/** @} */
|
||||
/* End of group FC */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __TMPM46B_FC_H */
|
||||
@@ -0,0 +1,281 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_fuart.h
|
||||
* @brief This file provides all the functions prototypes for Full UART driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/26
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_FUART_H
|
||||
#define __TMPM46B_FUART_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup FUART
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FUART_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief FUART Init Structure definition
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint32_t BaudRate; /*!< This member configures the Full UART communication
|
||||
baud rate. */
|
||||
uint32_t DataBits; /*!< Specifies FUART transfer mode, which could be
|
||||
5-bit mode, 6-bit mode, 7-bit mode or 8-bit mode. */
|
||||
uint32_t StopBits; /*!< Specifies the length of stop bit transmission
|
||||
in Full UART. */
|
||||
uint32_t Parity; /*!< Specifies the parity mode which could be 0 parity,
|
||||
1 parity, odd parity, even parity or no parity. */
|
||||
uint32_t Mode; /*!< Enables or disables Receive, Transmit or
|
||||
both. */
|
||||
uint32_t FlowCtrl; /*!< Specifies the hardware flow control mode, which can be
|
||||
CTS flow control, RTS flow control or none flow control. */
|
||||
} FUART_InitTypeDef;
|
||||
|
||||
/** @} */
|
||||
/* End of group FUART_Exported_Types */
|
||||
|
||||
/** @defgroup FUART_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
#define FUART0 TSB_UART0
|
||||
#define FUART1 TSB_UART1
|
||||
#define TSB_FUART_TypeDef TSB_UART_TypeDef
|
||||
|
||||
#define IS_FUART_PERIPH(param) (((param) == FUART0) || \
|
||||
((param) == FUART1))
|
||||
|
||||
#define IS_FUART_BAUDRATE(param) (((param) != 0U) && \
|
||||
((param) <= 2950000U))
|
||||
|
||||
#define FUART_DATA_BITS_5 ((uint32_t)0x00000000)
|
||||
#define FUART_DATA_BITS_6 ((uint32_t)0x00000020)
|
||||
#define FUART_DATA_BITS_7 ((uint32_t)0x00000040)
|
||||
#define FUART_DATA_BITS_8 ((uint32_t)0x00000060)
|
||||
|
||||
#define IS_FUART_DATA_BITS(param) (((param) == FUART_DATA_BITS_5) || \
|
||||
((param) == FUART_DATA_BITS_6) || \
|
||||
((param) == FUART_DATA_BITS_7) || \
|
||||
((param) == FUART_DATA_BITS_8))
|
||||
|
||||
#define FUART_STOP_BITS_1 ((uint32_t)0x00000000)
|
||||
#define FUART_STOP_BITS_2 ((uint32_t)0x00000008)
|
||||
#define IS_FUART_STOPBITS(param) (((param) == FUART_STOP_BITS_1) || \
|
||||
((param) == FUART_STOP_BITS_2))
|
||||
|
||||
#define FUART_NO_PARITY ((uint32_t)0x00000000)
|
||||
#define FUART_0_PARITY ((uint32_t)0x00000086)
|
||||
#define FUART_1_PARITY ((uint32_t)0x00000082)
|
||||
#define FUART_EVEN_PARITY ((uint32_t)0x00000006)
|
||||
#define FUART_ODD_PARITY ((uint32_t)0x00000002)
|
||||
#define IS_FUART_PARITY(param) (((param) == FUART_NO_PARITY) || \
|
||||
((param) == FUART_0_PARITY) || \
|
||||
((param) == FUART_1_PARITY) || \
|
||||
((param) == FUART_EVEN_PARITY) || \
|
||||
((param) == FUART_ODD_PARITY))
|
||||
|
||||
#define FUART_ENABLE_RX ((uint32_t)0x00000200)
|
||||
#define FUART_ENABLE_TX ((uint32_t)0x00000100)
|
||||
#define IS_FUART_MODE(param) (((param) == FUART_ENABLE_RX) || \
|
||||
((param) == FUART_ENABLE_TX) || \
|
||||
((param) == (FUART_ENABLE_TX | FUART_ENABLE_RX)))
|
||||
|
||||
#define FUART_NONE_FLOW_CTRL ((uint32_t)0x00000000)
|
||||
#define FUART_CTS_FLOW_CTRL ((uint32_t)0x00008000)
|
||||
#define FUART_RTS_FLOW_CTRL ((uint32_t)0x00004000)
|
||||
#define IS_FUART_FLOW_CTRL(param) (((param) == FUART_NONE_FLOW_CTRL) || \
|
||||
((param) == FUART_CTS_FLOW_CTRL) || \
|
||||
((param) == FUART_RTS_FLOW_CTRL) || \
|
||||
((param) == (FUART_CTS_FLOW_CTRL | FUART_RTS_FLOW_CTRL)))
|
||||
|
||||
#define FUART_IRDA_3_16_BIT_PERIOD_MODE ((uint32_t)0x00000000)
|
||||
#define FUART_IRDA_3_TIMES_IRLPBAUD16_MODE ((uint32_t)0x00000004)
|
||||
#define IS_IRDA_ENCODE_MODE(param) (((param) == FUART_IRDA_3_16_BIT_PERIOD_MODE) || \
|
||||
((param) == FUART_IRDA_3_TIMES_IRLPBAUD16_MODE))
|
||||
|
||||
#define FUART_RX_FIFO_LEVEL_4 ((uint32_t)0x00000000)
|
||||
#define FUART_RX_FIFO_LEVEL_8 ((uint32_t)0x00000008)
|
||||
#define FUART_RX_FIFO_LEVEL_16 ((uint32_t)0x00000010)
|
||||
#define FUART_RX_FIFO_LEVEL_24 ((uint32_t)0x00000018)
|
||||
#define FUART_RX_FIFO_LEVEL_28 ((uint32_t)0x00000020)
|
||||
#define IS_FUART_RX_FIFO_LEVEL(param) (((param) == FUART_RX_FIFO_LEVEL_4) || \
|
||||
((param) == FUART_RX_FIFO_LEVEL_8) || \
|
||||
((param) == FUART_RX_FIFO_LEVEL_16) || \
|
||||
((param) == FUART_RX_FIFO_LEVEL_24) || \
|
||||
((param) == FUART_RX_FIFO_LEVEL_28))
|
||||
|
||||
#define FUART_TX_FIFO_LEVEL_4 ((uint32_t)0x00000000)
|
||||
#define FUART_TX_FIFO_LEVEL_8 ((uint32_t)0x00000001)
|
||||
#define FUART_TX_FIFO_LEVEL_16 ((uint32_t)0x00000002)
|
||||
#define FUART_TX_FIFO_LEVEL_24 ((uint32_t)0x00000003)
|
||||
#define FUART_TX_FIFO_LEVEL_28 ((uint32_t)0x00000004)
|
||||
#define IS_FUART_TX_FIFO_LEVEL(param) (((param) == FUART_TX_FIFO_LEVEL_4) || \
|
||||
((param) == FUART_TX_FIFO_LEVEL_8) || \
|
||||
((param) == FUART_TX_FIFO_LEVEL_16) || \
|
||||
((param) == FUART_TX_FIFO_LEVEL_24) || \
|
||||
((param) == FUART_TX_FIFO_LEVEL_28))
|
||||
|
||||
|
||||
#define FUART_NONE_INT_MASK ((uint32_t)0x00000000)
|
||||
#define FUART_RIN_MODEM_INT_MASK ((uint32_t)0x00000001)
|
||||
#define FUART_CTS_MODEM_INT_MASK ((uint32_t)0x00000002)
|
||||
#define FUART_DCD_MODEM_INT_MASK ((uint32_t)0x00000004)
|
||||
#define FUART_DSR_MODEM_INT_MASK ((uint32_t)0x00000008)
|
||||
#define FUART_RX_FIFO_INT_MASK ((uint32_t)0x00000010)
|
||||
#define FUART_TX_FIFO_INT_MASK ((uint32_t)0x00000020)
|
||||
#define FUART_RX_TIMEOUT_INT_MASK ((uint32_t)0x00000040)
|
||||
#define FUART_FRAMING_ERR_INT_MASK ((uint32_t)0x00000080)
|
||||
#define FUART_PARITY_ERR_INT_MASK ((uint32_t)0x00000100)
|
||||
#define FUART_BREAK_ERR_INT_MASK ((uint32_t)0x00000200)
|
||||
#define FUART_OVERRUN_ERR_INT_MASK ((uint32_t)0x00000400)
|
||||
#define FUART_ALL_INT_MASK ((uint32_t)0x000007FF)
|
||||
|
||||
#define IS_INT_MASK_SRC(param) ((param) <= FUART_ALL_INT_MASK)
|
||||
|
||||
#define IS_FUART_DATA(param) ((param) <= (uint32_t)0x000000FF)
|
||||
|
||||
#define IS_FUART_IRDA_DIVISOR(param) (((param) != (uint32_t)0x00000000) && \
|
||||
((param) <= (uint32_t)0x000000FF))
|
||||
/** @} */
|
||||
/* End of group FUART_Exported_Constants */
|
||||
|
||||
/** @addtogroup FUART_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
FUART_STORAGE_EMPTY = 0U,
|
||||
FUART_STORAGE_NORMAL = 1U,
|
||||
FUART_STORAGE_INVALID = 2U,
|
||||
FUART_STORAGE_FULL = 3U
|
||||
} FUART_StorageStatus;
|
||||
|
||||
typedef enum {
|
||||
FUART_RX = 0U,
|
||||
FUART_TX = 1U
|
||||
} FUART_Direction;
|
||||
|
||||
#define IS_FUART_DIRECTION(param) (((param) == FUART_RX) || \
|
||||
((param) == FUART_TX))
|
||||
|
||||
typedef enum {
|
||||
FUART_NO_ERR = 0U,
|
||||
FUART_OVERRUN = 1U,
|
||||
FUART_PARITY_ERR = 2U,
|
||||
FUART_FRAMING_ERR = 3U,
|
||||
FUART_BREAK_ERR = 4U,
|
||||
FUART_ERRS = 5U
|
||||
} FUART_Err;
|
||||
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t RIN:1; /* bit 0 */
|
||||
uint32_t CTS:1; /* bit 1 */
|
||||
uint32_t DCD:1; /* bit 2 */
|
||||
uint32_t DSR:1; /* bit 3 */
|
||||
uint32_t RxFIFO:1; /* bit 4 */
|
||||
uint32_t TxFIFO:1; /* bit 5 */
|
||||
uint32_t RxTimeout:1; /* bit 6 */
|
||||
uint32_t FramingErr:1; /* bit 7 */
|
||||
uint32_t ParityErr:1; /* bit 8 */
|
||||
uint32_t BreakErr:1; /* bit 9 */
|
||||
uint32_t OverrunErr:1; /* bit 10 */
|
||||
uint32_t Reserved:21; /* bit 11~31 */
|
||||
} Bit;
|
||||
} FUART_INTStatus;
|
||||
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t CTS:1; /* bit 0 */
|
||||
uint32_t DSR:1; /* bit 1 */
|
||||
uint32_t DCD:1; /* bit 2 */
|
||||
uint32_t Reserved1:5; /* bit 3~7 */
|
||||
uint32_t RI:1; /* bit 8 */
|
||||
uint32_t Reserved2:1; /* bit 9 */
|
||||
uint32_t DTR:1; /* bit 10 */
|
||||
uint32_t RTS:1; /* bit 11 */
|
||||
uint32_t Reserved3:20; /* bit 12~31 */
|
||||
} Bit;
|
||||
} FUART_AllModemStatus;
|
||||
|
||||
typedef enum {
|
||||
FUART_MODEM_STATUS_1 = 0U,
|
||||
FUART_MODEM_STATUS_0 = 1U
|
||||
} FUART_ModemStatus;
|
||||
|
||||
#define IS_MODEM_STATUS(param) (((param) == FUART_MODEM_STATUS_1) || \
|
||||
((param) == FUART_MODEM_STATUS_0))
|
||||
|
||||
/** @} */
|
||||
/* End of group FUART_Exported_Types */
|
||||
|
||||
/** @defgroup FUART_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
void FUART_Enable(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_Disable(TSB_FUART_TypeDef * FUARTx);
|
||||
uint32_t FUART_GetRxData(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_SetTxData(TSB_FUART_TypeDef * FUARTx, uint32_t Data);
|
||||
FUART_Err FUART_GetErrStatus(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_ClearErrStatus(TSB_FUART_TypeDef * FUARTx);
|
||||
WorkState FUART_GetBusyState(TSB_FUART_TypeDef * FUARTx);
|
||||
FUART_StorageStatus FUART_GetStorageStatus(TSB_FUART_TypeDef * FUARTx,
|
||||
FUART_Direction Direction);
|
||||
void FUART_SetIrDADivisor(TSB_FUART_TypeDef * FUARTx, uint32_t Divisor);
|
||||
void FUART_Init(TSB_FUART_TypeDef * FUARTx, FUART_InitTypeDef * InitStruct);
|
||||
void FUART_EnableFIFO(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_DisableFIFO(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_SetSendBreak(TSB_FUART_TypeDef * FUARTx, FunctionalState NewState);
|
||||
void FUART_SetIrDAEncodeMode(TSB_FUART_TypeDef * FUARTx, uint32_t Mode);
|
||||
Result FUART_EnableIrDA(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_DisableIrDA(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_SetINTFIFOLevel(TSB_FUART_TypeDef * FUARTx, uint32_t RxLevel, uint32_t TxLevel);
|
||||
void FUART_SetINTMask(TSB_FUART_TypeDef * FUARTx, uint32_t IntMaskSrc);
|
||||
FUART_INTStatus FUART_GetINTMask(TSB_FUART_TypeDef * FUARTx);
|
||||
FUART_INTStatus FUART_GetRawINTStatus(TSB_FUART_TypeDef * FUARTx);
|
||||
FUART_INTStatus FUART_GetMaskedINTStatus(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_ClearINT(TSB_FUART_TypeDef * FUARTx, FUART_INTStatus INTStatus);
|
||||
void FUART_SetDMAOnErr(TSB_FUART_TypeDef * FUARTx, FunctionalState NewState);
|
||||
void FUART_SetFIFODMA(TSB_FUART_TypeDef * FUARTx, FUART_Direction Direction,
|
||||
FunctionalState NewState);
|
||||
FUART_AllModemStatus FUART_GetModemStatus(TSB_FUART_TypeDef * FUARTx);
|
||||
void FUART_SetRTSStatus(TSB_FUART_TypeDef * FUARTx, FUART_ModemStatus Status);
|
||||
void FUART_SetDTRStatus(TSB_FUART_TypeDef * FUARTx, FUART_ModemStatus Status);
|
||||
|
||||
/** @} */
|
||||
/* End of group FUART_Exported_FunctionPrototypes */
|
||||
|
||||
/** @} */
|
||||
/* End of group FUART */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __TMPM46B_FUART_H */
|
||||
@@ -0,0 +1,217 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_gpio.h
|
||||
* @brief This file provides all the functions prototypes for GPIO driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/09
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_GPIO_H
|
||||
#define __TMPM46B_GPIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
/** @addtogroup GPIO
|
||||
* @{
|
||||
*/
|
||||
/** @addtogroup GPIO_Parameter_Definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief :The maximum number of the Function Register
|
||||
* Note for porting:
|
||||
* If function register 6 is the maximum number in
|
||||
* all the GPIO port,then define FRMAX (6U)
|
||||
*/
|
||||
#define FRMAX (6U) /* the max number of Port I/O function register is 6 */
|
||||
|
||||
/** @brief: define for function register
|
||||
* Note for porting:
|
||||
* If the maximum number of the function Register is 6,
|
||||
* then you need to define 6 GPIO_FUNC_REG_x ,
|
||||
* the value should be increased from 0 to 5
|
||||
*/
|
||||
#define GPIO_FUNC_REG_1 ((uint8_t)0x00)
|
||||
#define GPIO_FUNC_REG_2 ((uint8_t)0x01)
|
||||
#define GPIO_FUNC_REG_3 ((uint8_t)0x02)
|
||||
#define GPIO_FUNC_REG_4 ((uint8_t)0x03)
|
||||
#define GPIO_FUNC_REG_5 ((uint8_t)0x04)
|
||||
#define GPIO_FUNC_REG_6 ((uint8_t)0x05)
|
||||
|
||||
/** @brief :The GPIO_Port enum
|
||||
* Note for porting:
|
||||
* the port value order from low to high with '1' step
|
||||
* and begin with "0".
|
||||
*/
|
||||
typedef enum {
|
||||
GPIO_PA = 0U,
|
||||
GPIO_PB = 1U,
|
||||
GPIO_PC = 2U,
|
||||
GPIO_PD = 3U,
|
||||
GPIO_PE = 4U,
|
||||
GPIO_PF = 5U,
|
||||
GPIO_PG = 6U,
|
||||
GPIO_PH = 7U,
|
||||
GPIO_PJ = 8U,
|
||||
GPIO_PK = 9U,
|
||||
GPIO_PL = 10U
|
||||
} GPIO_Port;
|
||||
|
||||
#define IS_GPIO_PORT(param) ((param) <= GPIO_PL) /* parameter checking for port number */
|
||||
|
||||
#define RESER (8U-(FRMAX))
|
||||
|
||||
typedef struct {
|
||||
__IO uint32_t DATA;
|
||||
__IO uint32_t CR;
|
||||
__IO uint32_t FR[FRMAX];
|
||||
uint32_t RESERVED0[RESER];
|
||||
__IO uint32_t OD;
|
||||
__IO uint32_t PUP;
|
||||
__IO uint32_t PDN;
|
||||
uint32_t RESERVED1;
|
||||
__IO uint32_t IE;
|
||||
} TSB_Port_TypeDef;
|
||||
|
||||
typedef struct {
|
||||
uint8_t PinDATA;
|
||||
uint8_t PinCR;
|
||||
uint8_t PinFR[FRMAX];
|
||||
uint8_t PinOD;
|
||||
uint8_t PinPUP;
|
||||
uint8_t PinPDN;
|
||||
uint8_t PinIE;
|
||||
} GPIO_RegTypeDef;
|
||||
|
||||
typedef struct {
|
||||
uint8_t IOMode; /* Set the port input or output mode */
|
||||
uint8_t PullUp; /* Enable or disable Pull-up function */
|
||||
uint8_t OpenDrain; /* Enable or disable open drain function */
|
||||
uint8_t PullDown; /* Enable or disable Pull-down function */
|
||||
} GPIO_InitTypeDef;
|
||||
|
||||
#define GPIO_INPUT_MODE ((uint8_t)0x00)
|
||||
#define GPIO_OUTPUT_MODE ((uint8_t)0x01)
|
||||
#define GPIO_IO_MODE_NONE ((uint8_t)0x02)
|
||||
#define IS_GPIO_IO_MODE_STATE(param) (((param) == GPIO_INPUT_MODE) || \
|
||||
((param) == GPIO_OUTPUT_MODE) || \
|
||||
((param) == GPIO_IO_MODE_NONE))
|
||||
|
||||
#define GPIO_PULLUP_DISABLE ((uint8_t)0x00)
|
||||
#define GPIO_PULLUP_ENABLE ((uint8_t)0x01)
|
||||
#define GPIO_PULLUP_NONE ((uint8_t)0x02)
|
||||
#define IS_GPIO_PULLUP_STATE(param) (((param) == GPIO_PULLUP_ENABLE) || \
|
||||
((param) == GPIO_PULLUP_DISABLE) || \
|
||||
((param) == GPIO_PULLUP_NONE))
|
||||
|
||||
#define GPIO_PULLDOWN_DISABLE ((uint8_t)0x00)
|
||||
#define GPIO_PULLDOWN_ENABLE ((uint8_t)0x01)
|
||||
#define GPIO_PULLDOWN_NONE ((uint8_t)0x02)
|
||||
#define IS_GPIO_PULLDOWN_STATE(param) (((param) == GPIO_PULLDOWN_ENABLE) || \
|
||||
((param) == GPIO_PULLDOWN_DISABLE) || \
|
||||
((param) == GPIO_PULLDOWN_NONE))
|
||||
|
||||
#define GPIO_OPEN_DRAIN_DISABLE ((uint8_t)0x00)
|
||||
#define GPIO_OPEN_DRAIN_ENABLE ((uint8_t)0x01)
|
||||
#define GPIO_OPEN_DRAIN_NONE ((uint8_t)0x02)
|
||||
#define IS_GPIO_OPEN_DRAIN_STATE(param) (((param) == GPIO_OPEN_DRAIN_ENABLE) || \
|
||||
((param) == GPIO_OPEN_DRAIN_DISABLE) || \
|
||||
((param) == GPIO_OPEN_DRAIN_NONE))
|
||||
|
||||
#define GPIO_BIT_VALUE_1 ((uint8_t)0x01)
|
||||
#define GPIO_BIT_VALUE_0 ((uint8_t)0x00)
|
||||
|
||||
#define IS_GPIO_BIT_VALUE(BitValue) (((BitValue) == GPIO_BIT_VALUE_1)|| \
|
||||
((BitValue) == GPIO_BIT_VALUE_0))
|
||||
|
||||
#define GPIO_BIT_0 ((uint8_t)0x01)
|
||||
#define GPIO_BIT_1 ((uint8_t)0x02)
|
||||
#define GPIO_BIT_2 ((uint8_t)0x04)
|
||||
#define GPIO_BIT_3 ((uint8_t)0x08)
|
||||
#define GPIO_BIT_4 ((uint8_t)0x10)
|
||||
#define GPIO_BIT_5 ((uint8_t)0x20)
|
||||
#define GPIO_BIT_6 ((uint8_t)0x40)
|
||||
#define GPIO_BIT_7 ((uint8_t)0x80)
|
||||
#define GPIO_BIT_ALL ((uint8_t)0xFF)
|
||||
|
||||
#define IS_GPIO_WRITE(GPIO_x) (GPIO_SFRs[(GPIO_x)].PinCR)
|
||||
|
||||
#define IS_GPIO_BIT_DATA(GPIO_x,Bit_x) ((((GPIO_SFRs[(GPIO_x)].PinDATA) & (Bit_x))&&\
|
||||
(!((uint8_t)(~(GPIO_SFRs[(GPIO_x)].PinDATA))&(Bit_x)))))
|
||||
|
||||
#define IS_GPIO_BIT_OUT(GPIO_x,Bit_x) (((GPIO_SFRs[(GPIO_x)].PinCR &(Bit_x))&&\
|
||||
(!((uint8_t)(~GPIO_SFRs[(GPIO_x)].PinCR)&(Bit_x)))))
|
||||
|
||||
#define IS_GPIO_BIT_IN(GPIO_x,Bit_x) (((GPIO_SFRs[(GPIO_x)].PinIE &(Bit_x))&&\
|
||||
(!((uint8_t)(~GPIO_SFRs[(GPIO_x)].PinIE)&(Bit_x)))))
|
||||
|
||||
#define IS_GPIO_BIT_PUP(GPIO_x,Bit_x) (((GPIO_SFRs[(GPIO_x)].PinPUP &(Bit_x))&&\
|
||||
(!((uint8_t)(~GPIO_SFRs[(GPIO_x)].PinPUP)&(Bit_x)))))
|
||||
|
||||
#define IS_GPIO_BIT_PDN(GPIO_x,Bit_x) (((GPIO_SFRs[(GPIO_x)].PinPDN &(Bit_x))&&\
|
||||
(!((uint8_t)(~GPIO_SFRs[(GPIO_x)].PinPDN)&(Bit_x)))))
|
||||
|
||||
#define IS_GPIO_BIT_OD(GPIO_x,Bit_x) (((GPIO_SFRs[(GPIO_x)].PinOD &(Bit_x))&&\
|
||||
(!((uint8_t)(~GPIO_SFRs[(GPIO_x)].PinOD)&(Bit_x)))))
|
||||
|
||||
#define IS_GPIO_BIT_FR(GPIO_x,FuncReg_x,Bit_x) (((GPIO_SFRs[(GPIO_x)].PinFR[(FuncReg_x)]&(Bit_x))&&\
|
||||
(!((uint8_t)(~GPIO_SFRs[(GPIO_x)].PinFR[(FuncReg_x)])&(Bit_x)))))
|
||||
|
||||
#define IS_GPIO_FUNCTION_REG(param) ((param) < (FRMAX))
|
||||
|
||||
#define IS_GPIO_BIT(param) (((param) == GPIO_BIT_0)|| \
|
||||
((param) == GPIO_BIT_1)|| \
|
||||
((param) == GPIO_BIT_2)|| \
|
||||
((param) == GPIO_BIT_3)|| \
|
||||
((param) == GPIO_BIT_4)|| \
|
||||
((param) == GPIO_BIT_5)|| \
|
||||
((param) == GPIO_BIT_6)|| \
|
||||
((param) == GPIO_BIT_7))
|
||||
/** @} */
|
||||
/* End of group GPIO_Bit_Define */
|
||||
|
||||
/** @defgroup GPIO_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
uint8_t GPIO_ReadData(GPIO_Port GPIO_x);
|
||||
uint8_t GPIO_ReadDataBit(GPIO_Port GPIO_x, uint8_t Bit_x);
|
||||
void GPIO_WriteData(GPIO_Port GPIO_x, uint8_t Data);
|
||||
void GPIO_WriteDataBit(GPIO_Port GPIO_x, uint8_t Bit_x, uint8_t BitValue);
|
||||
void GPIO_Init(GPIO_Port GPIO_x, uint8_t Bit_x, GPIO_InitTypeDef * GPIO_InitStruct);
|
||||
void GPIO_SetOutput(GPIO_Port GPIO_x, uint8_t Bit_x);
|
||||
void GPIO_SetInput(GPIO_Port GPIO_x, uint8_t Bit_x);
|
||||
void GPIO_SetInputEnableReg(GPIO_Port GPIO_x, uint8_t Bit_x, FunctionalState NewState);
|
||||
void GPIO_SetOutputEnableReg(GPIO_Port GPIO_x, uint8_t Bit_x, FunctionalState NewState);
|
||||
void GPIO_SetPullUp(GPIO_Port GPIO_x, uint8_t Bit_x, FunctionalState NewState);
|
||||
void GPIO_SetPullDown(GPIO_Port GPIO_x, uint8_t Bit_x, FunctionalState NewState);
|
||||
void GPIO_SetOpenDrain(GPIO_Port GPIO_x, uint8_t Bit_x, FunctionalState NewState);
|
||||
void GPIO_EnableFuncReg(GPIO_Port GPIO_x, uint8_t FuncReg_x, uint8_t Bit_x);
|
||||
void GPIO_DisableFuncReg(GPIO_Port GPIO_x, uint8_t FuncReg_x, uint8_t Bit_x);
|
||||
|
||||
/** @} */
|
||||
/* End of group GPIO_Exported_FunctionPrototypes */
|
||||
/** @} */
|
||||
/* End of group GPIO */
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __TMPM46B_GPIO_H */
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_i2c.h
|
||||
* @brief This file provides all the functions prototypes for I2C driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/13
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_I2C_H
|
||||
#define __TMPM46B_I2C_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup I2C
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup I2C_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t I2CSelfAddr; /*!< Specify self-address of the I2C channel in I2C mode */
|
||||
uint32_t I2CDataLen; /*!< Specify data length of the I2C channel in I2C mode */
|
||||
FunctionalState I2CACKState; /*!< Enable or disable the generation of ACK clock */
|
||||
uint32_t I2CClkDiv; /*!< Select the division of the prescaler clock for generating the serial clock */
|
||||
uint32_t PrescalerClkDiv; /*!< Select the division of fsys for generating the fprsck */
|
||||
} I2C_InitTypeDef;
|
||||
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t LastRxBit:1;
|
||||
uint32_t GeneralCall:1;
|
||||
uint32_t SlaveAddrMatch:1;
|
||||
uint32_t ArbitrationLost:1;
|
||||
uint32_t INTReq:1;
|
||||
uint32_t BusState:1;
|
||||
uint32_t TRx:1;
|
||||
uint32_t MasterSlave:1;
|
||||
} Bit;
|
||||
} I2C_State;
|
||||
|
||||
#define I2C_CHANNEL_NUMBER 3U
|
||||
#define IS_I2C_PERIPH(param) (((param) == TSB_I2C0) || \
|
||||
((param) == TSB_I2C1) || \
|
||||
((param) == TSB_I2C2))
|
||||
|
||||
#define I2C_DATA_LEN_8 ((uint32_t)0x00000000)
|
||||
#define I2C_DATA_LEN_1 ((uint32_t)0x00000001)
|
||||
#define I2C_DATA_LEN_2 ((uint32_t)0x00000002)
|
||||
#define I2C_DATA_LEN_3 ((uint32_t)0x00000003)
|
||||
#define I2C_DATA_LEN_4 ((uint32_t)0x00000004)
|
||||
#define I2C_DATA_LEN_5 ((uint32_t)0x00000005)
|
||||
#define I2C_DATA_LEN_6 ((uint32_t)0x00000006)
|
||||
#define I2C_DATA_LEN_7 ((uint32_t)0x00000007)
|
||||
|
||||
#define I2C_SCK_CLK_DIV_20 ((uint32_t)0x00000000)
|
||||
#define I2C_SCK_CLK_DIV_24 ((uint32_t)0x00000001)
|
||||
#define I2C_SCK_CLK_DIV_32 ((uint32_t)0x00000002)
|
||||
#define I2C_SCK_CLK_DIV_48 ((uint32_t)0x00000003)
|
||||
#define I2C_SCK_CLK_DIV_80 ((uint32_t)0x00000004)
|
||||
#define I2C_SCK_CLK_DIV_144 ((uint32_t)0x00000005)
|
||||
#define I2C_SCK_CLK_DIV_272 ((uint32_t)0x00000006)
|
||||
#define I2C_SCK_CLK_DIV_528 ((uint32_t)0x00000007)
|
||||
#define IS_I2C_SCK_CLK_DIV(param) (((param) == I2C_SCK_CLK_DIV_20) || \
|
||||
((param) == I2C_SCK_CLK_DIV_24) || \
|
||||
((param) == I2C_SCK_CLK_DIV_32) || \
|
||||
((param) == I2C_SCK_CLK_DIV_48) || \
|
||||
((param) == I2C_SCK_CLK_DIV_80) || \
|
||||
((param) == I2C_SCK_CLK_DIV_144) || \
|
||||
((param) == I2C_SCK_CLK_DIV_272) || \
|
||||
((param) == I2C_SCK_CLK_DIV_528))
|
||||
|
||||
#define I2C_PRESCALER_DIV_1 ((uint32_t)0x00000001)
|
||||
#define I2C_PRESCALER_DIV_2 ((uint32_t)0x00000002)
|
||||
#define I2C_PRESCALER_DIV_3 ((uint32_t)0x00000003)
|
||||
#define I2C_PRESCALER_DIV_4 ((uint32_t)0x00000004)
|
||||
#define I2C_PRESCALER_DIV_5 ((uint32_t)0x00000005)
|
||||
#define I2C_PRESCALER_DIV_6 ((uint32_t)0x00000006)
|
||||
#define I2C_PRESCALER_DIV_7 ((uint32_t)0x00000007)
|
||||
#define I2C_PRESCALER_DIV_8 ((uint32_t)0x00000008)
|
||||
#define I2C_PRESCALER_DIV_9 ((uint32_t)0x00000009)
|
||||
#define I2C_PRESCALER_DIV_10 ((uint32_t)0x0000000A)
|
||||
#define I2C_PRESCALER_DIV_11 ((uint32_t)0x0000000B)
|
||||
#define I2C_PRESCALER_DIV_12 ((uint32_t)0x0000000C)
|
||||
#define I2C_PRESCALER_DIV_13 ((uint32_t)0x0000000D)
|
||||
#define I2C_PRESCALER_DIV_14 ((uint32_t)0x0000000E)
|
||||
#define I2C_PRESCALER_DIV_15 ((uint32_t)0x0000000F)
|
||||
#define I2C_PRESCALER_DIV_16 ((uint32_t)0x00000010)
|
||||
#define I2C_PRESCALER_DIV_17 ((uint32_t)0x00000011)
|
||||
#define I2C_PRESCALER_DIV_18 ((uint32_t)0x00000012)
|
||||
#define I2C_PRESCALER_DIV_19 ((uint32_t)0x00000013)
|
||||
#define I2C_PRESCALER_DIV_20 ((uint32_t)0x00000014)
|
||||
#define I2C_PRESCALER_DIV_21 ((uint32_t)0x00000015)
|
||||
#define I2C_PRESCALER_DIV_22 ((uint32_t)0x00000016)
|
||||
#define I2C_PRESCALER_DIV_23 ((uint32_t)0x00000017)
|
||||
#define I2C_PRESCALER_DIV_24 ((uint32_t)0x00000018)
|
||||
#define I2C_PRESCALER_DIV_25 ((uint32_t)0x00000019)
|
||||
#define I2C_PRESCALER_DIV_26 ((uint32_t)0x0000001A)
|
||||
#define I2C_PRESCALER_DIV_27 ((uint32_t)0x0000001B)
|
||||
#define I2C_PRESCALER_DIV_28 ((uint32_t)0x0000001C)
|
||||
#define I2C_PRESCALER_DIV_29 ((uint32_t)0x0000001D)
|
||||
#define I2C_PRESCALER_DIV_30 ((uint32_t)0x0000001E)
|
||||
#define I2C_PRESCALER_DIV_31 ((uint32_t)0x0000001F)
|
||||
#define I2C_PRESCALER_DIV_32 ((uint32_t)0x00000020)
|
||||
|
||||
/** @} */
|
||||
/* End of group I2C_Exported_Types */
|
||||
|
||||
/** @defgroup I2C_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
#define IS_PRESCALER_CLK_VALID(param1, param2) (((param1) >= I2C_PRESCALER_DIV_1) && \
|
||||
((param1) <= I2C_PRESCALER_DIV_32) && \
|
||||
(((param2) / (param1)) > 666666U) && \
|
||||
(((param2) / (param1)) < 20000000U))
|
||||
|
||||
#define IS_I2C_DATA(param) ((param) <= (uint32_t)0x000000FF)
|
||||
|
||||
#define IS_I2C_BIT_NUM(param) ((param) <= (uint32_t)0x00000007)
|
||||
|
||||
#define IS_I2C_ADDR(param) (((param) < (uint32_t)0x000000FF) && \
|
||||
(!((param) & (uint32_t)0x00000001)))
|
||||
|
||||
/** @} */
|
||||
/* End of group I2C_Exported_Macros */
|
||||
|
||||
/** @defgroup I2C_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
void I2C_SetACK(TSB_I2C_TypeDef * I2Cx, FunctionalState NewState);
|
||||
void I2C_Init(TSB_I2C_TypeDef * I2Cx, I2C_InitTypeDef * InitI2CStruct);
|
||||
void I2C_SetBitNum(TSB_I2C_TypeDef * I2Cx, uint32_t I2CBitNum);
|
||||
void I2C_SWReset(TSB_I2C_TypeDef * I2Cx);
|
||||
void I2C_ClearINTReq(TSB_I2C_TypeDef * I2Cx);
|
||||
void I2C_GenerateStart(TSB_I2C_TypeDef * I2Cx);
|
||||
void I2C_GenerateStop(TSB_I2C_TypeDef * I2Cx);
|
||||
I2C_State I2C_GetState(TSB_I2C_TypeDef * I2Cx);
|
||||
void I2C_SetSendData(TSB_I2C_TypeDef * I2Cx, uint32_t Data);
|
||||
uint32_t I2C_GetReceiveData(TSB_I2C_TypeDef * I2Cx);
|
||||
void I2C_SetFreeDataMode(TSB_I2C_TypeDef * I2Cx, FunctionalState NewState);
|
||||
FunctionalState I2C_GetSlaveAddrMatchState(TSB_I2C_TypeDef * I2Cx);
|
||||
void I2C_SetPrescalerClock(TSB_I2C_TypeDef * I2Cx, uint32_t PrescalerClock);
|
||||
void I2C_SetINTReq(TSB_I2C_TypeDef * I2Cx, FunctionalState NewState);
|
||||
FunctionalState I2C_GetINTStatus(TSB_I2C_TypeDef * I2Cx);
|
||||
void I2C_ClearINTOutput(TSB_I2C_TypeDef * I2Cx);
|
||||
/** @} */
|
||||
/* End of group I2C_Exported_FunctionPrototypes */
|
||||
|
||||
/** @} */
|
||||
/* End of group I2C */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __TMPM46B_I2C_H */
|
||||
@@ -0,0 +1,237 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_rtc.h
|
||||
* @brief This file provides all the functions prototypes for RTC driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/11
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_RTC_H
|
||||
#define __TMPM46B_RTC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup RTC
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief RTC Structure definition
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint8_t HourMode; /*!< Select RTC 12-Hour mode or 24-Hour mode */
|
||||
uint8_t Hour; /*!< Set RTC hour value */
|
||||
uint8_t AmPm; /*!< Select AM/PM mode in 12H mode */
|
||||
uint8_t Min; /*!< Set RTC minute value */
|
||||
uint8_t Sec; /*!< Set RTC second value */
|
||||
} RTC_TimeTypeDef;
|
||||
|
||||
typedef struct {
|
||||
uint8_t LeapYear; /*!< Select RTC Leap-Year status */
|
||||
uint8_t Year; /*!< Set RTC year value */
|
||||
uint8_t Month; /*!< Set RTC month value */
|
||||
uint8_t Date; /*!< Set RTC date value */
|
||||
uint8_t Day; /*!< Set RTC day value */
|
||||
} RTC_DateTypeDef;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Date; /*!< Set alarm date value */
|
||||
uint8_t Day; /*!< Set alarm day value */
|
||||
uint8_t Hour; /*!< Set alarm hour value */
|
||||
uint8_t AmPm; /*!< Select AM/PM mode in 12H mode */
|
||||
uint8_t Min; /*!< Set alarm minute value */
|
||||
} RTC_AlarmTypeDef;
|
||||
|
||||
/** @} */
|
||||
/* End of group RTC_Exported_Types */
|
||||
|
||||
/** @defgroup RTC_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define RTC_24_HOUR_MODE ((uint8_t)0x01)
|
||||
#define RTC_12_HOUR_MODE ((uint8_t)0x00)
|
||||
#define IS_RTC_HOUR_MODE(param) (((param) == RTC_24_HOUR_MODE) || \
|
||||
((param) == RTC_12_HOUR_MODE))
|
||||
|
||||
#define RTC_AM_MODE ((uint8_t)0x00)
|
||||
#define RTC_PM_MODE ((uint8_t)0x01)
|
||||
#define RTC_AMPM_INVALID ((uint8_t)0x02)
|
||||
#define IS_RTC_AMPM_MODE(param) (((param) == RTC_AM_MODE) || \
|
||||
((param) == RTC_PM_MODE))
|
||||
|
||||
#define RTC_LEAP_YEAR_0 ((uint8_t)0x00)
|
||||
#define RTC_LEAP_YEAR_1 ((uint8_t)0x01)
|
||||
#define RTC_LEAP_YEAR_2 ((uint8_t)0x02)
|
||||
#define RTC_LEAP_YEAR_3 ((uint8_t)0x03)
|
||||
#define IS_RTC_LEAP_YEAR(param) (((param) == RTC_LEAP_YEAR_0) || \
|
||||
((param) == RTC_LEAP_YEAR_1) || \
|
||||
((param) == RTC_LEAP_YEAR_2) || \
|
||||
((param) == RTC_LEAP_YEAR_3))
|
||||
|
||||
#define RTC_SUN ((uint8_t)0x00)
|
||||
#define RTC_MON ((uint8_t)0x01)
|
||||
#define RTC_TUE ((uint8_t)0x02)
|
||||
#define RTC_WED ((uint8_t)0x03)
|
||||
#define RTC_THU ((uint8_t)0x04)
|
||||
#define RTC_FRI ((uint8_t)0x05)
|
||||
#define RTC_SAT ((uint8_t)0x06)
|
||||
#define IS_RTC_DAY(param) (((param) == RTC_SUN) || \
|
||||
((param) == RTC_MON) || \
|
||||
((param) == RTC_TUE) || \
|
||||
((param) == RTC_WED) || \
|
||||
((param) == RTC_THU) || \
|
||||
((param) == RTC_FRI) || \
|
||||
((param) == RTC_SAT))
|
||||
|
||||
#define RTC_LOW_LEVEL ((uint8_t)0x00)
|
||||
#define RTC_PULSE_1_HZ ((uint8_t)0x01)
|
||||
#define RTC_PULSE_16_HZ ((uint8_t)0x02)
|
||||
#define RTC_PULSE_2_HZ ((uint8_t)0x03)
|
||||
#define RTC_PULSE_4_HZ ((uint8_t)0x04)
|
||||
#define RTC_PULSE_8_HZ ((uint8_t)0x05)
|
||||
#define IS_RTC_ALARM_OUTPUT(param) (((param) == RTC_LOW_LEVEL) || \
|
||||
((param) == RTC_PULSE_1_HZ) || \
|
||||
((param) == RTC_PULSE_16_HZ)|| \
|
||||
((param) == RTC_PULSE_2_HZ) || \
|
||||
((param) == RTC_PULSE_4_HZ) || \
|
||||
((param) == RTC_PULSE_8_HZ))
|
||||
|
||||
#define IS_RTC_YEAR(param) ((param) <= 99U)
|
||||
|
||||
#define IS_RTC_MONTH(param) (((param) >= 1U)&&((param) <= 12U))
|
||||
|
||||
#define IS_RTC_DATE(param) (((param) >= 1U)&&((param) <= 31U))
|
||||
|
||||
#define IS_RTC_HOUR_24(param) ((param) <= 23U)
|
||||
|
||||
#define IS_RTC_HOUR_12(param) ((param) <= 11U)
|
||||
|
||||
#define IS_RTC_MINUTE(param) ((param) <= 59U)
|
||||
|
||||
#define IS_RTC_SECOND(param) ((param) <= 59U)
|
||||
|
||||
#define RTC_ADJ_TIME_1_SEC ((uint8_t)0x00)
|
||||
#define RTC_ADJ_TIME_10_SEC ((uint8_t)0x02)
|
||||
#define RTC_ADJ_TIME_20_SEC ((uint8_t)0x04)
|
||||
#define RTC_ADJ_TIME_30_SEC ((uint8_t)0x06)
|
||||
#define RTC_ADJ_TIME_1_MIN ((uint8_t)0x08)
|
||||
#define IS_RTC_ADJ_TIME(param) (((param) == RTC_ADJ_TIME_1_SEC) || \
|
||||
((param) == RTC_ADJ_TIME_10_SEC) || \
|
||||
((param) == RTC_ADJ_TIME_20_SEC) || \
|
||||
((param) == RTC_ADJ_TIME_30_SEC) || \
|
||||
((param) == RTC_ADJ_TIME_1_MIN))
|
||||
/** @} */
|
||||
/* End of group RTC_Exported_Constants */
|
||||
|
||||
/** @defgroup RTC_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
RTC_NO_REQ = 0U,
|
||||
RTC_REQ = 1U
|
||||
} RTC_ReqState;
|
||||
|
||||
typedef enum {
|
||||
RTC_CLOCK_MODE = 0U,
|
||||
RTC_ALARM_MODE = 1U
|
||||
} RTC_FuncMode;
|
||||
#define IS_RTC_FUNC_MODE(param) (((param) == RTC_CLOCK_MODE) || \
|
||||
((param) == RTC_ALARM_MODE))
|
||||
|
||||
typedef enum {
|
||||
RTC_CORRECTION_PLUS = 0U,
|
||||
RTC_CORRECTION_MINUS = 1U
|
||||
} RTC_CorrectionMode;
|
||||
#define IS_RTC_CORRECTION_MODE(param) (((param) == RTC_CORRECTION_PLUS) || \
|
||||
((param) == RTC_CORRECTION_MINUS))
|
||||
|
||||
#define IS_RTC_PLUS_VALUE(param) ((param) <= 255U)
|
||||
#define IS_RTC_MINUS_VALUE(param) (((param) >= 1U)&&((param) <= 256U))
|
||||
/** @} */
|
||||
/* End of group RTC_Exported_Types */
|
||||
|
||||
/** @defgroup RTC_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
void RTC_SetSec(uint8_t Sec);
|
||||
uint8_t RTC_GetSec(void);
|
||||
void RTC_SetMin(RTC_FuncMode NewMode, uint8_t Min);
|
||||
uint8_t RTC_GetMin(RTC_FuncMode NewMode);
|
||||
uint8_t RTC_GetAMPM(RTC_FuncMode NewMode);
|
||||
void RTC_SetHour24(RTC_FuncMode NewMode, uint8_t Hour);
|
||||
void RTC_SetHour12(RTC_FuncMode NewMode, uint8_t Hour, uint8_t AmPm);
|
||||
uint8_t RTC_GetHour(RTC_FuncMode NewMode);
|
||||
void RTC_SetDay(RTC_FuncMode NewMode, uint8_t Day);
|
||||
uint8_t RTC_GetDay(RTC_FuncMode NewMode);
|
||||
void RTC_SetDate(RTC_FuncMode NewMode, uint8_t Date);
|
||||
uint8_t RTC_GetDate(RTC_FuncMode NewMode);
|
||||
void RTC_SetMonth(uint8_t Month);
|
||||
uint8_t RTC_GetMonth(void);
|
||||
void RTC_SetYear(uint8_t Year);
|
||||
uint8_t RTC_GetYear(void);
|
||||
void RTC_SetHourMode(uint8_t HourMode);
|
||||
uint8_t RTC_GetHourMode(void);
|
||||
void RTC_SetLeapYear(uint8_t LeapYear);
|
||||
uint8_t RTC_GetLeapYear(void);
|
||||
void RTC_SetTimeAdjustReq(void);
|
||||
RTC_ReqState RTC_GetTimeAdjustReq(void);
|
||||
void RTC_EnableClock(void);
|
||||
void RTC_DisableClock(void);
|
||||
void RTC_EnableAlarm(void);
|
||||
void RTC_DisableAlarm(void);
|
||||
void RTC_SetRTCINT(FunctionalState NewState);
|
||||
void RTC_SetAlarmOutput(uint8_t Output);
|
||||
void RTC_ResetAlarm(void);
|
||||
void RTC_ResetClockSec(void);
|
||||
RTC_ReqState RTC_GetResetClockSecReq(void);
|
||||
void RTC_SetDateValue(RTC_DateTypeDef * DateStruct);
|
||||
void RTC_GetDateValue(RTC_DateTypeDef * DateStruct);
|
||||
void RTC_SetTimeValue(RTC_TimeTypeDef * TimeStruct);
|
||||
void RTC_GetTimeValue(RTC_TimeTypeDef * TimeStruct);
|
||||
void RTC_SetClockValue(RTC_DateTypeDef * DateStruct, RTC_TimeTypeDef * TimeStruct);
|
||||
void RTC_GetClockValue(RTC_DateTypeDef * DateStruct, RTC_TimeTypeDef * TimeStruct);
|
||||
void RTC_SetAlarmValue(RTC_AlarmTypeDef * AlarmStruct);
|
||||
void RTC_GetAlarmValue(RTC_AlarmTypeDef * AlarmStruct);
|
||||
void RTC_SetProtectCtrl(FunctionalState NewState);
|
||||
void RTC_EnableCorrection(void);
|
||||
void RTC_DisableCorrection(void);
|
||||
void RTC_SetCorrectionTime(uint8_t Time);
|
||||
void RTC_SetCorrectionValue(RTC_CorrectionMode Mode, uint16_t Cnt);
|
||||
|
||||
/** @} */
|
||||
/* End of group RTC_Exported_FunctionPrototype */
|
||||
|
||||
/** @} */
|
||||
/* End of group RTC */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __TMPM46B_RTC_H */
|
||||
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_ssp.h
|
||||
* @brief This file provides all the functions prototypes for SSP driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/05
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_SSP_H
|
||||
#define __TMPM46B_SSP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup SSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup SSP_Exported_types
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define IS_SSP_PERIPH(param) (((param) == TSB_SSP0) || \
|
||||
((param) == TSB_SSP1) || \
|
||||
((param) == TSB_SSP2) )
|
||||
|
||||
typedef enum {
|
||||
SSP_FORMAT_SPI = 0U,
|
||||
SSP_FORMAT_SSI = 1U,
|
||||
SSP_FORMAT_MICROWIRE = 2U
|
||||
} SSP_FrameFormat;
|
||||
#define IS_SSP_FRAME_FORMAT(param) (((param) == SSP_FORMAT_SPI) || \
|
||||
((param) == SSP_FORMAT_SSI) || \
|
||||
((param) == SSP_FORMAT_MICROWIRE))
|
||||
|
||||
typedef enum {
|
||||
SSP_POLARITY_LOW = 0U,
|
||||
SSP_POLARITY_HIGH = 1U
|
||||
} SSP_ClkPolarity;
|
||||
#define IS_SSP_CLK_POLARITY(param) (((param) == SSP_POLARITY_LOW) || \
|
||||
((param) == SSP_POLARITY_HIGH))
|
||||
|
||||
typedef enum {
|
||||
SSP_PHASE_FIRST_EDGE = 0U,
|
||||
SSP_PHASE_SECOND_EDGE = 1U
|
||||
} SSP_ClkPhase;
|
||||
#define IS_SSP_CLK_PHASE(param) (((param) == SSP_PHASE_FIRST_EDGE) || \
|
||||
((param) == SSP_PHASE_SECOND_EDGE))
|
||||
|
||||
typedef enum {
|
||||
SSP_MASTER = 0U,
|
||||
SSP_SLAVE = 1U
|
||||
} SSP_MS_Mode;
|
||||
#define IS_SSP_MS_MODE(param) (((param) == SSP_MASTER) || \
|
||||
((param) == SSP_SLAVE))
|
||||
|
||||
typedef enum {
|
||||
SSP_FIFO_EMPTY = 0U,
|
||||
SSP_FIFO_NORMAL = 1U,
|
||||
SSP_FIFO_INVALID = 2U,
|
||||
SSP_FIFO_FULL = 3U
|
||||
} SSP_FIFOState;
|
||||
|
||||
#define IS_SSP_PRE_SCALE(param) (((param)>=2U)&&((param)<=254U)&&(((param)%2U)==0U))
|
||||
#define IS_SSP_DATA_BIT_SIZE(param) (((param)>=4U)&&((param)<=16U))
|
||||
|
||||
typedef enum {
|
||||
SSP_RX = 0U,
|
||||
SSP_TX = 1U
|
||||
} SSP_Direction;
|
||||
#define IS_SSP_DIRECTION(param) (((param) == SSP_RX) || \
|
||||
((param) == SSP_TX))
|
||||
|
||||
typedef struct {
|
||||
SSP_FrameFormat FrameFormat;
|
||||
uint8_t PreScale;
|
||||
uint8_t ClkRate;
|
||||
SSP_ClkPolarity ClkPolarity;
|
||||
SSP_ClkPhase ClkPhase;
|
||||
uint8_t DataSize;
|
||||
SSP_MS_Mode Mode;
|
||||
} SSP_InitTypeDef;
|
||||
|
||||
/* Parameter to configure SSP interrupt enable/disable Register */
|
||||
#define SSP_INTCFG_NONE ((uint32_t)0x00000000)
|
||||
#define SSP_INTCFG_RX_OVERRUN ((uint32_t)0x00000001)
|
||||
#define SSP_INTCFG_RX_TIMEOUT ((uint32_t)0x00000002)
|
||||
#define SSP_INTCFG_RX ((uint32_t)0x00000004)
|
||||
#define SSP_INTCFG_TX ((uint32_t)0x00000008)
|
||||
#define SSP_INTCFG_ALL ((uint32_t)0x0000000F)
|
||||
|
||||
#define IS_SSP_INT_SRC(param) ((param) <= SSP_INTCFG_ALL )
|
||||
|
||||
#define IS_SSP_CLEAR_INT_SRC(param) (((param) == SSP_INTCFG_RX_OVERRUN) || \
|
||||
((param) == SSP_INTCFG_RX_TIMEOUT) || \
|
||||
((param) == SSP_INTCFG_ALL) )
|
||||
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t OverRun:1; /* Bit 0 , for TSB-M4 in IAR EWARM */
|
||||
uint32_t TimeOut:1;
|
||||
uint32_t Rx:1;
|
||||
uint32_t Tx:1;
|
||||
uint32_t Reserved:28; /* Bit 4 to 31 */
|
||||
} Bit;
|
||||
} SSP_INTState;
|
||||
|
||||
/** @} */
|
||||
/* End of group SSP_Exported_types */
|
||||
|
||||
/** @defgroup SSP_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
void SSP_Enable(TSB_SSP_TypeDef * SSPx);
|
||||
void SSP_Disable(TSB_SSP_TypeDef * SSPx);
|
||||
void SSP_Init(TSB_SSP_TypeDef * SSPx, SSP_InitTypeDef * InitStruct);
|
||||
void SSP_SetClkPreScale(TSB_SSP_TypeDef * SSPx, uint8_t PreScale, uint8_t ClkRate);
|
||||
void SSP_SetFrameFormat(TSB_SSP_TypeDef * SSPx, SSP_FrameFormat FrameFormat);
|
||||
void SSP_SetClkPolarity(TSB_SSP_TypeDef * SSPx, SSP_ClkPolarity ClkPolarity);
|
||||
void SSP_SetClkPhase(TSB_SSP_TypeDef * SSPx, SSP_ClkPhase ClkPhase);
|
||||
void SSP_SetDataSize(TSB_SSP_TypeDef * SSPx, uint8_t DataSize);
|
||||
void SSP_SetSlaveOutputCtrl(TSB_SSP_TypeDef * SSPx, FunctionalState NewState);
|
||||
void SSP_SetMSMode(TSB_SSP_TypeDef * SSPx, SSP_MS_Mode Mode);
|
||||
void SSP_SetLoopBackMode(TSB_SSP_TypeDef * SSPx, FunctionalState NewState);
|
||||
void SSP_SetTxData(TSB_SSP_TypeDef * SSPx, uint16_t Data);
|
||||
uint16_t SSP_GetRxData(TSB_SSP_TypeDef * SSPx);
|
||||
WorkState SSP_GetWorkState(TSB_SSP_TypeDef * SSPx);
|
||||
SSP_FIFOState SSP_GetFIFOState(TSB_SSP_TypeDef * SSPx, SSP_Direction Direction);
|
||||
void SSP_SetINTConfig(TSB_SSP_TypeDef * SSPx, uint32_t IntSrc);
|
||||
SSP_INTState SSP_GetINTConfig(TSB_SSP_TypeDef * SSPx);
|
||||
SSP_INTState SSP_GetPreEnableINTState(TSB_SSP_TypeDef * SSPx);
|
||||
SSP_INTState SSP_GetPostEnableINTState(TSB_SSP_TypeDef * SSPx);
|
||||
void SSP_ClearINTFlag(TSB_SSP_TypeDef * SSPx, uint32_t IntSrc);
|
||||
void SSP_SetDMACtrl(TSB_SSP_TypeDef * SSPx, SSP_Direction Direction, FunctionalState NewState);
|
||||
/** @} */
|
||||
/* End of group SSP_Exported_FunctionPrototypes */
|
||||
|
||||
/** @} */
|
||||
/* End of group SSP */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /*__TMPM46B_SSP_H */
|
||||
@@ -0,0 +1,283 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_tmrb.h
|
||||
* @brief This file provides all the functions prototypes for TMRB driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/27
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_TMRB_H
|
||||
#define __TMPM46B_TMRB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TMRB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TMRB_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief TMRB Init Structure definition
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint32_t Mode; /*!< Select TMRB mode between internal interval
|
||||
timer mode and external event counter */
|
||||
uint32_t ClkDiv; /*!< Select the division for TMRB source clock */
|
||||
uint32_t TrailingTiming; /*!< Specify the trailingTiming value to be written
|
||||
into TBnRG1 */
|
||||
uint32_t UpCntCtrl; /*!< Select up-counter work mode between
|
||||
freerun and auto-reload */
|
||||
uint32_t LeadingTiming; /*!< Specify the LeadingTiming value to be written
|
||||
into TBnRG0 */
|
||||
} TMRB_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief TMRB Flip-flop Structure definition
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint32_t FlipflopCtrl; /*!< Select TMRB flip-flop output level */
|
||||
uint32_t FlipflopReverseTrg; /*!< Specify TMRB flip-flop reverse trigger */
|
||||
} TMRB_FFOutputTypeDef;
|
||||
|
||||
/**
|
||||
* @brief TMRB Interrupt factor Union definition
|
||||
*/
|
||||
typedef union {
|
||||
uint32_t All;
|
||||
struct {
|
||||
uint32_t MatchLeadingTiming:1;
|
||||
uint32_t MatchTrailingTiming:1;
|
||||
uint32_t OverFlow:1;
|
||||
uint32_t Reserverd:29;
|
||||
} Bit;
|
||||
} TMRB_INTFactor;
|
||||
|
||||
/** @} */
|
||||
/* End of group TMRB_Exported_Types */
|
||||
|
||||
/** @defgroup TMRB_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
#define TSB_TB_MPT0 ((TSB_TB_TypeDef *)TSB_MT0)
|
||||
#define TSB_TB_MPT1 ((TSB_TB_TypeDef *)TSB_MT1)
|
||||
#define TSB_TB_MPT2 ((TSB_TB_TypeDef *)TSB_MT2)
|
||||
#define TSB_TB_MPT3 ((TSB_TB_TypeDef *)TSB_MT3)
|
||||
#define IS_TMRB_ALL_PERIPH(param) (((param) == TSB_TB0) || \
|
||||
((param) == TSB_TB1) || \
|
||||
((param) == TSB_TB2) || \
|
||||
((param) == TSB_TB3) || \
|
||||
((param) == TSB_TB4) || \
|
||||
((param) == TSB_TB5) || \
|
||||
((param) == TSB_TB6) || \
|
||||
((param) == TSB_TB7) || \
|
||||
((param) == TSB_TB_MPT0) || \
|
||||
((param) == TSB_TB_MPT1) || \
|
||||
((param) == TSB_TB_MPT2) || \
|
||||
((param) == TSB_TB_MPT3))
|
||||
|
||||
#define IS_TMRB_TMRB_PERIPH(param) (((param) == TSB_TB0) || \
|
||||
((param) == TSB_TB1) || \
|
||||
((param) == TSB_TB2) || \
|
||||
((param) == TSB_TB3) || \
|
||||
((param) == TSB_TB4) || \
|
||||
((param) == TSB_TB5) || \
|
||||
((param) == TSB_TB6) || \
|
||||
((param) == TSB_TB7))
|
||||
|
||||
#define IS_TMRB_MPT_PERIPH(param) (((param) == TSB_TB_MPT0) || \
|
||||
((param) == TSB_TB_MPT1) || \
|
||||
((param) == TSB_TB_MPT2) || \
|
||||
((param) == TSB_TB_MPT3))
|
||||
|
||||
#define IS_TMRB_SYNC_PERIPH(param) (((param) == TSB_TB1) || \
|
||||
((param) == TSB_TB2) || \
|
||||
((param) == TSB_TB3) || \
|
||||
((param) == TSB_TB5) || \
|
||||
((param) == TSB_TB6) || \
|
||||
((param) == TSB_TB7))
|
||||
|
||||
#define TMRB_INTERVAL_TIMER ((uint32_t)0x00000001)
|
||||
#define TMRB_EVENT_CNT ((uint32_t)0x00000000)
|
||||
#define IS_TMRB_MODE(param) (((param) == TMRB_INTERVAL_TIMER) || \
|
||||
((param) == TMRB_EVENT_CNT))
|
||||
|
||||
#define TMRB_CLK_DIV_2 ((uint32_t)0x00000001)
|
||||
#define TMRB_CLK_DIV_8 ((uint32_t)0x00000002)
|
||||
#define TMRB_CLK_DIV_32 ((uint32_t)0x00000003)
|
||||
#define TMRB_CLK_DIV_64 ((uint32_t)0x00000004)
|
||||
#define TMRB_CLK_DIV_128 ((uint32_t)0x00000005)
|
||||
#define TMRB_CLK_DIV_256 ((uint32_t)0x00000006)
|
||||
#define TMRB_CLK_DIV_512 ((uint32_t)0x00000007)
|
||||
#define IS_TMRB_CLK_DIV(param) (((param) == TMRB_CLK_DIV_2) || \
|
||||
((param) == TMRB_CLK_DIV_8) || \
|
||||
((param) == TMRB_CLK_DIV_32) || \
|
||||
((param) == TMRB_CLK_DIV_64) || \
|
||||
((param) == TMRB_CLK_DIV_128) || \
|
||||
((param) == TMRB_CLK_DIV_256) || \
|
||||
((param) == TMRB_CLK_DIV_512))
|
||||
|
||||
#define IS_MPT_CLK_DIV(param) (((param) == TMRB_CLK_DIV_2) || \
|
||||
((param) == TMRB_CLK_DIV_8) || \
|
||||
((param) == TMRB_CLK_DIV_32))
|
||||
|
||||
#define TMRB_FREE_RUN ((uint32_t)0x00000000)
|
||||
#define TMRB_AUTO_CLEAR ((uint32_t)0x00000008)
|
||||
#define IS_TMRB_UC_CTRL(param) (((param) == TMRB_FREE_RUN) || \
|
||||
((param) == TMRB_AUTO_CLEAR))
|
||||
|
||||
#define MPT_FREE_RUN ((uint32_t)0x00000000)
|
||||
#define MPT_AUTO_CLEAR ((uint32_t)0x00000004)
|
||||
#define IS_MPT_UC_CTRL(param) (((param) == MPT_FREE_RUN) || \
|
||||
((param) == MPT_AUTO_CLEAR))
|
||||
|
||||
#define TMRB_FLIPFLOP_INVERT ((uint32_t)0x00000000)
|
||||
#define TMRB_FLIPFLOP_SET ((uint32_t)0x00000001)
|
||||
#define TMRB_FLIPFLOP_CLEAR ((uint32_t)0x00000002)
|
||||
#define IS_TMRB_FLIPFLOP_CTRL(param) (((param) == TMRB_FLIPFLOP_INVERT) || \
|
||||
((param) == TMRB_FLIPFLOP_SET) || \
|
||||
((param) == TMRB_FLIPFLOP_CLEAR))
|
||||
|
||||
#define TMRB_DISABLE_FLIPFLOP ((uint32_t)0x00000000)
|
||||
#define TMRB_FLIPFLOP_TAKE_CAPTURE_0 ((uint32_t)0x00000010)
|
||||
#define TMRB_FLIPFLOP_TAKE_CAPTURE_1 ((uint32_t)0x00000020)
|
||||
#define TMRB_FLIPFLOP_MATCH_TRAILING ((uint32_t)0x00000008)
|
||||
#define TMRB_FLIPFLOP_MATCH_LEADING ((uint32_t)0x00000004)
|
||||
#define IS_TMRB_FLIPFLOP_TRG(param) (((param) == TMRB_DISABLE_FLIPFLOP) || \
|
||||
((param) == TMRB_FLIPFLOP_TAKE_CAPTURE_0) || \
|
||||
((param) == TMRB_FLIPFLOP_TAKE_CAPTURE_1) || \
|
||||
((param) == TMRB_FLIPFLOP_MATCH_TRAILING) || \
|
||||
((param) == TMRB_FLIPFLOP_MATCH_LEADING) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_0 | TMRB_FLIPFLOP_TAKE_CAPTURE_1)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_0 | TMRB_FLIPFLOP_MATCH_TRAILING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_0 | TMRB_FLIPFLOP_MATCH_LEADING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_1 | TMRB_FLIPFLOP_MATCH_TRAILING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_1 | TMRB_FLIPFLOP_MATCH_LEADING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_MATCH_TRAILING | TMRB_FLIPFLOP_MATCH_LEADING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_0 | TMRB_FLIPFLOP_TAKE_CAPTURE_1 | TMRB_FLIPFLOP_MATCH_TRAILING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_0 | TMRB_FLIPFLOP_MATCH_TRAILING | TMRB_FLIPFLOP_MATCH_LEADING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_1 | TMRB_FLIPFLOP_MATCH_TRAILING | TMRB_FLIPFLOP_MATCH_LEADING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_0 | TMRB_FLIPFLOP_TAKE_CAPTURE_1 | TMRB_FLIPFLOP_MATCH_LEADING)) || \
|
||||
((param) == (TMRB_FLIPFLOP_TAKE_CAPTURE_0 | TMRB_FLIPFLOP_TAKE_CAPTURE_1 | TMRB_FLIPFLOP_MATCH_TRAILING | TMRB_FLIPFLOP_MATCH_LEADING)))
|
||||
|
||||
#define TMRB_DISABLE_CAPTURE ((uint32_t)0x00000000)
|
||||
#define TMRB_CAPTURE_TBIN0_TBIN1_RISING ((uint32_t)0x00000100)
|
||||
#define TMRB_CAPTURE_TBIN0_RISING_FALLING ((uint32_t)0x00000200)
|
||||
#define TMRB_CAPTURE_TBFF0_EDGE ((uint32_t)0x00000300)
|
||||
#define TMRB_CLEAR_TBIN1_RISING ((uint32_t)0x00000400)
|
||||
#define TMRB_CAPTURE_TBIN0_RISING_CLEAR_TBIN1_RISING ((uint32_t)0x00000500)
|
||||
#define IS_TMRB_CAPTURE_TIMING_ALL(param) (((param) == TMRB_DISABLE_CAPTURE) || \
|
||||
((param) == TMRB_CAPTURE_TBIN0_TBIN1_RISING) || \
|
||||
((param) == TMRB_CAPTURE_TBIN0_RISING_FALLING) || \
|
||||
((param) == TMRB_CAPTURE_TBFF0_EDGE) || \
|
||||
((param) == TMRB_CLEAR_TBIN1_RISING) || \
|
||||
((param) == TMRB_CAPTURE_TBIN0_RISING_CLEAR_TBIN1_RISING))
|
||||
|
||||
#define IS_TMRB_CAPTURE_TIMING_NONE_TBIN1(param) (((param) == TMRB_DISABLE_CAPTURE) || \
|
||||
((param) == TMRB_CAPTURE_TBIN0_RISING_FALLING) || \
|
||||
((param) == TMRB_CAPTURE_TBFF0_EDGE))
|
||||
|
||||
#define MPT_DISABLE_CAPTURE ((uint32_t)0x00000000)
|
||||
#define MPT_CAPTURE_IN_RISING ((uint32_t)0x00000008)
|
||||
#define MPT_CAPTURE_IN_RISING_FALLING ((uint32_t)0x00000010)
|
||||
#define IS_MPT_CAPTURE_TIMING(param) (((param) == MPT_DISABLE_CAPTURE) || \
|
||||
((param) == MPT_CAPTURE_IN_RISING) || \
|
||||
((param) == MPT_CAPTURE_IN_RISING_FALLING))
|
||||
|
||||
#define TMRB_RUN ((uint32_t)0x00000005)
|
||||
#define TMRB_STOP ((uint32_t)0x00000000)
|
||||
#define IS_TMRB_CMD(param) (((param) == TMRB_RUN) || ((param) == TMRB_STOP))
|
||||
|
||||
#define TMRB_CAPTURE_0 ((uint8_t)0x00)
|
||||
#define TMRB_CAPTURE_1 ((uint8_t)0x01)
|
||||
#define IS_TMRB_CAPTURE_REG(param) (((param) == TMRB_CAPTURE_0) || ((param) == TMRB_CAPTURE_1))
|
||||
|
||||
#define TMRB_NO_INT_MASK ((uint32_t)0x00000000)
|
||||
#define TMRB_MASK_MATCH_LEADING_INT ((uint32_t)0x00000001)
|
||||
#define TMRB_MASK_MATCH_TRAILING_INT ((uint32_t)0x00000002)
|
||||
#define TMRB_MASK_OVERFLOW_INT ((uint32_t)0x00000004)
|
||||
#define IS_TMRB_INT_MASK(param) (((param) == TMRB_NO_INT_MASK) || \
|
||||
((param) == TMRB_MASK_MATCH_LEADING_INT) || \
|
||||
((param) == TMRB_MASK_MATCH_TRAILING_INT) || \
|
||||
((param) == TMRB_MASK_OVERFLOW_INT) || \
|
||||
((param) == (TMRB_MASK_MATCH_LEADING_INT | TMRB_MASK_MATCH_TRAILING_INT)) || \
|
||||
((param) == (TMRB_MASK_MATCH_LEADING_INT | TMRB_MASK_OVERFLOW_INT)) || \
|
||||
((param) == (TMRB_MASK_MATCH_TRAILING_INT | TMRB_MASK_OVERFLOW_INT)) || \
|
||||
((param) == (TMRB_MASK_MATCH_LEADING_INT | TMRB_MASK_MATCH_TRAILING_INT | TMRB_MASK_OVERFLOW_INT)))
|
||||
|
||||
#define TMRB_TRG_EDGE_RISING ((uint8_t)0x00)
|
||||
#define TMRB_TRG_EDGE_FALLING ((uint8_t)0x02)
|
||||
#define IS_TMRB_TRG_EDGE(param) (((param) == TMRB_TRG_EDGE_RISING) || \
|
||||
((param) == TMRB_TRG_EDGE_FALLING))
|
||||
|
||||
#define TMRB_WRITE_REG_SEPARATE ((uint8_t)0x00)
|
||||
#define TMRB_WRITE_REG_SIMULTANEOUS ((uint8_t)0x40)
|
||||
#define IS_TMRB_WRITE_REG_MODE(param) (((param) == TMRB_WRITE_REG_SEPARATE) || \
|
||||
((param) == TMRB_WRITE_REG_SIMULTANEOUS))
|
||||
|
||||
#define TMRB_RUNNING_IN_CORE_HALT ((uint8_t)0x00)
|
||||
#define TMRB_STOP_IN_CORE_HALT ((uint8_t)0x40)
|
||||
#define IS_TMRB_CLK_IN_CORE_HALT(param) (((param) == TMRB_RUNNING_IN_CORE_HALT) || \
|
||||
((param) == TMRB_STOP_IN_CORE_HALT))
|
||||
|
||||
#define TMRB_NO_INT ((uint32_t)0x00000000)
|
||||
#define IS_TMRB_VALUE(param) ((param) <= 0x0000FFFFU)
|
||||
#define IS_VALID_LEADING(param1, param2) ((param1) <= (param2))
|
||||
|
||||
/** @} */
|
||||
/* End of group TMRB_Exported_Constants */
|
||||
/** @defgroup TMRB_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
void TMRB_Enable(TSB_TB_TypeDef * TBx);
|
||||
void TMRB_Disable(TSB_TB_TypeDef * TBx);
|
||||
void TMRB_SetRunState(TSB_TB_TypeDef * TBx, uint32_t Cmd);
|
||||
void TMRB_Init(TSB_TB_TypeDef * TBx, TMRB_InitTypeDef * InitStruct);
|
||||
void TMRB_SetCaptureTiming(TSB_TB_TypeDef * TBx, uint32_t CaptureTiming);
|
||||
void TMRB_SetFlipFlop(TSB_TB_TypeDef * TBx, TMRB_FFOutputTypeDef * FFStruct);
|
||||
TMRB_INTFactor TMRB_GetINTFactor(TSB_TB_TypeDef * TBx);
|
||||
void TMRB_SetINTMask(TSB_TB_TypeDef * TBx, uint32_t INTMask);
|
||||
void TMRB_ChangeLeadingTiming(TSB_TB_TypeDef * TBx, uint32_t LeadingTiming);
|
||||
void TMRB_ChangeTrailingTiming(TSB_TB_TypeDef * TBx, uint32_t TrailingTiming);
|
||||
uint16_t TMRB_GetUpCntValue(TSB_TB_TypeDef * TBx);
|
||||
uint16_t TMRB_GetCaptureValue(TSB_TB_TypeDef * TBx, uint8_t CapReg);
|
||||
void TMRB_ExecuteSWCapture(TSB_TB_TypeDef * TBx);
|
||||
void TMRB_SetIdleMode(TSB_TB_TypeDef * TBx, FunctionalState NewState);
|
||||
void TMRB_SetSyncMode(TSB_TB_TypeDef * TBx, FunctionalState NewState);
|
||||
void TMRB_SetDoubleBuf(TSB_TB_TypeDef * TBx, FunctionalState NewState, uint8_t WriteRegMode);
|
||||
void TMRB_SetExtStartTrg(TSB_TB_TypeDef * TBx, FunctionalState NewState, uint8_t TrgMode);
|
||||
void TMRB_SetClkInCoreHalt(TSB_TB_TypeDef * TBx, uint8_t ClkState);
|
||||
|
||||
/** @} */
|
||||
/* End of group TMRB_Exported_FunctionPrototypes */
|
||||
|
||||
/** @} */
|
||||
/* End of group TMRB */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __TMPM46B_TMRB_H */
|
||||
@@ -0,0 +1,390 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tmpm46b_uart.h
|
||||
* @brief This file provides all the functions prototypes for UART driver.
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/26
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TMPM46B_UART_H
|
||||
#define __TMPM46B_UART_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "TMPM46B.h"
|
||||
#include "tx04_common.h"
|
||||
|
||||
/** @addtogroup TX04_Periph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup UART
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup UART_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief UART Init Structure definition
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint32_t BaudRate; /*!< This member configures the UART communication
|
||||
baud rate. */
|
||||
uint32_t DataBits; /*!< Specifies UART transfer mode, which could be
|
||||
7-bit mode, 8-bit mode or 9-bit mode. */
|
||||
uint32_t StopBits; /*!< Specifies the length of stop bit transmission
|
||||
in UART mode. */
|
||||
uint32_t Parity; /*!< Specifies the parity mode which could be odd
|
||||
parity, even parity or no parity. */
|
||||
uint32_t Mode; /*!< Enables or disables Receive, Transmit or
|
||||
both. */
|
||||
uint32_t FlowCtrl; /*!< Specifies whether the hardware flow control
|
||||
mode is enabled or disabled. */
|
||||
} UART_InitTypeDef;
|
||||
|
||||
typedef struct {
|
||||
uint32_t InputClkEdge; /*!< Select the input clock edge.on the SCLK output mode
|
||||
this bit only can set to be 0(SIO_SCLKS_TXDF_RXDR) */
|
||||
uint32_t TIDLE; /*!< The status of TXDx pin after output of the
|
||||
last bit */
|
||||
uint32_t TXDEMP; /*!< The status of TXDx pin when an under run error
|
||||
is occurred in SCLK input mode */
|
||||
uint32_t EHOLDTime; /*!< The last bit hold time of TXDx pin in SCLK
|
||||
input mode */
|
||||
uint32_t IntervalTime; /*!< Setting interval time of continuous transmission which
|
||||
could be None,1*SCLK,2*SCLK,4*SCLK,8*SCLK,16*SCLK,32*SCLK,64*SCLK.
|
||||
this bit is valid only for SCLK output mode and double
|
||||
buffer is enabled. */
|
||||
uint32_t TransferMode; /*!< Setting transfer mode which could be transfer prohibited,
|
||||
half duplex(Receive),half duplex(Transmit) or full duplex. */
|
||||
uint32_t TransferDir; /*!< Setting transfer direction which could be
|
||||
LSB_FRIST or MSB_FRIST. */
|
||||
uint32_t Mode; /*!< Enables or disables Receive, Transmit or both. */
|
||||
uint32_t DoubleBuffer; /*!< Double Buffer mode is enabled or disabled. */
|
||||
uint32_t BaudRateClock; /*!< Select the input clock for baud rate generator */
|
||||
uint32_t Divider; /*!< Division ratio "N" */
|
||||
} SIO_InitTypeDef;
|
||||
|
||||
/** @} */
|
||||
/* End of group UART_Exported_Types */
|
||||
|
||||
/** @defgroup UART_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define UART0 TSB_SC0
|
||||
#define UART1 TSB_SC1
|
||||
#define UART2 TSB_SC2
|
||||
#define UART3 TSB_SC3
|
||||
#define IS_UART_PERIPH(param) (((param) == UART0) || \
|
||||
((param) == UART1) || \
|
||||
((param) == UART2) || \
|
||||
((param) == UART3))
|
||||
|
||||
#define SIO0 TSB_SC0
|
||||
#define SIO1 TSB_SC1
|
||||
#define SIO2 TSB_SC2
|
||||
#define SIO3 TSB_SC3
|
||||
#define IS_SIO_PERIPH(param) (((param) == SIO0)|| \
|
||||
((param) == SIO1) || \
|
||||
((param) == SIO2) || \
|
||||
((param) == SIO3))
|
||||
|
||||
#define UART_DATA_BITS_7 ((uint32_t)0x00000004)
|
||||
#define UART_DATA_BITS_8 ((uint32_t)0x00000008)
|
||||
#define UART_DATA_BITS_9 ((uint32_t)0x0000000C)
|
||||
#define IS_UART_DATA_BITS(param) (((param) == UART_DATA_BITS_7) || \
|
||||
((param) == UART_DATA_BITS_8) || \
|
||||
((param) == UART_DATA_BITS_9))
|
||||
|
||||
#define UART_STOP_BITS_1 ((uint32_t)0x00000000)
|
||||
#define UART_STOP_BITS_2 ((uint32_t)0x00000010)
|
||||
#define IS_UART_STOPBITS(param) (((param) == UART_STOP_BITS_1) || \
|
||||
((param) == UART_STOP_BITS_2))
|
||||
|
||||
#define UART_NO_PARITY ((uint32_t)0x00000000)
|
||||
#define UART_EVEN_PARITY ((uint32_t)0x00000060)
|
||||
#define UART_ODD_PARITY ((uint32_t)0x00000020)
|
||||
#define IS_UART_PARITY(param) (((param) == UART_NO_PARITY) || \
|
||||
((param) == UART_EVEN_PARITY) || \
|
||||
((param) == UART_ODD_PARITY))
|
||||
|
||||
#define SIO_CLK_SCLKOUTPUT ((uint32_t)0x00000000)
|
||||
#define SIO_CLK_SCLKINPUT ((uint32_t)0x00000001)
|
||||
#define IS_SIO_CLK_SEL(param) (((param) == SIO_CLK_SCLKOUTPUT) || \
|
||||
((param) == SIO_CLK_SCLKINPUT))
|
||||
|
||||
#define SIO_SCLKS_TXDF_RXDR ((uint32_t)0x00000000)
|
||||
#define SIO_SCLKS_TXDR_RXDF ((uint32_t)0x00000002)
|
||||
#define IS_SIO_SCLKS_TRXD(param) (((param) == SIO_SCLKS_TXDF_RXDR) || \
|
||||
((param) == SIO_SCLKS_TXDR_RXDF))
|
||||
|
||||
#define SIO_TIDLE_LOW ((uint32_t)0x00000000)
|
||||
#define SIO_TIDLE_HIGH ((uint32_t)0x00000100)
|
||||
#define SIO_TIDLE_LAST ((uint32_t)0x00000200)
|
||||
#define IS_SIO_TIDLE_LEVEL(param) (((param) == SIO_TIDLE_LOW) || \
|
||||
((param) == SIO_TIDLE_HIGH) || \
|
||||
((param) == SIO_TIDLE_LAST))
|
||||
|
||||
#define SIO_TXDEMP_LOW ((uint32_t)0x00000000)
|
||||
#define SIO_TXDEMP_HIGH ((uint32_t)0x00000400)
|
||||
#define IS_SIO_TXDEMP_LEVEL(param) (((param) == SIO_TXDEMP_LOW) || \
|
||||
((param) == SIO_TXDEMP_HIGH))
|
||||
|
||||
#define SIO_EHOLD_FC_2 ((uint32_t)0x00000000)
|
||||
#define SIO_EHOLD_FC_4 ((uint32_t)0x00001000)
|
||||
#define SIO_EHOLD_FC_8 ((uint32_t)0x00002000)
|
||||
#define SIO_EHOLD_FC_16 ((uint32_t)0x00003000)
|
||||
#define SIO_EHOLD_FC_32 ((uint32_t)0x00004000)
|
||||
#define SIO_EHOLD_FC_64 ((uint32_t)0x00005000)
|
||||
#define SIO_EHOLD_FC_128 ((uint32_t)0x00006000)
|
||||
#define IS_SIO_EHOLD_TIME(param) (((param) == SIO_EHOLD_FC_2) || \
|
||||
((param) == SIO_EHOLD_FC_4) || \
|
||||
((param) == SIO_EHOLD_FC_8) || \
|
||||
((param) == SIO_EHOLD_FC_16) || \
|
||||
((param) == SIO_EHOLD_FC_32) || \
|
||||
((param) == SIO_EHOLD_FC_64) || \
|
||||
((param) == SIO_EHOLD_FC_128))
|
||||
|
||||
#define SIO_SINT_TIME_NONE ((uint32_t)0x00000000)
|
||||
#define SIO_SINT_TIME_SCLK_1 ((uint32_t)0x00000002)
|
||||
#define SIO_SINT_TIME_SCLK_2 ((uint32_t)0x00000004)
|
||||
#define SIO_SINT_TIME_SCLK_4 ((uint32_t)0x00000006)
|
||||
#define SIO_SINT_TIME_SCLK_8 ((uint32_t)0x00000008)
|
||||
#define SIO_SINT_TIME_SCLK_16 ((uint32_t)0x0000000A)
|
||||
#define SIO_SINT_TIME_SCLK_32 ((uint32_t)0x0000000C)
|
||||
#define SIO_SINT_TIME_SCLK_64 ((uint32_t)0x0000000E)
|
||||
#define IS_SIO_SINT_TIME(param) (((param) == SIO_SINT_TIME_NONE) || \
|
||||
((param) == SIO_SINT_TIME_SCLK_1) || \
|
||||
((param) == SIO_SINT_TIME_SCLK_2) || \
|
||||
((param) == SIO_SINT_TIME_SCLK_4) || \
|
||||
((param) == SIO_SINT_TIME_SCLK_8) || \
|
||||
((param) == SIO_SINT_TIME_SCLK_16) || \
|
||||
((param) == SIO_SINT_TIME_SCLK_32) || \
|
||||
((param) == SIO_SINT_TIME_SCLK_64))
|
||||
|
||||
#define SIO_TRANSFER_PROHIBIT ((uint32_t)0x00000000)
|
||||
#define SIO_TRANSFER_HALFDPX_RX ((uint32_t)0x00000020)
|
||||
#define SIO_TRANSFER_HALFDPX_TX ((uint32_t)0x00000040)
|
||||
#define SIO_TRANSFER_FULLDPX ((uint32_t)0x00000060)
|
||||
#define IS_SIO_TRANSFER_MODE(param) (((param) == SIO_TRANSFER_PROHIBIT) || \
|
||||
((param) == SIO_TRANSFER_HALFDPX_RX) || \
|
||||
((param) == SIO_TRANSFER_HALFDPX_TX) || \
|
||||
((param) == SIO_TRANSFER_FULLDPX))
|
||||
|
||||
#define SIO_ENABLE_RX ((uint32_t)0x00000020)
|
||||
#define SIO_ENABLE_TX ((uint32_t)0x00000010)
|
||||
#define IS_SIO_MODE(param) (((param) == SIO_ENABLE_RX) || \
|
||||
((param) == SIO_ENABLE_TX) || \
|
||||
((param) == (SIO_ENABLE_TX | SIO_ENABLE_RX)))
|
||||
|
||||
#define SIO_LSB_FRIST ((uint32_t)0x00000000)
|
||||
#define SIO_MSB_FRIST ((uint32_t)0x00000008)
|
||||
#define IS_SIO_TRANS_DIR(param) (((param) == SIO_LSB_FRIST) || \
|
||||
((param) == SIO_MSB_FRIST))
|
||||
|
||||
#define SIO_WBUF_DISABLE ((uint32_t)0x00000000)
|
||||
#define SIO_WBUF_ENABLE ((uint32_t)0x00000004)
|
||||
#define IS_SIO_WBUF_SET(param) (((param) == SIO_WBUF_DISABLE) || \
|
||||
((param) == SIO_WBUF_ENABLE))
|
||||
|
||||
#define SIO_BR_CLOCK_TS0 ((uint32_t)0x00000000)
|
||||
#define SIO_BR_CLOCK_TS2 ((uint32_t)0x00000010)
|
||||
#define SIO_BR_CLOCK_TS8 ((uint32_t)0x00000020)
|
||||
#define SIO_BR_CLOCK_TS32 ((uint32_t)0x00000030)
|
||||
#define IS_SIO_BR_CLOCK(param) (((param) == SIO_BR_CLOCK_TS0) || \
|
||||
((param) == SIO_BR_CLOCK_TS2) || \
|
||||
((param) == SIO_BR_CLOCK_TS8) || \
|
||||
((param) == SIO_BR_CLOCK_TS32))
|
||||
|
||||
#define SIO_BR_DIVIDER_16 ((uint32_t)0x00000000)
|
||||
#define SIO_BR_DIVIDER_1 ((uint32_t)0x00000001)
|
||||
#define SIO_BR_DIVIDER_2 ((uint32_t)0x00000002)
|
||||
#define SIO_BR_DIVIDER_3 ((uint32_t)0x00000003)
|
||||
#define SIO_BR_DIVIDER_4 ((uint32_t)0x00000004)
|
||||
#define SIO_BR_DIVIDER_5 ((uint32_t)0x00000005)
|
||||
#define SIO_BR_DIVIDER_6 ((uint32_t)0x00000006)
|
||||
#define SIO_BR_DIVIDER_7 ((uint32_t)0x00000007)
|
||||
#define SIO_BR_DIVIDER_8 ((uint32_t)0x00000008)
|
||||
#define SIO_BR_DIVIDER_9 ((uint32_t)0x00000009)
|
||||
#define SIO_BR_DIVIDER_10 ((uint32_t)0x0000000A)
|
||||
#define SIO_BR_DIVIDER_11 ((uint32_t)0x0000000B)
|
||||
#define SIO_BR_DIVIDER_12 ((uint32_t)0x0000000C)
|
||||
#define SIO_BR_DIVIDER_13 ((uint32_t)0x0000000D)
|
||||
#define SIO_BR_DIVIDER_14 ((uint32_t)0x0000000E)
|
||||
#define SIO_BR_DIVIDER_15 ((uint32_t)0x0000000F)
|
||||
#define IS_SIO_BR_DIVIDER(param) ((param) <= SIO_BR_DIVIDER_15)
|
||||
|
||||
#define IS_SIO_DATA(param) ((param) <= 0xFFU)
|
||||
|
||||
#define SIO_CLOCK_T0_HALF ((uint32_t)0x00000000)
|
||||
#define SIO_CLOCK_T0 ((uint32_t)0x00000002)
|
||||
#define IS_SIO_CLOCK(param) (((param) == SIO_CLOCK_T0_HALF) || \
|
||||
((param) == SIO_CLOCK_T0))
|
||||
|
||||
#define UART_ENABLE_RX ((uint32_t)0x00000020)
|
||||
#define UART_ENABLE_TX ((uint32_t)0x00000010)
|
||||
#define IS_UART_MODE(param) (((param) == UART_ENABLE_RX) || \
|
||||
((param) == UART_ENABLE_TX) || \
|
||||
((param) == (UART_ENABLE_TX | UART_ENABLE_RX)))
|
||||
|
||||
#define UART_NONE_FLOW_CTRL ((uint32_t)0x00000000)
|
||||
#define IS_UART_FLOW_CONTROL(param) ((param) == UART_NONE_FLOW_CTRL)
|
||||
|
||||
#ifdef USE_STK
|
||||
#define IS_UART_BAUDRATE(param) (((param) >= 3663U) && \
|
||||
((param) <= 921600U))
|
||||
#else
|
||||
#define IS_UART_BAUDRATE(param) (((param) >= 2929U) && \
|
||||
((param) <= 921600U))
|
||||
#endif
|
||||
|
||||
#define IS_UART_DATA(param) ((param) <= 0x01FFU)
|
||||
|
||||
#define IS_UART_CLOCK(param) ((param) <= ((uint32_t)0x00000001))
|
||||
#define IS_UART_TIME(param) ((param) <= ((uint32_t)0x00000006))
|
||||
#define UART_RX ((uint32_t)0x00000020)
|
||||
#define UART_TX ((uint32_t)0x00000040)
|
||||
#define IS_UART_TRX(param) (((param) == UART_RX) || \
|
||||
((param) == UART_TX))
|
||||
|
||||
#define UART_TRANSFER_PROHIBIT ((uint32_t)0x00000000)
|
||||
#define UART_TRANSFER_HALFDPX_RX ((uint32_t)0x00000020)
|
||||
#define UART_TRANSFER_HALFDPX_TX ((uint32_t)0x00000040)
|
||||
#define UART_TRANSFER_FULLDPX ((uint32_t)0x00000060)
|
||||
#define IS_UART_TRANSFER_MODE(param) (((param) == UART_TRANSFER_PROHIBIT) || \
|
||||
((param) == UART_TRANSFER_HALFDPX_RX) || \
|
||||
((param) == UART_TRANSFER_HALFDPX_TX) || \
|
||||
((param) == UART_TRANSFER_FULLDPX))
|
||||
|
||||
#define UART_RXFIFO_MAX ((uint32_t)0x00000000)
|
||||
#define UART_RXFIFO_RXFLEVEL ((uint32_t)0x00000010)
|
||||
#define IS_UATR_RXFIFO_BYTESUSED(param) (((param) == UART_RXFIFO_MAX) || \
|
||||
((param) == UART_RXFIFO_RXFLEVEL))
|
||||
|
||||
#define UART_RXFIFO4B_FLEVLE_4_2B ((uint32_t)0x00000000)
|
||||
#define UART_RXFIFO4B_FLEVLE_1_1B ((uint32_t)0x00000001)
|
||||
#define UART_RXFIFO4B_FLEVLE_2_2B ((uint32_t)0x00000002)
|
||||
#define UART_RXFIFO4B_FLEVLE_3_1B ((uint32_t)0x00000003)
|
||||
#define IS_UART_RXFIFO4B_FLEVLE(param) (((param) == UART_RXFIFO4B_FLEVLE_4_2B) || \
|
||||
((param) == UART_RXFIFO4B_FLEVLE_1_1B) || \
|
||||
((param) == UART_RXFIFO4B_FLEVLE_2_2B) || \
|
||||
((param) == UART_RXFIFO4B_FLEVLE_3_1B))
|
||||
|
||||
#define UART_RFIS_REACH_FLEVEL ((uint32_t)0x00000000)
|
||||
#define UART_RFIS_REACH_EXCEED_FLEVEL ((uint32_t)0x00000040)
|
||||
#define IS_UATR_RFIS_CONDITION(param) (((param) == UART_RFIS_REACH_FLEVEL) || \
|
||||
((param) == UART_RFIS_REACH_EXCEED_FLEVEL))
|
||||
|
||||
#define UART_TXFIFO4B_FLEVLE_0_0B ((uint32_t)0x00000000)
|
||||
#define UART_TXFIFO4B_FLEVLE_1_1B ((uint32_t)0x00000001)
|
||||
#define UART_TXFIFO4B_FLEVLE_2_0B ((uint32_t)0x00000002)
|
||||
#define UART_TXFIFO4B_FLEVLE_3_1B ((uint32_t)0x00000003)
|
||||
#define IS_UART_TXFIFO4B_FLEVLE(param) (((param) == UART_TXFIFO4B_FLEVLE_0_0B) || \
|
||||
((param) == UART_TXFIFO4B_FLEVLE_1_1B) || \
|
||||
((param) == UART_TXFIFO4B_FLEVLE_2_0B) || \
|
||||
((param) == UART_TXFIFO4B_FLEVLE_3_1B))
|
||||
|
||||
#define UART_TRXFIFO_EMPTY ((uint32_t)0x00000000)
|
||||
#define UART_TRXFIFO_1B ((uint32_t)0x00000001)
|
||||
#define UART_TRXFIFO_2B ((uint32_t)0x00000002)
|
||||
#define UART_TRXFIFO_3B ((uint32_t)0x00000003)
|
||||
#define UART_TRXFIFO_4B ((uint32_t)0x00000004)
|
||||
|
||||
#define UART_TFIS_REACH_FLEVEL ((uint32_t)0x00000000)
|
||||
#define UART_TFIS_REACH_NOREACH_FLEVEL ((uint32_t)0x00000040)
|
||||
#define IS_UATR_TFIS_CONDITION(param) (((param) == UART_TFIS_REACH_FLEVEL) || \
|
||||
((param) == UART_TFIS_REACH_NOREACH_FLEVEL))
|
||||
|
||||
#define UART_RXFIFO_OVERRUN ((uint32_t)0x00000001)
|
||||
|
||||
#define UART_TXFIFO_UNDERRUN ((uint32_t)0x00000001)
|
||||
|
||||
/** @} */
|
||||
/* End of group UART_Exported_Constants */
|
||||
|
||||
/** @addtogroup UART_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum {
|
||||
UART_NO_ERR = 0U,
|
||||
UART_OVERRUN = 1U,
|
||||
UART_PARITY_ERR = 2U,
|
||||
UART_FRAMING_ERR = 3U,
|
||||
UART_ERRS = 4U
|
||||
} UART_Err;
|
||||
|
||||
typedef enum {
|
||||
UART_RXTXCNT_NONE = 0U,
|
||||
UART_RXTXCNT_AUTODISABLE = 1U
|
||||
} UART_TRxDisable;
|
||||
#define IS_UATR_TRX_AUTODISABLE(param) (((param) == UART_RXTXCNT_NONE) || \
|
||||
((param) == UART_RXTXCNT_AUTODISABLE))
|
||||
|
||||
/** @} */
|
||||
/* End of group UART_Exported_Types */
|
||||
|
||||
/** @defgroup UART_Exported_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
void UART_Enable(TSB_SC_TypeDef * UARTx);
|
||||
void UART_Disable(TSB_SC_TypeDef * UARTx);
|
||||
WorkState UART_GetBufState(TSB_SC_TypeDef * UARTx, uint8_t Direction);
|
||||
void UART_SWReset(TSB_SC_TypeDef * UARTx);
|
||||
void UART_Init(TSB_SC_TypeDef * UARTx, UART_InitTypeDef * InitStruct);
|
||||
uint32_t UART_GetRxData(TSB_SC_TypeDef * UARTx);
|
||||
void UART_SetTxData(TSB_SC_TypeDef * UARTx, uint32_t Data);
|
||||
void UART_DefaultConfig(TSB_SC_TypeDef * UARTx);
|
||||
UART_Err UART_GetErrState(TSB_SC_TypeDef * UARTx);
|
||||
void UART_SetWakeUpFunc(TSB_SC_TypeDef * UARTx, FunctionalState NewState);
|
||||
void UART_SetIdleMode(TSB_SC_TypeDef * UARTx, FunctionalState NewState);
|
||||
void UART_SetInputClock(TSB_SC_TypeDef * UARTx, uint32_t clock);
|
||||
void UART_FIFOConfig(TSB_SC_TypeDef * UARTx, FunctionalState NewState);
|
||||
void UART_SetFIFOTransferMode(TSB_SC_TypeDef * UARTx, uint32_t TransferMode);
|
||||
void UART_TRxAutoDisable(TSB_SC_TypeDef * UARTx, UART_TRxDisable TRxAutoDisable);
|
||||
void UART_RxFIFOINTCtrl(TSB_SC_TypeDef * UARTx, FunctionalState NewState);
|
||||
void UART_TxFIFOINTCtrl(TSB_SC_TypeDef * UARTx, FunctionalState NewState);
|
||||
void UART_RxFIFOByteSel(TSB_SC_TypeDef * UARTx, uint32_t BytesUsed);
|
||||
void UART_RxFIFOFillLevel(TSB_SC_TypeDef * UARTx, uint32_t RxFIFOLevel);
|
||||
void UART_RxFIFOINTSel(TSB_SC_TypeDef * UARTx, uint32_t RxINTCondition);
|
||||
void UART_RxFIFOClear(TSB_SC_TypeDef * UARTx);
|
||||
void UART_TxFIFOFillLevel(TSB_SC_TypeDef * UARTx, uint32_t TxFIFOLevel);
|
||||
void UART_TxFIFOINTSel(TSB_SC_TypeDef * UARTx, uint32_t TxINTCondition);
|
||||
void UART_TxFIFOClear(TSB_SC_TypeDef * UARTx);
|
||||
void UART_TxBufferClear(TSB_SC_TypeDef * UARTx);
|
||||
uint32_t UART_GetRxFIFOFillLevelStatus(TSB_SC_TypeDef * UARTx);
|
||||
uint32_t UART_GetRxFIFOOverRunStatus(TSB_SC_TypeDef * UARTx);
|
||||
uint32_t UART_GetTxFIFOFillLevelStatus(TSB_SC_TypeDef * UARTx);
|
||||
uint32_t UART_GetTxFIFOUnderRunStatus(TSB_SC_TypeDef * UARTx);
|
||||
void SIO_SetInputClock(TSB_SC_TypeDef * SIOx, uint32_t Clock);
|
||||
void SIO_Enable(TSB_SC_TypeDef * SIOx);
|
||||
void SIO_Disable(TSB_SC_TypeDef * SIOx);
|
||||
uint8_t SIO_GetRxData(TSB_SC_TypeDef * SIOx);
|
||||
void SIO_SetTxData(TSB_SC_TypeDef * SIOx, uint8_t Data);
|
||||
void SIO_Init(TSB_SC_TypeDef * SIOx, uint32_t IOClkSel, SIO_InitTypeDef * InitStruct);
|
||||
/** @} */
|
||||
/* End of group UART_Exported_FunctionPrototypes */
|
||||
|
||||
/** @} */
|
||||
/* End of group UART */
|
||||
|
||||
/** @} */
|
||||
/* End of group TX04_Periph_Driver */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __TMPM46B_UART_H */
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file tx04_common.h
|
||||
* @brief All common macro and definition for TX04 peripheral drivers
|
||||
* @version V2.0.2.1
|
||||
* @date 2015/02/04
|
||||
*
|
||||
* DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT.
|
||||
*
|
||||
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TX04_COMMON_H
|
||||
#define __TX04_COMMON_H
|
||||
|
||||
typedef enum {
|
||||
SUCCESS = 0U,
|
||||
ERROR = 1U,
|
||||
FAIL = -1
|
||||
} Result;
|
||||
|
||||
typedef enum {
|
||||
BUSY = 0U,
|
||||
DONE = 1U
|
||||
} WorkState;
|
||||
|
||||
typedef enum {
|
||||
DISABLE = 0U,
|
||||
ENABLE = 1U
|
||||
} FunctionalState;
|
||||
|
||||
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
|
||||
#define IS_POINTER_NOT_NULL(param) ((void*)(param) != (void*)0)
|
||||
|
||||
/*
|
||||
* To report the name of the source file and source line number where the
|
||||
* assert_param error has occurred, "DEBUG" must be defined. And detailed
|
||||
* definition of assert_failed() is needed to be implemented, which can be
|
||||
* done, for example, in the main.c file.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void assert_failed(char *file, int32_t line);
|
||||
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((char *)__FILE__, __LINE__))
|
||||
#else
|
||||
#define assert_param(expr)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#endif /* __TX04_COMMON_H */
|
||||
Reference in New Issue
Block a user