mcu.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @file
  3. * @author chipsea
  4. * @brief
  5. * @version 0.1
  6. * @date 2020-11-30
  7. * @copyright Copyright (c) 2020, CHIPSEA Co., Ltd.
  8. * @note
  9. */
  10. /**************************************************************************************************
  11. Filename: mcu.h
  12. Revised:
  13. Revision:
  14. Description: Describe the purpose and contents of the file.
  15. **************************************************************************************************/
  16. #ifndef _HAL_MCU_H
  17. #define _HAL_MCU_H
  18. /* ------------------------------------------------------------------------------------------------
  19. * Includes
  20. * ------------------------------------------------------------------------------------------------
  21. */
  22. #include "types.h"
  23. #include <stdint.h>
  24. //enum{
  25. // MCU_UNDEF = 0,
  26. // MCU_PRIME_A1 = 1,
  27. // MCU_PRIME_A2 = 2,
  28. // MCU_BUMBEE_M0,
  29. // MCU_BUMBEE_CK802
  30. //};
  31. #define SRAM_BASE_ADDR 0x1fff0000
  32. #define SRAM_END_ADDR 0x1fffffff
  33. #define ROM_SRAM_JUMPTABLE SRAM_BASE_ADDR
  34. #define ROM_SRAM_GLOBALCFG (ROM_SRAM_JUMPTABLE+0x400)
  35. #define ROM_SRAM_JUMPTABLE_MIRROR 0x1fffd000
  36. #define ROM_SRAM_GLOBALCFG_MIRROR (ROM_SRAM_JUMPTABLE_MIRROR+0x400)
  37. #define ROM_SRAM_HEAP 0x1fffe000
  38. #define ROM_SRAM_HEAP_SIZE (1024*8)
  39. #define ROM_SRAM_DWC_BUF 0x1ffffc00
  40. #define APP_SRAM_START_ADDR 0x1fff2000
  41. /* ------------------------------------------------------------------------------------------------
  42. * Target Defines
  43. * ------------------------------------------------------------------------------------------------
  44. */
  45. #define MAXMEMHEAP 4096
  46. #define HAL_ISER *((volatile uint32_t *)(0xe000e100))
  47. #define HAL_ICER *((volatile uint32_t *)(0xe000e180))
  48. //subWriteReg: write value to register zone: bit[high:low]
  49. #define subWriteReg(addr,high,low,value) write_reg(addr,read_reg(addr)&\
  50. (~((((unsigned int)1<<((high)-(low)+1))-1)<<(low)))|\
  51. ((unsigned int)(value)<<(low)))
  52. #define TIME_BASE (0x003fffff) // 24bit count shift 2 bit as 1us/bit
  53. #define TIME_DELTA(x,y) ( (x>=y) ? x-y : TIME_BASE-y+x ) //x is stop point, y is start point
  54. extern void drv_irq_init(void);
  55. extern int drv_enable_irq(void);
  56. extern int drv_disable_irq(void);
  57. #define HAL_CRITICAL_SECTION_INIT() drv_irq_init()
  58. #define HAL_ENTER_CRITICAL_SECTION() drv_disable_irq()
  59. #define HAL_EXIT_CRITICAL_SECTION() drv_enable_irq()
  60. /**************************************************************************************************
  61. */
  62. #endif