board.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  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. #define ITU_OUT_WIDTH ((LCD_WIDTH + 7) & (~0x7)) //需8字节对齐
  149. #define ITU_OUT_HEIGHT LCD_HEIGHT
  150. /*******************************************/
  151. /************ carback configuration ********/
  152. //#define CARBACK_DETECT
  153. /*******************************************/
  154. /********* touchscreen configuration *******/
  155. //#define TP_SUPPORT
  156. /********* wrap configuration *******/
  157. //#define WRAP_SUPPORT
  158. #ifdef TP_SUPPORT
  159. /* Select one tp IC */
  160. //#define TP_USE_GT9XX
  161. //#define TP_USE_GA657X
  162. //#define TP_USE_FT6336U
  163. /* Config tp parameters */
  164. #define TP_GPIO_INT 4
  165. #define TP_GPIO_RST 5
  166. #define TP_INV_X 0
  167. #define TP_INV_Y 0
  168. #define TP_INV_XY_AXIS 0 //翻转XY轴
  169. #define TP_MT_TOUCH 0 //支持多点触摸
  170. #endif
  171. /*******************************************/
  172. /*********** sdmmc configuration ***********/
  173. #define SDMMC0_SUPPORT
  174. #define SDMMC1_SUPPORT
  175. #if defined(SDMMC0_SUPPORT) || defined(SDMMC1_SUPPORT)
  176. #define SDMMC_SUPPORT
  177. #endif
  178. /*******************************************/
  179. /*********** uart configuration ************/
  180. #define UART_MCU_PORT 3
  181. #define UART_DEBUG_PORT UART_ID0
  182. /*******************************************/
  183. /************ rtc configuration ************/
  184. //#define RTC_SUPPORT
  185. /*******************************************/
  186. /************ remote configuration ************/
  187. //#define REMOTE_SUPPORT
  188. /*******************************************/
  189. /************ pwm capture configuration ************/
  190. //#define PWM_CAP_SUPPORT
  191. /*******************************************/
  192. /************ i2c configuration ************/
  193. #define DW_I2C0_SUPPORT
  194. //#define DW_I2C1_SUPPORT
  195. //#define ANALOG_I2C_SUPPORT
  196. #define I2C_GPIO0_SDA_PIN 66
  197. #define I2C_GPIO0_SCL_PIN 65
  198. /*******************************************/
  199. /************ dw spi configuration ************/
  200. #define DW_SPI0_SUPPORT
  201. #define DW_SPI2_SUPPORT
  202. /*******************************************/
  203. /************ ecspi configuration ************/
  204. #define EC_SPI1_SUPPORT
  205. /*******************************************/
  206. /************ adc configuration ************/
  207. //#define ADC_SUPPORT
  208. #ifdef ADC_SUPPORT
  209. //#define ADC0_SUPPORT
  210. //#define ADC1_SUPPORT
  211. //#define ADC2_SUPPORT
  212. #define ADC0_THR_SEL 1 /* 阈值:0-> 0.2v,1->1.6V(adc电源1.8v时) */
  213. #define ADC1_THR_SEL 1 /* 阈值:0-> 0.2v,1->1.6V(adc电源1.8v时) */
  214. #define ADC2_THR_SEL 1 /* 阈值:0-> 0.2v,1->1.6V(adc电源1.8v时) */
  215. #endif
  216. /*******************************************/
  217. /************ dma configuration ************/
  218. /* the smaller channel has higher priority */
  219. #define SPI0_RX_DMA_CH 0
  220. #define I2S_DMA_RXCH 3
  221. #define I2S_DMA_TXCH 4
  222. #define I2S1_DMA_RXCH I2S_DMA_RXCH
  223. #define I2S1_DMA_TXCH I2S_DMA_TXCH
  224. #define ECSPI_TX_DMA_CH 5
  225. #define ECSPI_RX_DMA_CH 6
  226. /*******************************************/
  227. /************ usb configuration ************/
  228. #define USB_SUPPORT
  229. #define USB_MODE_ID -1
  230. //#define USB_DMA
  231. //#define USB_UVC_SUPPORT
  232. #define CONFIG_USB_DWC2_HOST 1
  233. #define CONFIG_USB_NEW_DWC2_HOST 1
  234. #define CONFIG_USB_DWC2_PERIPHERAL 1
  235. #define CONFIG_USB_NEW_DWC2_GADGET 1
  236. #if USB_MODE_ID && USB_MODE_ID != -1
  237. #define CONFIG_USB_DEVICE_CDC_NCM 1
  238. #endif
  239. /*******************************************/
  240. /************ carlink configuration ************/
  241. #ifdef CARLINK_ENABLE /* define in iar options */
  242. #define WIFI_SUPPORT
  243. #endif
  244. #ifdef WIFI_SUPPORT
  245. #define CARLINK_EY 0
  246. #define CARLINK_EC 1
  247. #define WIFI_RESET_IO 95
  248. #else
  249. #define CARLINK_EY 0
  250. #define CARLINK_EC 0
  251. #endif
  252. #if CARLINK_EY && CARLINK_EC
  253. #error "Do not choose two car links"
  254. #endif
  255. #if CARLINK_EC == 1
  256. #define USE_LWIP 1
  257. #else
  258. #define USE_LWIP 0
  259. #endif
  260. #define BT_RESET_IO 94
  261. #define BT_UART_PORT 1
  262. //#define RELTECK_WIFI_AP_MODE
  263. /*******************************************/
  264. /************ audio configuration ************/
  265. #define I2S_ID0 0
  266. #define I2S_ID1 1
  267. #define I2S_NUMS 2
  268. /* add your adc type */
  269. #define AUDIO_CODEC_ADC_NONE 0 //Not use codec adc ic or no need driver.
  270. #define AUDIO_CODEC_ADC_ES7243E 1 //Use codec adc ic es7243e.
  271. /* add your dac type */
  272. #define AUDIO_CODEC_DAC_NONE 0 //Not use codec adc ic or no need driver.
  273. #define AUDIO_CODEC_DAC_ES8156 1 //Use codec dac ic es8156.
  274. /* choose your audio use type */
  275. //#define AUDIO_REPLAY
  276. //#define AUDIO_RECORD
  277. #ifdef AUDIO_REPLAY
  278. #define AUDIO_REPLAY_I2S I2S_ID0 /* Select i2s id */
  279. #define AUDIO_CODEC_DAC_IC AUDIO_CODEC_DAC_NONE /* Select your codec dac type */
  280. #endif
  281. #ifdef AUDIO_RECORD
  282. #define AUDIO_RECORD_I2S I2S_ID1 /* Select i2s id */
  283. #define AUDIO_CODEC_ADC_IC AUDIO_CODEC_ADC_ES7243E /* Select your codec adc type */
  284. #endif
  285. #ifndef AUDIO_CODEC_DAC_IC
  286. #define AUDIO_CODEC_DAC_IC AUDIO_CODEC_DAC_NONE /* Do not use codec dac by default */
  287. #endif
  288. #ifndef AUDIO_CODEC_ADC_IC
  289. #define AUDIO_CODEC_ADC_IC AUDIO_CODEC_ADC_NONE /* Do not use codec adc by default */
  290. #endif
  291. #if (AUDIO_CODEC_DAC_IC == AUDIO_CODEC_DAC_ES8156)
  292. #define AUDIO_CODEC_DAC_NAME "ES8156"
  293. #else
  294. #define AUDIO_CODEC_DAC_NAME ""
  295. #endif
  296. #if (AUDIO_CODEC_ADC_IC == AUDIO_CODEC_ADC_ES7243E)
  297. #define AUDIO_CODEC_ADC_NAME "ES7243E"
  298. #else
  299. #define AUDIO_CODEC_ADC_NAME ""
  300. #endif
  301. /*******************************************/
  302. /********** mailbox configuration **********/
  303. #define MAILBOX_SUPPORT
  304. /*******************************************/
  305. /************ eth configuration ************/
  306. // #define ETH_SUPPORT
  307. #define ETH_TXC_PAD_DIR_OUTPUT 1 // 0:TXC作为输入 1:TXC作为输出
  308. #define PHY_JL3101_SEL 0
  309. #define PHY_JL3101_RST_IO 21
  310. #if PHY_JL3101_SEL
  311. #define ETH_AUTONEGOTIATION 0
  312. #define CLAUSE45_ENABLE 1
  313. #else
  314. #define ETH_AUTONEGOTIATION 1
  315. #define CLAUSE45_ENABLE 0
  316. #endif
  317. /*******************************************/
  318. /********** romfile configuration **********/
  319. /* 没有定义ROMFILE_USE_SMALL_MEM,romfile内容会全部加载到ddr
  320. * 内存不足时可以定义ROMFILE_USE_SMALL_MEM节省内存使用 */
  321. #define ROMFILE_USE_SMALL_MEM
  322. #ifndef ROMFILE_USE_SMALL_MEM
  323. /* 定义READ_ROMFILE_ONCE,romfile内容会整个一次加载到ddr,如果
  324. * 文件过大会导致启动时间慢 */
  325. //#define READ_ROMFILE_ONCE
  326. #else
  327. /* 缓存在DDR里的文件数,未缓存的文件需要重新从flash里读取 */
  328. #define ROMFILE_CACHE_DEF_SIZE 0
  329. #endif
  330. /*******************************************/
  331. /********** animation configuration **********/
  332. #define ANIMATION_NONE 0
  333. #define ANIMATION_USE_SMALL_MEM 1
  334. #define ANIMATION_NORMAL 2
  335. #define ANIMATION_POLICY ANIMATION_NORMAL
  336. /*********************************************/
  337. /************ flash type configuration ************/
  338. #define SPI_NOR_FLASH 0
  339. #define SPI_NAND_FLASH 1
  340. #define EMMC_FLASH 2
  341. #define DEVICE_TYPE_SELECT EMMC_FLASH //需要与MCU工程amt630hv160_conf.h中CPU_DEVICE_TYPE_SELECT对应
  342. #define MCU_DEVICE_TYPE_SELECT SPI_NOR_FLASH //需要与MCU工程amt630hv160_conf.h中DEVICE_TYPE_SELECT对应
  343. #if DEVICE_TYPE_SELECT == SPI_NOR_FLASH
  344. //#define SPI0_QSPI_MODE
  345. #elif DEVICE_TYPE_SELECT == SPI_NAND_FLASH
  346. #define SPI2_QSPI_MODE
  347. #define SPI_NOR_FLASH_SUPPORT
  348. #else
  349. #if DEVICE_TYPE_SELECT != MCU_DEVICE_TYPE_SELECT
  350. #undef DW_SPI0_SUPPORT
  351. #endif
  352. #define DEVICE_PARTITION_NAME "/emmc"
  353. #endif
  354. /*******************************************/
  355. /********** update mode configuration **********/
  356. #define OTA_UPDATE_SUPPORT
  357. #ifdef OTA_UPDATE_SUPPORT
  358. #define IMAGE_RESOURCES_BACKUP
  359. //#define DELTA_UPDATE_SUPPORT
  360. #define MAILBOX_UPDATE_SUPPORT
  361. //#define WIFI_UPDATE_SUPPORT
  362. #if defined(WIFI_UPDATE_SUPPORT) && !defined(USB_SUPPORT)
  363. #error "Error! Should define USB_SUPPORT to support wifi simu update"
  364. #endif
  365. //#define NCM_UPDATE_SUPPORT
  366. #if defined(NCM_UPDATE_SUPPORT) && !CONFIG_USB_DEVICE_CDC_NCM
  367. #error "Error! Should define CONFIG_USB_DEVICE_CDC_NCM=1 to support ncm update"
  368. #endif
  369. //#define NCM_LOG_SUPPORT
  370. #if defined(NCM_LOG_SUPPORT) && !CONFIG_USB_DEVICE_CDC_NCM
  371. #error "Error! Should define CONFIG_USB_DEVICE_CDC_NCM=1 to support ncm log"
  372. #endif
  373. #else
  374. #error "Error! Should define OTA_UPDATE_SUPPORT to support other update options"
  375. #endif
  376. /*********************************************/
  377. /********** update address configuration **********/
  378. #if DEVICE_TYPE_SELECT == SPI_NOR_FLASH
  379. #define MCU_RESERVE_SIZE 0x100000ul //1MB
  380. #define SYSINFO_MAX_SIZE 0x1000 //4KB
  381. #define LOADER_MAX_SIZE 0x8000 //32KB
  382. #define APPFILE_MAX_SIZE 0x200000 //2MB
  383. #define ANIMFILE_MAX_SIZE 0x500000 //5MB
  384. #define ROMFILE_MAX_SIZE 0x1000000 //16MB
  385. #define OTA_MEDIA_SIZE 0xa00000 //10MB
  386. /**********************************************************************************************************************************
  387. spi nor flash address space( 0 address start)-(resources AB backup)
  388. |-----1MB-----|---4KB---|---4KB---|--32KB--|--32KB--|---2MB---|---5MB---|---16MB---|---2MB---|---5MB---|---16MB---|---10MB---|---end
  389. |-------------|---------|---------|--------|--------|---------|---------|----------|---------|---------|----------|----------|
  390. |0 |0x100000 |0x101000 |0x102000|0x10A000|0x112000 |0x312000 | 0x812000 |0x1812000|0x1A12000|0x1F12000 |0x2F12000 |
  391. |MCU reserved | SYSINFO |SYSINFO B| AMTLDR |AMTLDR B| APP | ANIM | ROM | APP B | ANIM B | ROM B | OTA |
  392. |_____________|_________|_________|________|________|_________|_________|__________|_________|_________|__________|__________|
  393. spi nor flash address space( 0 address start)
  394. |-----1MB-----|---4KB---|---4KB---|--32KB--|--32KB--|---2MB---|---5MB---|---16MB---|---2MB---|---5MB---|---end
  395. |-------------|---------|---------|--------|--------|---------|---------|--------- |---------|---------|
  396. |0 |0x100000 |0x101000 |0x102000|0x10A000|0x112000 |0x312000 | 0x812000 |0x1812000|0x1A12000|
  397. |MCU reserved | SYSINFO |SYSINFO B| AMTLDR |AMTLDR B| APP | ANIM | ROM | APP B | OTA |
  398. |_____________|_________|_________|________|________|_________|_________|__________|_________|_________|
  399. ***********************************************************************************************************************************/
  400. #elif DEVICE_TYPE_SELECT == SPI_NAND_FLASH
  401. // 128MB configure.
  402. #define MCU_RESERVE_SIZE 0x1000000ul //16MB
  403. #define SYSINFO_MAX_SIZE 0x100000 //1MB
  404. #define LOADER_MAX_SIZE 0x100000 //1MB
  405. #ifdef IMAGE_RESOURCES_BACKUP
  406. #define APPFILE_MAX_SIZE 0x1000000 //16MB
  407. #define ANIMFILE_MAX_SIZE 0x600000 //6MB
  408. #define ROMFILE_MAX_SIZE 0x1000000 //16MB
  409. #define OTA_MEDIA_SIZE 0x1A00000 //26MB
  410. #define OTA_BADBLK_BACKUP_SIZE 0x600000 //6MB
  411. #else
  412. #define APPFILE_MAX_SIZE 0x1200000 //18MB
  413. #define ANIMFILE_MAX_SIZE 0x600000 //6MB
  414. #define ROMFILE_MAX_SIZE 0x1C00000 //28MB
  415. #define OTA_MEDIA_SIZE 0x1E00000 //30MB
  416. #define OTA_BADBLK_BACKUP_SIZE 0x800000 //8MB /* bad block backup + BBT(4 block) */
  417. #endif
  418. /***********************************************************************************************************************************
  419. spi nand address space( 0 address start)-(resources AB backup)
  420. |----16MB-----|----1MB----|----1MB----|----1MB----|----1MB----|---16MB---|---6MB----|---16MB---|---16MB---|---6MB----|---16MB----|--26MB----|----6MB----|end(0x8000000)
  421. |-------------|-----------|-----------|-----------|-----------|----------|----------|----------|----------|----------|-----------|----------|-----------|
  422. |0 | 0x1000000 | 0x1100000 | 0x1200000 | 0x1300000 |0x1400000 |0x2400000 |0x2A00000 |0x3A00000 |0x4A00000 | 0x5000000 |0x6000000 | 0x7A00000 |
  423. |MCU reserved | SYSINFO | SYSINFO B | AMTLDR | AMTLDR B | APP | ANIM | ROM | APP B | ANIM B | ROM B | OTA | BACKUP |
  424. |_____________|___________|___________|___________|___________|__________|__________|__________|__________|__________|___________|__________|___________|
  425. spi nand address space( 0 address start)
  426. |----16MB-----|----1MB----|----1MB----|----1MB----|----1MB----|---18MB---|---6MB----|---28MB---|---18MB---|---30MB---|---8MB----|end(0x8000000)
  427. |-------------|-----------|-----------|-----------|-----------|----------|----------|----------|----------|----------|----------|
  428. |0 | 0x1000000 | 0x1100000 | 0x1200000 | 0x1300000 |0x1400000 |0x2600000 |0x2C00000 |0x4800000 |0x5A00000 |0x7800000 |
  429. |MCU reserved | SYSINFO | SYSINFO B | AMTLDR | AMTLDR B | APP | ANIM | ROM | APP B | OTA | BACKUP |
  430. |_____________|___________|___________|___________|___________|__________|__________|__________|__________|__________|__________|
  431. *************************************************************************************************************************************/
  432. #elif DEVICE_TYPE_SELECT == EMMC_FLASH
  433. #define MCU_RESERVE_SIZE 0x1000000ul //16MB
  434. #define SYSINFO_MAX_SIZE 0x80000 //512KB
  435. #define LOADER_MAX_SIZE 0x80000 //512KB
  436. #define APPFILE_MAX_SIZE 0x1000000 //16MB
  437. #define ANIMFILE_MAX_SIZE 0x500000 //5MB
  438. #define ROMFILE_MAX_SIZE 0x8000000 //128MB
  439. #define OTA_MEDIA_SIZE 0x10000000 //256MB
  440. /***********************************************************************************************************************************
  441. emmc address space( 0 address start)-(resources AB backup)
  442. |----16MB-----|---512KB---|---512KB---|---512KB---|---512KB---|---16MB---|---5MB---|---128MB--|---16MB---|---5MB----|---128MB---|--256MB---|---end
  443. |-------------|-----------|-----------|-----------|-----------|----------|---------|----------|----------|----------|-----------|----------|
  444. |0 | 0x1000000 | 0x1080000 | 0x1100000 | 0x1180000 |0x1200000 |0x2200000|0x2700000 |0xA700000 |0xB700000 | 0xBC00000 |0x13C00000|
  445. |MCU reserved | SYSINFO | SYSINFO B | AMTLDR | AMTLDR B | APP | ANIM | ROM | APP B | ANIM B | ROM B | OTA |
  446. |_____________|___________|___________|___________|___________|__________|_________|__________|__________|__________|___________|__________|
  447. emmc address space( 0 address start)
  448. |----16MB-----|---512KB---|---512KB---|---512KB---|---512KB---|---16MB---|---5MB---|---128MB--|---16MB---|--256MB---|---end
  449. |-------------|-----------|-----------|-----------|-----------|----------|---------|----------|----------|----------|
  450. |0 | 0x1000000 | 0x1080000 | 0x1100000 | 0x1180000 |0x1200000 |0x2200000|0x2700000 |0xA700000 |0xB700000 |
  451. |MCU reserved | SYSINFO | SYSINFO B | AMTLDR | AMTLDR B | APP | ANIM | ROM | APP B | OTA |
  452. |_____________|___________|___________|___________|___________|__________|_________|__________|__________|__________|
  453. *************************************************************************************************************************************/
  454. #else
  455. #error "Invalid flash type."
  456. #endif
  457. #define SYSINFO_OFFSET MCU_RESERVE_SIZE
  458. #define SYSINFO_B_OFFSET (SYSINFO_OFFSET + SYSINFO_MAX_SIZE)
  459. #define LOADER_OFFSET (SYSINFO_B_OFFSET + SYSINFO_MAX_SIZE)
  460. #define LOADER_B_OFFSET (LOADER_OFFSET + LOADER_MAX_SIZE)
  461. #define APPFILE_OFFSET (LOADER_B_OFFSET + LOADER_MAX_SIZE)
  462. #define ANIMFILE_OFFSET (APPFILE_OFFSET + APPFILE_MAX_SIZE)
  463. #define ROMFILE_OFFSET (ANIMFILE_OFFSET + ANIMFILE_MAX_SIZE)
  464. #define APPFILE_B_OFFSET (ROMFILE_OFFSET + ROMFILE_MAX_SIZE)
  465. #ifdef IMAGE_RESOURCES_BACKUP
  466. #define ANIMFILE_B_OFFSET (APPFILE_B_OFFSET + APPFILE_MAX_SIZE)
  467. #define ROMFILE_B_OFFSET (ANIMFILE_B_OFFSET + ANIMFILE_MAX_SIZE)
  468. #define OTA_MEDIA_OFFSET (ROMFILE_B_OFFSET + ROMFILE_MAX_SIZE)
  469. #else
  470. #define ANIMFILE_B_OFFSET ANIMFILE_OFFSET
  471. #define ROMFILE_B_OFFSET ROMFILE_OFFSET
  472. #define OTA_MEDIA_OFFSET (APPFILE_B_OFFSET + APPFILE_MAX_SIZE)
  473. #endif
  474. #if DEVICE_TYPE_SELECT == SPI_NAND_FLASH
  475. #define OTA_BADBLK_BACKUP_OFFSET (OTA_MEDIA_OFFSET + OTA_MEDIA_SIZE)
  476. #endif
  477. /*********************************************/
  478. /************ DDR config configuration ************/
  479. #define DDR_BASE 0x60000000ul
  480. #define DDR_TOTAL_SIZE 0x8000000 //128MB
  481. #define DDR_DRV_USE_SIZE 0x800000 //8MB
  482. #define DDR_MCU_ACCESS_MODULE_SIZE 0x40000 //256KB
  483. #define DDR_CPU_ACCESS_MODULE_SIZE 0x40000 //256KB
  484. #define DDR_MEDIA_USE_SIZE 0x80000 //512KB
  485. #if DEVICE_TYPE_SELECT == SPI_NOR_FLASH
  486. #define DDR_CAN_UPDATE_SIZE 0x200000 //2MB
  487. #define DDR_RESERVED_SIZE 0x500000 //5MB
  488. #elif DEVICE_TYPE_SELECT == SPI_NAND_FLASH
  489. #define DDR_CAN_UPDATE_SIZE 0x400000 //4MB
  490. #define DDR_RESERVED_SIZE 0x300000 //3MB
  491. #elif DEVICE_TYPE_SELECT == EMMC_FLASH
  492. #define DDR_CAN_UPDATE_SIZE 0x400000 //4MB
  493. #define DDR_RESERVED_SIZE 0x300000 //3MB
  494. #endif
  495. #define DDR_DRV_USE_ADDR (DDR_BASE + DDR_TOTAL_SIZE - DDR_DRV_USE_SIZE)
  496. #define DDR_MCU_ACCESS_MODULE_ADDR (DDR_DRV_USE_ADDR)
  497. #define DDR_CPU_ACCESS_MODULE_ADDR (DDR_MCU_ACCESS_MODULE_ADDR + DDR_MCU_ACCESS_MODULE_SIZE)
  498. #define DDR_MEDIA_USE_ADDR (DDR_CPU_ACCESS_MODULE_ADDR + DDR_CPU_ACCESS_MODULE_SIZE)
  499. #define DDR_CAN_USE_ADDR (DDR_MEDIA_USE_ADDR + DDR_MEDIA_USE_SIZE)
  500. /*********************************************************************
  501. spi nor flash DDR address space
  502. |----120MB----|------256KB------|------256KB------|----512KB----|-----2MB-----|-----5MB-----|---end
  503. |-------------|-----------------|-----------------|-------------|-------------|-------------|
  504. |0x60000000 |0x67800000 |0x67840000 |0x67880000 |0x67900000 |0x67B00000 |
  505. |CPU USE |MCU Access module|CPU Access module|Media update |Can update |Reserved |
  506. |_____________|_________________|_________________|_____________|_____________|_____________|
  507. ***********************************************************************
  508. emmc DDR address space
  509. |----120MB----|------256KB------|------256KB------|----512KB----|-----4MB-----|-----3MB-----|---end
  510. |-------------|-----------------|-----------------|-------------|-------------|-------------|
  511. |0x60000000 |0x67800000 |0x67840000 |0x67880000 |0x67900000 |0x67D00000 |
  512. |CPU USE |MCU Access module|CPU Access module|Media update |Can update |Reserved |
  513. |_____________|_________________|_________________|_____________|_____________|_____________|
  514. **********************************************************************/
  515. /*********************************************/
  516. /********** ulog configuration **********/
  517. //#define USE_ULOG
  518. #define ULOG_NAME_MAX 8
  519. #define ULOG_LINE_BUF_SIZE 1024
  520. #define ULOG_OUTPUT_LEVEL
  521. #define ULOG_OUTPUT_TIME
  522. //#define ULOG_TIME_USING_TIMESTAMP
  523. //#define ULOG_OUTPUT_TAG
  524. //#define ULOG_USING_COLOR
  525. #define ULOG_USING_ISR_LOG
  526. #define ULOG_BACKEND_USING_CONSOLE
  527. //#define ULOG_EASYFLASH_BACKEND_ENABLE //Please set your EASYFLASH_START_ADDR.
  528. #ifdef ULOG_EASYFLASH_BACKEND_ENABLE
  529. #define EASYFLASH_LOG
  530. #if DEVICE_TYPE_SELECT == SPI_NOR_FLASH
  531. #define EASYFLASH_LOG_AREA_SIZE 0x100000
  532. #define EASYFLASH_ERASE_GRAN 0x1000
  533. #define EASYFLASH_WRITE_GRAN 0x100
  534. #define EASYFLASH_START_ADDR 0x1700000
  535. #elif DEVICE_TYPE_SELECT == SPI_NAND_FLASH
  536. #define EASYFLASH_LOG_AREA_SIZE 0x100000
  537. #define EASYFLASH_ERASE_GRAN 0x20000 //block size.
  538. #define EASYFLASH_WRITE_GRAN 0x800 //page size.
  539. #define EASYFLASH_START_ADDR 0x7800000
  540. #else
  541. #define EASYFLASH_LOG_AREA_SIZE 0x100000
  542. #define EASYFLASH_ERASE_GRAN 0x10000
  543. #define EASYFLASH_WRITE_GRAN 0x200
  544. #define EASYFLASH_START_ADDR 0x60000000
  545. #endif
  546. #endif
  547. //#define ULOG_FILE_BACKEND_ENABLE
  548. #ifdef ULOG_FILE_BACKEND_ENABLE
  549. #if DEVICE_TYPE_SELECT != EMMC_FLASH
  550. #define ULOG_FILE_ROOT_PATH "/sf/logs"
  551. #else
  552. #define ULOG_FILE_ROOT_PATH "/emmc/logs"
  553. #endif
  554. #define ULOG_FILE_NAME_BASE "ulog.log"
  555. #define ULOG_FILE_MAX_NUM 10
  556. #define ULOG_FILE_MAX_SIZE (1024 * 32)
  557. #endif
  558. //#define ULOG_USING_ASYNC_OUTPUT //ulog异步输出
  559. #define ULOG_ASYNC_OUTPUT_BUF_SIZE 32768 //32K
  560. #define ULOG_ASYNC_OUTPUT_THREAD_STACK 2048
  561. #define ULOG_ASYNC_OUTPUT_THREAD_PRIORITY 10
  562. /*********************************************/
  563. #endif