air105_ssc.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * Copyright (c) 2022 OpenLuat & AirM2M
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. * this software and associated documentation files (the "Software"), to deal in
  6. * the Software without restriction, including without limitation the rights to
  7. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  8. * the Software, and to permit persons to whom the Software is furnished to do so,
  9. * subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in all
  12. * copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. */
  21. #ifndef __AIR105_SSC_H
  22. #define __AIR105_SSC_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "air105.h"
  28. #define SSC_ITSysXTAL12M BIT(18) //ϵͳ��12Mʱ�ӱ�־
  29. #define SSC_ITSysGlitch BIT(17) //����Դë�̱�־
  30. #define SSC_ITSysVolHigh BIT(16) //����Դ��ѹ��־
  31. #define SSC_ITSysVolLow BIT(15) //����ԴǷѹ��־
  32. typedef struct
  33. {
  34. FunctionalState ParityCheck; //��żУ��ʹ��
  35. }SSC_InitTypeDef;
  36. /*
  37. * ��BPK��Ϊ4��ÿ��256����Ϊ��λ���ö�дȨ��
  38. * SSC_BPKAccessCtrBlock_0Ϊ��ʼ0��ַ��
  39. */
  40. #define SSC_BPKAccessCtrBlock_0 (0x01)
  41. #define SSC_BPKAccessCtrBlock_1 (0x02)
  42. #define SSC_BPKAccessCtrBlock_All (0x03)
  43. typedef enum
  44. {
  45. SSC_BPKReadOnly = 0x01, //BPK��ֻ��
  46. SSC_BPKWriteOnly = 0x02, //BPK��ֻд
  47. SSC_BPKReadWrite = 0x03 //BPK���д
  48. }SSC_BPKAccessCtrlTypeDef;
  49. #define IS_BPK_ACCESS_CTRL(CTRL) (((CTRL) == SSC_BPKReadOnly) || ((CTRL) == SSC_BPKWriteOnly) || \
  50. ((CTRL) == SSC_BPKReadWrite))
  51. #define SSC_SENSOR_XTAL12M ((uint32_t)0x00000001)
  52. #define SSC_SENSOR_VOL_LOW ((uint32_t)0x00000002)
  53. #define SSC_SENSOR_VOL_HIGH ((uint32_t)0x00000004)
  54. #define SSC_SENSOR_VOLGLITCH ((uint32_t)0x00000008)
  55. #define IS_SSC_SENSOR(SENSOR) ((((SENSOR) & (uint32_t)0xFFFFFFF0) == 0x00) && ((SENSOR) != (uint32_t)0x00))
  56. typedef enum
  57. {
  58. SSC_SENSOR_CPUReset = 0,
  59. SSC_SENSOR_Interrupt = 1
  60. }SSC_SENSOR_RespModeTypeDef;
  61. #define IS_SSC_SENSOR_RESP_MODE(Mode) ((Mode) == SSC_SENSOR_CPUReset ||\
  62. (Mode) == SSC_SENSOR_Interrupt)
  63. /**
  64. * @method SSC_Init
  65. * @brief SSC��ȫ���Գ�ʼ��
  66. * @param SSC_InitTypeDef SSC_InitStruct
  67. * @retval void
  68. */
  69. void SSC_Init(SSC_InitTypeDef *SSC_InitStruct);
  70. /**
  71. * @method SSC_GetITStatus
  72. * @brief SSC��ȫ�ж�״̬
  73. * @param uint32_t SSC_IT
  74. * @retval ITStatus
  75. */
  76. ITStatus SSC_GetITStatus(uint32_t SSC_IT);
  77. /**
  78. * @method SSC_ClearITPendingBit
  79. * @brief SSC��ȫ�ж����
  80. * @param uint32_t SSC_IT
  81. * @retval void
  82. */
  83. void SSC_ClearITPendingBit( uint32_t SSC_IT);
  84. /**
  85. * @method SSC_SetDataRAMScrambler
  86. * @brief ��������RAM����
  87. * @param uint32_t Scrambler
  88. * @retval void
  89. */
  90. void SSC_SetDataRAMScrambler(uint32_t Scrambler);
  91. /**
  92. * @method SSC_BPKAccessCtrConfig
  93. * @brief ����BPK����Ȩ��
  94. * @param uint32_t SSC_BPKAccessCtrBlock
  95. * @param SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr
  96. * @retval void
  97. */
  98. void SSC_BPKAccessCtrlConfig(uint32_t SSC_BPKAccessCtrBlock, SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr);
  99. /**
  100. * @method SSC_SENSOR_Enable
  101. * @brief ����ϵͳSensor
  102. * @param SSC_SENSOR
  103. * @retval
  104. */
  105. uint32_t SSC_SENSORCmd(uint32_t SSC_SENSOR, FunctionalState NewState);
  106. /**
  107. * @method SSC_SENSORLock
  108. * @brief ����ϵͳSensor����״̬
  109. * @param SSC_SENSOR
  110. * @retval
  111. */
  112. void SSC_SENSORLock(uint32_t SSC_SENSOR);
  113. /**
  114. * @method SSC_SENSOR_AttackRespMode
  115. * @brief ϵͳSensor��Ӧ��ʽ
  116. * @param SSC_SENSOR_RespMode
  117. * @retval
  118. */
  119. void SSC_SENSORAttackRespMode(SSC_SENSOR_RespModeTypeDef SSC_SENSOR_RespMode);
  120. void SSC_SENSORKeyClearCmd(uint32_t SSC_SENSOR, FunctionalState KeyClearEn);
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif
  125. /************************** (C) COPYRIGHT Megahunt *****END OF FILE****/