rt-thread/bsp/airm2m/air105/libraries/HAL_Driver/Inc/air105_ssc.h

160 lines
4.8 KiB
C
Raw Normal View History

/*
* Copyright (c) 2022 OpenLuat & AirM2M
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __AIR105_SSC_H
#define __AIR105_SSC_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "air105.h"
#define SSC_ITSysXTAL12M BIT(18) //ϵͳ<CFB5><CDB3>12Mʱ<4D>ӱ<EFBFBD>־
#define SSC_ITSysGlitch BIT(17) //<2F><><EFBFBD><EFBFBD>Դë<D4B4>̱<EFBFBD>־
#define SSC_ITSysVolHigh BIT(16) //<2F><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ѹ<EFBFBD><D1B9>־
#define SSC_ITSysVolLow BIT(15) //<2F><><EFBFBD><EFBFBD>ԴǷѹ<C7B7><D1B9>־
typedef struct
{
FunctionalState ParityCheck; //<2F><>żУ<C5BC><D0A3>ʹ<EFBFBD><CAB9>
}SSC_InitTypeDef;
/*
* <EFBFBD><EFBFBD>BPK<EFBFBD><EFBFBD>Ϊ4<EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD>256<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>дȨ<EFBFBD><EFBFBD>
* SSC_BPKAccessCtrBlock_0Ϊ<EFBFBD><EFBFBD>ʼ0<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>
*/
#define SSC_BPKAccessCtrBlock_0 (0x01)
#define SSC_BPKAccessCtrBlock_1 (0x02)
#define SSC_BPKAccessCtrBlock_All (0x03)
typedef enum
{
SSC_BPKReadOnly = 0x01, //BPK<50><4B>ֻ<EFBFBD><D6BB>
SSC_BPKWriteOnly = 0x02, //BPK<50><4B>ֻд
SSC_BPKReadWrite = 0x03 //BPK<50><4B><EFBFBD>д
}SSC_BPKAccessCtrlTypeDef;
#define IS_BPK_ACCESS_CTRL(CTRL) (((CTRL) == SSC_BPKReadOnly) || ((CTRL) == SSC_BPKWriteOnly) || \
((CTRL) == SSC_BPKReadWrite))
#define SSC_SENSOR_XTAL12M ((uint32_t)0x00000001)
#define SSC_SENSOR_VOL_LOW ((uint32_t)0x00000002)
#define SSC_SENSOR_VOL_HIGH ((uint32_t)0x00000004)
#define SSC_SENSOR_VOLGLITCH ((uint32_t)0x00000008)
#define IS_SSC_SENSOR(SENSOR) ((((SENSOR) & (uint32_t)0xFFFFFFF0) == 0x00) && ((SENSOR) != (uint32_t)0x00))
typedef enum
{
SSC_SENSOR_CPUReset = 0,
SSC_SENSOR_Interrupt = 1
}SSC_SENSOR_RespModeTypeDef;
#define IS_SSC_SENSOR_RESP_MODE(Mode) ((Mode) == SSC_SENSOR_CPUReset ||\
(Mode) == SSC_SENSOR_Interrupt)
/**
* @method SSC_Init
* @brief SSC<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD>Գ<EFBFBD>ʼ<EFBFBD><EFBFBD>
* @param SSC_InitTypeDef SSC_InitStruct
* @retval void
*/
void SSC_Init(SSC_InitTypeDef *SSC_InitStruct);
/**
* @method SSC_GetITStatus
* @brief SSC<EFBFBD><EFBFBD>ȫ<EFBFBD>ж<EFBFBD>״̬
* @param uint32_t SSC_IT
* @retval ITStatus
*/
ITStatus SSC_GetITStatus(uint32_t SSC_IT);
/**
* @method SSC_ClearITPendingBit
* @brief SSC<EFBFBD><EFBFBD>ȫ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param uint32_t SSC_IT
* @retval void
*/
void SSC_ClearITPendingBit( uint32_t SSC_IT);
/**
* @method SSC_SetDataRAMScrambler
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RAM<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param uint32_t Scrambler
* @retval void
*/
void SSC_SetDataRAMScrambler(uint32_t Scrambler);
/**
* @method SSC_BPKAccessCtrConfig
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>BPK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>
* @param uint32_t SSC_BPKAccessCtrBlock
* @param SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr
* @retval void
*/
void SSC_BPKAccessCtrlConfig(uint32_t SSC_BPKAccessCtrBlock, SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr);
/**
* @method SSC_SENSOR_Enable
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳSensor
* @param SSC_SENSOR
* @retval
*/
uint32_t SSC_SENSORCmd(uint32_t SSC_SENSOR, FunctionalState NewState);
/**
* @method SSC_SENSORLock
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳSensor<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
* @param SSC_SENSOR
* @retval
*/
void SSC_SENSORLock(uint32_t SSC_SENSOR);
/**
* @method SSC_SENSOR_AttackRespMode
* @brief ϵͳSensor<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>ʽ
* @param SSC_SENSOR_RespMode
* @retval
*/
void SSC_SENSORAttackRespMode(SSC_SENSOR_RespModeTypeDef SSC_SENSOR_RespMode);
void SSC_SENSORKeyClearCmd(uint32_t SSC_SENSOR, FunctionalState KeyClearEn);
#ifdef __cplusplus
}
#endif
#endif
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/