160 lines
4.8 KiB
C
160 lines
4.8 KiB
C
/*
|
||
* 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;
|
||
|
||
|
||
/*
|
||
* <20><>BPK<50><4B>Ϊ4<CEAA><34>ÿ<EFBFBD><C3BF>256<35><36><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ<EFBFBD><CEBB><EFBFBD>ö<EFBFBD>дȨ<D0B4><C8A8>
|
||
* SSC_BPKAccessCtrBlock_0Ϊ<30><CEAA>ʼ0<CABC><30>ַ<EFBFBD><D6B7>
|
||
*/
|
||
#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<53><43>ȫ<EFBFBD><C8AB><EFBFBD>Գ<EFBFBD>ʼ<EFBFBD><CABC>
|
||
* @param SSC_InitTypeDef SSC_InitStruct
|
||
* @retval void
|
||
*/
|
||
void SSC_Init(SSC_InitTypeDef *SSC_InitStruct);
|
||
|
||
|
||
/**
|
||
* @method SSC_GetITStatus
|
||
* @brief SSC<53><43>ȫ<EFBFBD>ж<EFBFBD>״̬
|
||
* @param uint32_t SSC_IT
|
||
* @retval ITStatus
|
||
*/
|
||
ITStatus SSC_GetITStatus(uint32_t SSC_IT);
|
||
|
||
|
||
/**
|
||
* @method SSC_ClearITPendingBit
|
||
* @brief SSC<53><43>ȫ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>
|
||
* @param uint32_t SSC_IT
|
||
* @retval void
|
||
*/
|
||
void SSC_ClearITPendingBit( uint32_t SSC_IT);
|
||
|
||
|
||
/**
|
||
* @method SSC_SetDataRAMScrambler
|
||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RAM<41><4D><EFBFBD><EFBFBD>
|
||
* @param uint32_t Scrambler
|
||
* @retval void
|
||
*/
|
||
void SSC_SetDataRAMScrambler(uint32_t Scrambler);
|
||
|
||
|
||
/**
|
||
* @method SSC_BPKAccessCtrConfig
|
||
* @brief <20><><EFBFBD><EFBFBD>BPK<50><4B><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||
* @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 <20><><EFBFBD><EFBFBD>ϵͳSensor
|
||
* @param SSC_SENSOR
|
||
* @retval
|
||
*/
|
||
uint32_t SSC_SENSORCmd(uint32_t SSC_SENSOR, FunctionalState NewState);
|
||
|
||
|
||
/**
|
||
* @method SSC_SENSORLock
|
||
* @brief <20><><EFBFBD><EFBFBD>ϵͳSensor<6F><72><EFBFBD><EFBFBD>״̬
|
||
* @param SSC_SENSOR
|
||
* @retval
|
||
*/
|
||
void SSC_SENSORLock(uint32_t SSC_SENSOR);
|
||
|
||
|
||
/**
|
||
* @method SSC_SENSOR_AttackRespMode
|
||
* @brief ϵͳSensor<6F><72>Ӧ<EFBFBD><D3A6>ʽ
|
||
* @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****/
|