air105_bpk.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_BPK_H
  22. #define __AIR105_BPK_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "air105.h"
  28. /** @defgroup BPK_Exported_Types
  29. * @{
  30. */
  31. #define BPK_KEY_REGION_0 ((uint32_t)0x0001)
  32. #define BPK_KEY_REGION_1 ((uint32_t)0x0002)
  33. #define BPK_KEY_REGION_ALL ((uint32_t)0x0003)
  34. #define IS_BPK_KEY_REGION(REGION) ((((REGION) & ~BPK_KEY_REGION_ALL) == 0x00) && ((REGION) != 0x00))
  35. #define IS_BPK_LOCK(LOCK) ((((LOCK) & ~BPK_LR_LOCK_ALL) == 0x00) && ((LOCK) != (uint32_t)0x00))
  36. FlagStatus BPK_IsReady(void);
  37. ErrorStatus BPK_WriteKey(uint32_t *Key,uint32_t Key_Len, uint32_t Key_Offset);
  38. ErrorStatus BPK_ReadKey(uint32_t *Key,uint32_t Key_Len, uint32_t Key_Offset);
  39. void BPK_KeyWriteLock(uint16_t BPK_KEY_Region, FunctionalState NewState);
  40. void BPK_KeyReadLock(uint16_t BPK_KEY_Region, FunctionalState NewState);
  41. void BPK_KeyClear(uint16_t BPK_KEY_Region);
  42. void BPK_SetScramber(uint32_t Scram);
  43. void BPK_Lock(uint32_t BPK_LOCK, FunctionalState NewState);
  44. void BPK_LockSelf(void);
  45. FlagStatus BPK_GetLockStatus(uint32_t BPK_LOCK);
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif
  50. /************************** (C) COPYRIGHT Megahunt *****END OF FILE****/