board.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. #ifndef _BOARD_H
  2. #define _BOARD_H
  3. /********** display configuration **********/
  4. #define LCD_INTERFACE_TTL 0
  5. #define LCD_INTERFACE_LVDS 1
  6. #define LCD_INTERFACE_CPU 2
  7. #define LCD_INTERFACE_MIPI 3
  8. #define LCD_WIRING_MODE_RGB 0
  9. #define LCD_WIRING_MODE_RBG 1
  10. #define LCD_WIRING_MODE_GRB 2
  11. #define LCD_WIRING_MODE_GBR 3
  12. #define LCD_WIRING_MODE_BRG 4
  13. #define LCD_WIRING_MODE_BGR 5
  14. #define LCD_WIRING_BIT_ORDER_MSB 0
  15. #define LCD_WIRING_BIT_ORDER_LSB 1
  16. #define LVDS_PANEL_FORMAT_VESA 0
  17. #define LVDS_PANEL_FORMAT_JEDIA 1
  18. #define LVDS_PANEL_DATA_8BIT 0
  19. #define LVDS_PANEL_DATA_6BIT 1
  20. #define LVDS_CLKEDGE_POSITIVE 0
  21. #define LVDS_CLKEDGE_NEGATIVE 1
  22. #define CPU_PANEL_18BIT_MODE 0
  23. #define CPU_PANEL_16BIT_MODE 1
  24. #define CPU_PANEL_9BIT_MODE 2
  25. #define CPU_PANEL_8BIT_MODE 3
  26. #define LCD_ROTATE_ANGLE_0 0
  27. #define LCD_ROTATE_ANGLE_90 1
  28. #define LCD_ROTATE_ANGLE_180 2
  29. #define LCD_ROTATE_ANGLE_270 3
  30. #define LCD_H_FLIP 0 //水平镜像
  31. #define LCD_V_FLIP 0 //垂直镜像
  32. //#define LCD_CLK_INVERSE //LCD时钟极性反向
  33. #define LCD_ROTATE_ANGLE LCD_ROTATE_ANGLE_0
  34. #define LCD_WIDTH 1920
  35. #define LCD_HEIGHT 720
  36. #define LCD_BPP 32
  37. #define LCD_INTERFACE_TYPE LCD_INTERFACE_LVDS
  38. #define DOUBLE_LVDS_ENABLE 1
  39. #if !DOUBLE_LVDS_ENABLE
  40. #define SINGLE_LVDS_CH0_EN 1
  41. #define SINGLE_LVDS_CH1_EN 0
  42. #endif
  43. #if LCD_INTERFACE_TYPE == LCD_INTERFACE_TTL
  44. #define LCD_WIRING_MODE LCD_WIRING_MODE_RGB
  45. //#define LCD_WIRING_BIT_ORDER LCD_WIRING_BIT_ORDER_LSB
  46. #define LCD_WIRING_BIT_ORDER LCD_WIRING_BIT_ORDER_MSB
  47. #elif LCD_INTERFACE_TYPE == LCD_INTERFACE_LVDS
  48. #define LCD_WIRING_MODE LCD_WIRING_MODE_RGB
  49. #define LCD_WIRING_BIT_ORDER LCD_WIRING_BIT_ORDER_MSB
  50. #define LVDS_PANEL_FORMAT LVDS_PANEL_FORMAT_VESA
  51. #define LVDS_PANEL_DATA LVDS_PANEL_DATA_8BIT
  52. #define LVDS_CLKEDGE LVDS_CLKEDGE_POSITIVE
  53. #define LVDS_SCREEN_RST_GPIO 74
  54. #elif LCD_INTERFACE_TYPE == LCD_INTERFACE_CPU
  55. #define CPU_PANEL_DATA CPU_PANEL_8BIT_MODE
  56. #elif LCD_INTERFACE_TYPE == LCD_INTERFACE_MIPI
  57. #define LCD_WIRING_MODE LCD_WIRING_MODE_RGB
  58. #define LCD_WIRING_BIT_ORDER LCD_WIRING_BIT_ORDER_MSB
  59. #endif
  60. #define FB_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BPP / 8)
  61. #define VIDEO_DISPLAY_WIDTH ((LCD_WIDTH + 15) & (~0xF))
  62. #define VIDEO_DISPLAY_HEIGHT ((LCD_HEIGHT + 15) & (~0xF))
  63. #define VIDEO_DISPLAY_BUF_NUM 2
  64. #if (LCD_WIDTH == 1024 && LCD_HEIGHT == 600)
  65. #define LCD_TIMING_VBP 1
  66. #define LCD_TIMING_VFP 1
  67. #define LCD_TIMING_VSW 30
  68. #define LCD_TIMING_HBP 100
  69. #define LCD_TIMING_HFP 100
  70. #define LCD_TIMING_HSW 370
  71. #define LCD_CLK_FREQ 50000000
  72. #elif (LCD_WIDTH == 1920 && LCD_HEIGHT == 720)
  73. #define LCD_TIMING_VBP 11
  74. #define LCD_TIMING_VFP 14
  75. #define LCD_TIMING_VSW 7
  76. #define LCD_TIMING_HBP 38*2
  77. #define LCD_TIMING_HFP 30*2
  78. #define LCD_TIMING_HSW 36*2
  79. #define LCD_CLK_FREQ 96000000
  80. #elif (LCD_WIDTH == 800 && LCD_HEIGHT == 480)
  81. #define LCD_TIMING_VBP 1
  82. #define LCD_TIMING_VFP 1
  83. #define LCD_TIMING_VSW 30
  84. #define LCD_TIMING_HBP 50
  85. #define LCD_TIMING_HFP 50
  86. #define LCD_TIMING_HSW 180
  87. #define LCD_CLK_FREQ 35000000
  88. #elif (LCD_WIDTH == 1280 && LCD_HEIGHT == 720)
  89. #define LCD_TIMING_VBP 5
  90. #define LCD_TIMING_VFP 65
  91. #define LCD_TIMING_VSW 2
  92. #define LCD_TIMING_HBP 16
  93. #define LCD_TIMING_HFP 42
  94. #define LCD_TIMING_HSW 2
  95. #define LCD_CLK_FREQ 60000000
  96. #elif (LCD_WIDTH == 1280 && LCD_HEIGHT == 480)
  97. #define LCD_TIMING_VBP 5
  98. #define LCD_TIMING_VFP 8
  99. #define LCD_TIMING_VSW 3
  100. #define LCD_TIMING_HBP 16
  101. #define LCD_TIMING_HFP 28 //26
  102. #define LCD_TIMING_HSW 12
  103. #define LCD_CLK_FREQ 40000000
  104. #elif (LCD_WIDTH == 480 && LCD_HEIGHT == 1280)
  105. #define LCD_TIMING_VBP 6// 14
  106. #define LCD_TIMING_VFP 6// 16
  107. #define LCD_TIMING_VSW 16// 2
  108. #define LCD_TIMING_HBP 16
  109. #define LCD_TIMING_HFP 36
  110. #define LCD_TIMING_HSW 26
  111. #define LCD_CLK_FREQ 50000000
  112. #else
  113. #error "no lcd timing configuraion."
  114. #endif
  115. /*******************************************/
  116. /************ adc configuration ************/
  117. //#define ADC_TOUCH
  118. //#define ADC_KEY
  119. /*******************************************/
  120. /******* video in configuration *******/
  121. #define VIDEO_DECODER_RN6752
  122. //#define VIDEO_DECODER_MIPI
  123. //#define VIDEO_DECODER_ARK7116M
  124. //#define VIDEO_DECODER_ARK7116
  125. #define VIN_CVBS_PAL 0
  126. #define VIN_CVBS_NTSC 1
  127. #define VIN_AHD_720P_25 2
  128. #define VIN_AHD_720P_30 3
  129. #define VIN_AHD_1080P_25 4
  130. #define VIN_AHD_1080P_30 5
  131. #define VIDEO_IN_FORMAT VIN_AHD_720P_25//VIN_CVBS_NTSC
  132. #if VIDEO_IN_FORMAT == VIN_CVBS_PAL
  133. #define VIN_WIDTH 720
  134. #define VIN_HEIGHT 288
  135. #elif VIDEO_IN_FORMAT == VIN_CVBS_NTSC
  136. #define VIN_WIDTH 720
  137. #define VIN_HEIGHT 240
  138. #elif VIDEO_IN_FORMAT == VIN_AHD_720P_25 || VIDEO_IN_FORMAT == VIN_AHD_720P_30
  139. #define VIN_WIDTH 1280
  140. #define VIN_HEIGHT 720
  141. #elif VIDEO_IN_FORMAT == VIN_AHD_1080P_25 || VIDEO_IN_FORMAT == VIN_AHD_1080P_30
  142. #define VIN_WIDTH 1920
  143. #define VIN_HEIGHT 1080
  144. #endif
  145. #if VIN_WIDTH * VIN_HEIGHT > 0x96000
  146. #define VIN_SMALL_MEM
  147. #endif
  148. /*******************************************/
  149. /************ carback configuration ********/
  150. //#define CARBACK_DETECT
  151. /*******************************************/
  152. /********* touchscreen configuration *******/
  153. //#define TP_SUPPORT
  154. /********* wrap configuration *******/
  155. //#define WRAP_SUPPORT
  156. #ifdef TP_SUPPORT
  157. /* Select one tp IC */
  158. //#define TP_USE_GT9XX
  159. //#define TP_USE_GA657X
  160. //#define TP_USE_FT6336U
  161. /* Config tp parameters */
  162. #define TP_GPIO_INT 4
  163. #define TP_GPIO_RST 5
  164. #define TP_INV_X 0
  165. #define TP_INV_Y 0
  166. #define TP_INV_XY_AXIS 0 //翻转XY轴
  167. #define TP_MT_TOUCH 0 //支持多点触摸
  168. #endif
  169. /*******************************************/
  170. /*********** sdmmc configuration ***********/
  171. #define SDMMC0_SUPPORT
  172. #define SDMMC1_SUPPORT
  173. #if defined(SDMMC0_SUPPORT) || defined(SDMMC1_SUPPORT)
  174. #define SDMMC_SUPPORT
  175. #endif
  176. /*******************************************/
  177. /*********** uart configuration ************/
  178. #define UART_MCU_PORT 3
  179. #define UART_DEBUG_PORT UART_ID0
  180. /*******************************************/
  181. /************ rtc configuration ************/
  182. //#define RTC_SUPPORT
  183. /*******************************************/
  184. /************ remote configuration ************/
  185. //#define REMOTE_SUPPORT
  186. /*******************************************/
  187. /************ pwm capture configuration ************/
  188. //#define PWM_CAP_SUPPORT
  189. /*******************************************/
  190. /************ i2c configuration ************/
  191. #define DW_I2C0_SUPPORT
  192. //#define DW_I2C1_SUPPORT
  193. //#define ANALOG_I2C_SUPPORT
  194. #define I2C_GPIO0_SDA_PIN 66
  195. #define I2C_GPIO0_SCL_PIN 65
  196. /*******************************************/
  197. /************ dw spi configuration ************/
  198. #define DW_SPI0_SUPPORT
  199. #define DW_SPI2_SUPPORT
  200. /*******************************************/
  201. /************ ecspi configuration ************/
  202. #define EC_SPI1_SUPPORT
  203. /*******************************************/
  204. /************ adc configuration ************/
  205. //#define ADC_SUPPORT
  206. #ifdef ADC_SUPPORT
  207. //#define ADC0_SUPPORT
  208. //#define ADC1_SUPPORT
  209. //#define ADC2_SUPPORT
  210. #endif
  211. /*******************************************/
  212. /************ dma configuration ************/
  213. /* the smaller channel has higher priority */
  214. #define SPI0_RX_DMA_CH 0
  215. #define I2S_DMA_RXCH 3
  216. #define I2S_DMA_TXCH 4
  217. #define I2S1_DMA_RXCH I2S_DMA_RXCH
  218. #define I2S1_DMA_TXCH I2S_DMA_TXCH
  219. #define ECSPI_TX_DMA_CH 5
  220. #define ECSPI_RX_DMA_CH 6
  221. /*******************************************/
  222. /************ usb configuration ************/
  223. #define USB_SUPPORT
  224. #define USB_MODE_ID -1
  225. //#define USB_DMA
  226. //#define USB_UVC_SUPPORT
  227. #define CONFIG_USB_DWC2_HOST 1
  228. #define CONFIG_USB_NEW_DWC2_HOST 1
  229. #define CONFIG_USB_DWC2_PERIPHERAL 1
  230. #define CONFIG_USB_NEW_DWC2_GADGET 1
  231. #if USB_MODE_ID && USB_MODE_ID != -1
  232. #define CONFIG_USB_DEVICE_CDC_NCM 1
  233. #endif
  234. /*******************************************/
  235. /************ carlink configuration ************/
  236. #ifdef CARLINK_ENABLE /* define in iar options */
  237. #define WIFI_SUPPORT
  238. #endif
  239. #ifdef WIFI_SUPPORT
  240. #define CARLINK_EY 0
  241. #define CARLINK_EC 1
  242. #define WIFI_RESET_IO 95
  243. #else
  244. #define CARLINK_EY 0
  245. #define CARLINK_EC 0
  246. #endif
  247. #if CARLINK_EY && CARLINK_EC
  248. #error "Do not choose two car links"
  249. #endif
  250. #if CARLINK_EC == 1
  251. #define USE_LWIP 1
  252. #else
  253. #define USE_LWIP 0
  254. #endif
  255. #define BT_RESET_IO 94
  256. #define BT_UART_PORT 1
  257. //#define RELTECK_WIFI_AP_MODE
  258. /*******************************************/
  259. /************ audio configuration ************/
  260. #define I2S_ID0 0
  261. #define I2S_ID1 1
  262. #define I2S_NUMS 2
  263. /* add your adc type */
  264. #define AUDIO_CODEC_ADC_NONE 0 //Not use codec adc ic or no need driver.
  265. #define AUDIO_CODEC_ADC_ES7243E 1 //Use codec adc ic es7243e.
  266. /* add your dac type */
  267. #define AUDIO_CODEC_DAC_NONE 0 //Not use codec adc ic or no need driver.
  268. #define AUDIO_CODEC_DAC_ES8156 1 //Use codec dac ic es8156.
  269. /* choose your audio use type */
  270. //#define AUDIO_REPLAY
  271. //#define AUDIO_RECORD
  272. #ifdef AUDIO_REPLAY
  273. #define AUDIO_REPLAY_I2S I2S_ID0 /* Select i2s id */
  274. #define AUDIO_CODEC_DAC_IC AUDIO_CODEC_DAC_NONE /* Select your codec dac type */
  275. #endif
  276. #ifdef AUDIO_RECORD
  277. #define AUDIO_RECORD_I2S I2S_ID1 /* Select i2s id */
  278. #define AUDIO_CODEC_ADC_IC AUDIO_CODEC_ADC_ES7243E /* Select your codec adc type */
  279. #endif
  280. #ifndef AUDIO_CODEC_DAC_IC
  281. #define AUDIO_CODEC_DAC_IC AUDIO_CODEC_DAC_NONE /* Do not use codec dac by default */
  282. #endif
  283. #ifndef AUDIO_CODEC_ADC_IC
  284. #define AUDIO_CODEC_ADC_IC AUDIO_CODEC_ADC_NONE /* Do not use codec adc by default */
  285. #endif
  286. #if (AUDIO_CODEC_DAC_IC == AUDIO_CODEC_DAC_ES8156)
  287. #define AUDIO_CODEC_DAC_NAME "ES8156"
  288. #else
  289. #define AUDIO_CODEC_DAC_NAME ""
  290. #endif
  291. #if (AUDIO_CODEC_ADC_IC == AUDIO_CODEC_ADC_ES7243E)
  292. #define AUDIO_CODEC_ADC_NAME "ES7243E"
  293. #else
  294. #define AUDIO_CODEC_ADC_NAME ""
  295. #endif
  296. /*******************************************/
  297. /********** mailbox configuration **********/
  298. #define MAILBOX_SUPPORT
  299. /*******************************************/
  300. /************ eth configuration ************/
  301. // #define ETH_SUPPORT
  302. #define ETH_TXC_PAD_DIR_OUTPUT 1 // 0:TXC作为输入 1:TXC作为输出
  303. #define PHY_JL3101_SEL 0
  304. #define PHY_JL3101_RST_IO 21
  305. #if PHY_JL3101_SEL
  306. #define ETH_AUTONEGOTIATION 0
  307. #define CLAUSE45_ENABLE 1
  308. #else
  309. #define ETH_AUTONEGOTIATION 1
  310. #define CLAUSE45_ENABLE 0
  311. #endif
  312. /*******************************************/
  313. /********** romfile configuration **********/
  314. /* 没有定义ROMFILE_USE_SMALL_MEM,romfile内容会全部加载到ddr
  315. * 内存不足时可以定义ROMFILE_USE_SMALL_MEM节省内存使用 */
  316. #define ROMFILE_USE_SMALL_MEM
  317. #ifndef ROMFILE_USE_SMALL_MEM
  318. /* 定义READ_ROMFILE_ONCE,romfile内容会整个一次加载到ddr,如果
  319. * 文件过大会导致启动时间慢 */
  320. //#define READ_ROMFILE_ONCE
  321. #else
  322. /* 缓存在DDR里的文件数,未缓存的文件需要重新从flash里读取 */
  323. #define ROMFILE_CACHE_DEF_SIZE 0
  324. #endif
  325. /*******************************************/
  326. /********** animation configuration **********/
  327. #define ANIMATION_NONE 0
  328. #define ANIMATION_USE_SMALL_MEM 1
  329. #define ANIMATION_NORMAL 2
  330. #define ANIMATION_POLICY ANIMATION_NORMAL
  331. /*********************************************/
  332. /************ flash type configuration ************/
  333. #define SPI_NOR_FLASH 0
  334. #define SPI_NAND_FLASH 1
  335. #define EMMC_FLASH 2
  336. #define DEVICE_TYPE_SELECT EMMC_FLASH //需要与MCU工程amt630hv160_conf.h中CPU_DEVICE_TYPE_SELECT对应
  337. #define MCU_DEVICE_TYPE_SELECT DEVICE_TYPE_SELECT //需要与MCU工程amt630hv160_conf.h中DEVICE_TYPE_SELECT对应
  338. #if DEVICE_TYPE_SELECT != EMMC_FLASH
  339. //#define SPI0_QSPI_MODE
  340. #else
  341. #if DEVICE_TYPE_SELECT != MCU_DEVICE_TYPE_SELECT
  342. #undef DW_SPI0_SUPPORT
  343. #endif
  344. #define DEVICE_PARTITION_NAME "/emmc"
  345. #endif
  346. /*******************************************/
  347. /********** update mode configuration **********/
  348. #define OTA_UPDATE_SUPPORT
  349. #ifdef OTA_UPDATE_SUPPORT
  350. #define IMAGE_RESOURCES_BACKUP
  351. //#define DELTA_UPDATE_SUPPORT
  352. #define MAILBOX_UPDATE_SUPPORT
  353. //#define WIFI_UPDATE_SUPPORT
  354. #if defined(WIFI_UPDATE_SUPPORT) && !defined(USB_SUPPORT)
  355. #error "Error! Should define USB_SUPPORT to support wifi simu update"
  356. #endif
  357. //#define NCM_UPDATE_SUPPORT
  358. #if defined(NCM_UPDATE_SUPPORT) && !CONFIG_USB_DEVICE_CDC_NCM
  359. #error "Error! Should define CONFIG_USB_DEVICE_CDC_NCM=1 to support ncm update"
  360. #endif
  361. //#define NCM_LOG_SUPPORT
  362. #if defined(NCM_LOG_SUPPORT) && !CONFIG_USB_DEVICE_CDC_NCM
  363. #error "Error! Should define CONFIG_USB_DEVICE_CDC_NCM=1 to support ncm log"
  364. #endif
  365. #else
  366. #error "Error! Should define OTA_UPDATE_SUPPORT to support other update options"
  367. #endif
  368. /*********************************************/
  369. /********** update address configuration **********/
  370. #if DEVICE_TYPE_SELECT == SPI_NOR_FLASH
  371. #define MCU_RESERVE_SIZE 0x100000ul //1MB
  372. #define SYSINFO_MAX_SIZE 0x1000 //4KB
  373. #define LOADER_MAX_SIZE 0x8000 //32KB
  374. #define APPFILE_MAX_SIZE 0x200000 //2MB
  375. #define ANIMFILE_MAX_SIZE 0x500000 //5MB
  376. #define ROMFILE_MAX_SIZE 0x1000000 //16MB
  377. #define OTA_MEDIA_SIZE 0xa00000 //10MB
  378. /**********************************************************************************************************************************
  379. spi nor flash address space( 0 address start)-(resources AB backup)
  380. |-----1MB-----|---4KB---|---4KB---|--32KB--|--32KB--|---2MB---|---5MB---|---16MB---|---2MB---|---5MB---|---16MB---|---10MB---|---end
  381. |-------------|---------|---------|--------|--------|---------|---------|----------|---------|---------|----------|----------|
  382. |0 |0x100000 |0x101000 |0x102000|0x10A000|0x112000 |0x312000 | 0x812000 |0x1812000|0x1A12000|0x1F12000 |0x2F12000 |
  383. |MCU reserved | SYSINFO |SYSINFO B| AMTLDR |AMTLDR B| APP | ANIM | ROM | APP B | ANIM B | ROM B | OTA |
  384. |_____________|_________|_________|________|________|_________|_________|__________|_________|_________|__________|__________|
  385. spi nor flash address space( 0 address start)
  386. |-----1MB-----|---4KB---|---4KB---|--32KB--|--32KB--|---2MB---|---5MB---|---16MB---|---2MB---|---5MB---|---end
  387. |-------------|---------|---------|--------|--------|---------|---------|--------- |---------|---------|
  388. |0 |0x100000 |0x101000 |0x102000|0x10A000|0x112000 |0x312000 | 0x812000 |0x1812000|0x1A12000|
  389. |MCU reserved | SYSINFO |SYSINFO B| AMTLDR |AMTLDR B| APP | ANIM | ROM | APP B | OTA |
  390. |_____________|_________|_________|________|________|_________|_________|__________|_________|_________|
  391. ***********************************************************************************************************************************/
  392. #elif DEVICE_TYPE_SELECT == EMMC_FLASH
  393. #define MCU_RESERVE_SIZE 0x1000000ul //16MB
  394. #define SYSINFO_MAX_SIZE 0x80000 //512KB
  395. #define LOADER_MAX_SIZE 0x80000 //512KB
  396. #define APPFILE_MAX_SIZE 0x1000000 //16MB
  397. #define ANIMFILE_MAX_SIZE 0x500000 //5MB
  398. #define ROMFILE_MAX_SIZE 0x8000000 //128MB
  399. #define OTA_MEDIA_SIZE 0x10000000 //256MB
  400. /***********************************************************************************************************************************
  401. emmc address space( 0 address start)-(resources AB backup)
  402. |----16MB-----|---512KB---|---512KB---|---512KB---|---512KB---|---16MB---|---5MB---|---128MB--|---16MB---|---5MB----|---128MB---|--256MB---|---end
  403. |-------------|-----------|-----------|-----------|-----------|----------|---------|----------|----------|----------|-----------|----------|
  404. |0 | 0x1000000 | 0x1080000 | 0x1100000 | 0x1180000 |0x1200000 |0x2200000|0x2700000 |0xA700000 |0xB700000 | 0xBC00000 |0x13C00000|
  405. |MCU reserved | SYSINFO | SYSINFO B | AMTLDR | AMTLDR B | APP | ANIM | ROM | APP B | ANIM B | ROM B | OTA |
  406. |_____________|___________|___________|___________|___________|__________|_________|__________|__________|__________|___________|__________|
  407. emmc address space( 0 address start)
  408. |----16MB-----|---512KB---|---512KB---|---512KB---|---512KB---|---16MB---|---5MB---|---128MB--|---16MB---|--256MB---|---end
  409. |-------------|-----------|-----------|-----------|-----------|----------|---------|----------|----------|----------|
  410. |0 | 0x1000000 | 0x1080000 | 0x1100000 | 0x1180000 |0x1200000 |0x2200000|0x2700000 |0xA700000 |0xB700000 |
  411. |MCU reserved | SYSINFO | SYSINFO B | AMTLDR | AMTLDR B | APP | ANIM | ROM | APP B | OTA |
  412. |_____________|___________|___________|___________|___________|__________|_________|__________|__________|__________|
  413. *************************************************************************************************************************************/
  414. #else
  415. #error "Invalid flash type."
  416. #endif
  417. #define SYSINFO_OFFSET MCU_RESERVE_SIZE
  418. #define SYSINFO_B_OFFSET (SYSINFO_OFFSET + SYSINFO_MAX_SIZE)
  419. #define LOADER_OFFSET (SYSINFO_B_OFFSET + SYSINFO_MAX_SIZE)
  420. #define LOADER_B_OFFSET (LOADER_OFFSET + LOADER_MAX_SIZE)
  421. #define APPFILE_OFFSET (LOADER_B_OFFSET + LOADER_MAX_SIZE)
  422. #define ANIMFILE_OFFSET (APPFILE_OFFSET + APPFILE_MAX_SIZE)
  423. #define ROMFILE_OFFSET (ANIMFILE_OFFSET + ANIMFILE_MAX_SIZE)
  424. #define APPFILE_B_OFFSET (ROMFILE_OFFSET + ROMFILE_MAX_SIZE)
  425. #ifdef IMAGE_RESOURCES_BACKUP
  426. #define ANIMFILE_B_OFFSET (APPFILE_B_OFFSET + APPFILE_MAX_SIZE)
  427. #define ROMFILE_B_OFFSET (ANIMFILE_B_OFFSET + ANIMFILE_MAX_SIZE)
  428. #define OTA_MEDIA_OFFSET (ROMFILE_B_OFFSET + ROMFILE_MAX_SIZE)
  429. #else
  430. #define ANIMFILE_B_OFFSET ANIMFILE_OFFSET
  431. #define ROMFILE_B_OFFSET ROMFILE_OFFSET
  432. #define OTA_MEDIA_OFFSET (APPFILE_B_OFFSET + APPFILE_MAX_SIZE)
  433. #endif
  434. /*********************************************/
  435. /************ DDR config configuration ************/
  436. #define DDR_BASE 0x60000000ul
  437. #define DDR_TOTAL_SIZE 0x8000000 //128MB
  438. #define DDR_DRV_USE_SIZE 0x800000 //8MB
  439. #define DDR_MCU_ACCESS_MODULE_SIZE 0x40000 //256KB
  440. #define DDR_CPU_ACCESS_MODULE_SIZE 0x40000 //256KB
  441. #define DDR_MEDIA_USE_SIZE 0x80000 //512KB
  442. #if DEVICE_TYPE_SELECT == SPI_NOR_FLASH
  443. #define DDR_CAN_UPDATE_SIZE 0x200000 //2MB
  444. #define DDR_RESERVED_SIZE 0x500000 //5MB
  445. #elif DEVICE_TYPE_SELECT == EMMC_FLASH
  446. #define DDR_CAN_UPDATE_SIZE 0x400000 //4MB
  447. #define DDR_RESERVED_SIZE 0x300000 //3MB
  448. #endif
  449. #define DDR_DRV_USE_ADDR (DDR_BASE + DDR_TOTAL_SIZE - DDR_DRV_USE_SIZE)
  450. #define DDR_MCU_ACCESS_MODULE_ADDR (DDR_DRV_USE_ADDR)
  451. #define DDR_CPU_ACCESS_MODULE_ADDR (DDR_MCU_ACCESS_MODULE_ADDR + DDR_MCU_ACCESS_MODULE_SIZE)
  452. #define DDR_MEDIA_USE_ADDR (DDR_CPU_ACCESS_MODULE_ADDR + DDR_CPU_ACCESS_MODULE_SIZE)
  453. #define DDR_CAN_USE_ADDR (DDR_MEDIA_USE_ADDR + DDR_MEDIA_USE_SIZE)
  454. /*********************************************************************
  455. spi nor flash DDR address space
  456. |----120MB----|------256KB------|------256KB------|----512KB----|-----2MB-----|-----5MB-----|---end
  457. |-------------|-----------------|-----------------|-------------|-------------|-------------|
  458. |0x60000000 |0x67800000 |0x67840000 |0x67880000 |0x67900000 |0x67B00000 |
  459. |CPU USE |MCU Access module|CPU Access module|Media update |Can update |Reserved |
  460. |_____________|_________________|_________________|_____________|_____________|_____________|
  461. ***********************************************************************
  462. emmc DDR address space
  463. |----120MB----|------256KB------|------256KB------|----512KB----|-----4MB-----|-----3MB-----|---end
  464. |-------------|-----------------|-----------------|-------------|-------------|-------------|
  465. |0x60000000 |0x67800000 |0x67840000 |0x67880000 |0x67900000 |0x67D00000 |
  466. |CPU USE |MCU Access module|CPU Access module|Media update |Can update |Reserved |
  467. |_____________|_________________|_________________|_____________|_____________|_____________|
  468. **********************************************************************/
  469. /*********************************************/
  470. /********** ulog configuration **********/
  471. //#define USE_ULOG
  472. #define ULOG_NAME_MAX 8
  473. #define ULOG_LINE_BUF_SIZE 1024
  474. #define ULOG_OUTPUT_LEVEL
  475. #define ULOG_OUTPUT_TIME
  476. //#define ULOG_TIME_USING_TIMESTAMP
  477. //#define ULOG_OUTPUT_TAG
  478. //#define ULOG_USING_COLOR
  479. #define ULOG_USING_ISR_LOG
  480. #define ULOG_BACKEND_USING_CONSOLE
  481. #define ULOG_EASYFLASH_BACKEND_ENABLE
  482. #ifdef ULOG_EASYFLASH_BACKEND_ENABLE
  483. #define EASYFLASH_LOG
  484. #if DEVICE_TYPE_SELECT != EMMC_FLASH
  485. #define EASYFLASH_LOG_AREA_SIZE 0x100000
  486. #define EASYFLASH_ERASE_GRAN 0x1000
  487. #define EASYFLASH_WRITE_GRAN 0x100
  488. #define EASYFLASH_START_ADDR 0x1700000
  489. #else
  490. #define EASYFLASH_LOG_AREA_SIZE 0x100000
  491. #define EASYFLASH_ERASE_GRAN 0x10000
  492. #define EASYFLASH_WRITE_GRAN 0x200
  493. #define EASYFLASH_START_ADDR 0x60000000
  494. #endif
  495. #endif
  496. //#define ULOG_FILE_BACKEND_ENABLE
  497. #ifdef ULOG_FILE_BACKEND_ENABLE
  498. #if DEVICE_TYPE_SELECT != EMMC_FLASH
  499. #define ULOG_FILE_ROOT_PATH "/sf/logs"
  500. #else
  501. #define ULOG_FILE_ROOT_PATH "/emmc/logs"
  502. #endif
  503. #define ULOG_FILE_NAME_BASE "ulog.log"
  504. #define ULOG_FILE_MAX_NUM 10
  505. #define ULOG_FILE_MAX_SIZE (1024 * 32)
  506. #endif
  507. //#define ULOG_USING_ASYNC_OUTPUT //ulog异步输出
  508. #define ULOG_ASYNC_OUTPUT_BUF_SIZE 32768 //32K
  509. #define ULOG_ASYNC_OUTPUT_THREAD_STACK 2048
  510. #define ULOG_ASYNC_OUTPUT_THREAD_PRIORITY 10
  511. /*********************************************/
  512. #endif