hal_mcu.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**************************************************************************************************
  2. Phyplus Microelectronics Limited confidential and proprietary.
  3. All rights reserved.
  4. IMPORTANT: All rights of this software belong to Phyplus Microelectronics
  5. Limited ("Phyplus"). Your use of this Software is limited to those
  6. specific rights granted under the terms of the business contract, the
  7. confidential agreement, the non-disclosure agreement and any other forms
  8. of agreements as a customer or a partner of Phyplus. You may not use this
  9. Software unless you agree to abide by the terms of these agreements.
  10. You acknowledge that the Software may not be modified, copied,
  11. distributed or disclosed unless embedded on a Phyplus Bluetooth Low Energy
  12. (BLE) integrated circuit, either as a product or is integrated into your
  13. products. Other than for the aforementioned purposes, you may not use,
  14. reproduce, copy, prepare derivative works of, modify, distribute, perform,
  15. display or sell this Software and/or its documentation for any purposes.
  16. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  17. PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  18. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  19. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  20. PHYPLUS OR ITS SUBSIDIARIES BE LIABLE OR OBLIGATED UNDER CONTRACT,
  21. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  22. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  23. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  24. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  25. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  26. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  27. **************************************************************************************************/
  28. /**************************************************************************************************
  29. Filename: hal_mcu.h
  30. Revised:
  31. Revision:
  32. Description: Describe the purpose and contents of the file.
  33. **************************************************************************************************/
  34. #ifndef _HAL_MCU_H
  35. #define _HAL_MCU_H
  36. /* ------------------------------------------------------------------------------------------------
  37. * Includes
  38. * ------------------------------------------------------------------------------------------------
  39. */
  40. #include "hal_defs.h"
  41. #include "types.h"
  42. #include <stdint.h>
  43. /* ------------------------------------------------------------------------------------------------
  44. * Target Defines
  45. * ------------------------------------------------------------------------------------------------
  46. */
  47. #define MAXMEMHEAP 4096
  48. typedef enum{
  49. MOD_NONE = 0, MOD_SOFT_RESET =0, MOD_CPU = 0,
  50. MOD_LOCKUP_RESET_EN =1,
  51. MOD_WDT_RESET_EN =2,
  52. MOD_DMA =3,
  53. MOD_AES =4,
  54. MOD_TIMER =5,
  55. MOD_WDT =6,
  56. MOD_COM =7,
  57. MOD_UART =8,
  58. MOD_I2C0 =9,
  59. MOD_I2C1 =10,
  60. MOD_SPI0 =11,
  61. MOD_SPI1 =12,
  62. MOD_GPIO =13,
  63. MOD_I2S =14,
  64. MOD_QDEC =15,
  65. MOD_RNG =16,
  66. MOD_ADCC =17,
  67. MOD_PWM =18,
  68. MOD_SPIF =19,
  69. MOD_VOC =20,
  70. MOD_KSCAN =31,
  71. MOD_USR0 =32,
  72. MOD_USR1 =33,
  73. MOD_USR2 =34,
  74. MOD_USR3 =35,
  75. MOD_USR4 =36,
  76. MOD_USR5 =37,
  77. MOD_USR6 =38,
  78. MOD_USR8 =39,
  79. }MODULE_e;
  80. /* ------------------------------------------------------------------------------------------------
  81. * Compiler Abstraction
  82. * ------------------------------------------------------------------------------------------------
  83. */
  84. /* ------------------------------------------------------------------------------------------------
  85. * Interrupt Macros
  86. * ------------------------------------------------------------------------------------------------
  87. */
  88. //#define HAL_ENABLE_INTERRUPTS() st( EA = 1; )
  89. //#define HAL_DISABLE_INTERRUPTS() st( EA = 0; )
  90. //#define HAL_INTERRUPTS_ARE_ENABLED() (EA)
  91. //typedef unsigned char halIntState_t;
  92. //#define HAL_ENTER_CRITICAL_SECTION(x) st( x = EA; HAL_DISABLE_INTERRUPTS(); )
  93. //#define HAL_EXIT_CRITICAL_SECTION(x) st( EA = x; )
  94. //#define HAL_CRITICAL_STATEMENT(x) st( halIntState_t _s; HAL_ENTER_CRITICAL_SECTION(_s); x; HAL_EXIT_CRITICAL_SECTION(_s); )
  95. //#define HAL_ISER *((volatile uint32_t *)(0xe000e100))
  96. //#define HAL_ICER *((volatile uint32_t *)(0xe000e180))
  97. #define HAL_ENABLE_INTERRUPTS() st( __enable_irq(); )
  98. #define HAL_DISABLE_INTERRUPTS() st( __disable_irq(); )
  99. #define HAL_INTERRUPTS_ARE_ENABLED() (HAL_ISER)
  100. typedef uint32_t halIntState_t;
  101. #define HAL_ENTER_CRITICAL_SECTION() __disable_irq()
  102. #define HAL_EXIT_CRITICAL_SECTION() __enable_irq()
  103. /**************************************************************************************************
  104. */
  105. #endif