ic_drv_global.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /* i2c_drv_global.h
  2. *
  3. * Raydium TouchScreen driver.
  4. *
  5. * Copyright (c) 2021 Raydium tech Ltd.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #ifndef _DRVGLOBAL_H_
  19. #define _DRVGLOBAL_H_
  20. #include "../Config.h"
  21. #ifdef __KERNEL__
  22. #include <linux/types.h>
  23. #else
  24. #include <stdint.h>
  25. #endif
  26. #if (SELFTEST_2X)
  27. #include "f302_ic_control.h"
  28. #endif
  29. #if !SELFTEST
  30. #include "f302_ic_control.h"
  31. #include "f303_ic_control.h"
  32. #include "usb.h"
  33. #endif
  34. //********* Basic Parameter Definition ***********//
  35. /*****************************************************************************
  36. **
  37. ** Declared Global Variable
  38. **
  39. *****************************************************************************/
  40. #define MAX_IMAGE_BUFFER_SIZE 64
  41. #define MAX_SENSING_PIN_NUM 50 // (wearable)
  42. #define F302_MAX_IMAGE_BUFFER_SIZE 36
  43. #define DATA_BUFFER_SIZE (0x100)
  44. #define F302_DONGLE_FLASH_INI_ADDR 0xF000
  45. #define F302_INI_THRESHOLD_ADDR (F302_DONGLE_FLASH_INI_ADDR + 16)
  46. #define F302_INI_PARA_ADDR (F302_INI_THRESHOLD_ADDR + 36)
  47. #define F302_INI_RAW_DATA2_BL_ADDR (F302_INI_PARA_ADDR + 48)
  48. #define F302_INI_RAW_DATA_3_CC_ADDR (F302_INI_RAW_DATA2_BL_ADDR + 72)
  49. #define F302_INI_UC_CC_ADDR (F302_INI_RAW_DATA_3_CC_ADDR + 72) // INI_RAW_DATA2_ADDR
  50. #define F302_NA_P 36
  51. #define F303_DONGLE_FLASH_INI_ADDR 0x10000
  52. #define F303_INI_THRESHOLD_ADDR (F303_DONGLE_FLASH_INI_ADDR + 16)
  53. #define F303_INI_PARA_ADDR (F303_INI_THRESHOLD_ADDR + 36)
  54. #define F303_INI_RAW_DATA2_BL_ADDR (F303_INI_PARA_ADDR + 48)
  55. #define F303_INI_RAW_DATA_3_CC_ADDR (F303_INI_RAW_DATA2_BL_ADDR + 128)
  56. #define F303_INI_UC_CC_ADDR (F303_INI_RAW_DATA_3_CC_ADDR + 128) // INI_RAW_DATA2_ADDR
  57. #define F303_MAX_SENSING_PIN_NUM 48
  58. #define F303_NA_P 65
  59. #define F302_INITIAL_CODE_START_ADDR 0xF400
  60. #define F303_INITIAL_CODE_START_ADDR 0x10400
  61. #define PRINT_DEBUG_MSG_TYPE_1 0x01
  62. #define PRINT_DEBUG_MSG_TYPE_2 0x02
  63. #define PRINT_DEBUG_MSG_TYPE_3 0x04
  64. #define PRINT_DEBUG_MSG_TYPE_4 0x08
  65. #define PRINT_DEBUG_MSG_TYPE_5 0x10
  66. #define PRINT_DEBUG_MSG_TYPE_6 0x20
  67. #define PRINT_DEBUG_MSG_TYPE_7 0x40
  68. #define PRINT_DEBUG_MSG_TYPE_8 0x80
  69. #define FW_SYS_CMD_ADDR 0x20000288
  70. #define SYS_CMD_TP_MANUAL_MODE 0x34
  71. #define SYS_CMD_DO_BL_CAL 0x5A
  72. #define SYS_CMD_DO_CC_CAL 0x5C
  73. #define FW_TP_SEQ_NUM_ADDR 0x20000290
  74. #define FW_TP_POINT_DATA_ADDR 0x20000294
  75. #define REG_SYSCON_MISCIER_ADDR 0x40000014
  76. #define FW_FT_IMG_ADDR 0x2000019C
  77. #define RM_DATAMEM0_BASE 0x20000000
  78. #define F303_DRAM_FT_DBG_START 0x2000004C
  79. //======================= Basic Hardware Define ==============================
  80. //==================== End of Basic Hardware Define ==========================
  81. #if SELFTEST
  82. #ifdef __KERNEL__
  83. typedef enum {
  84. error = -1,
  85. success = 1
  86. } STATUS;
  87. #else
  88. typedef enum {
  89. ERROR = 0,
  90. SUCCESS = 1
  91. } STATUS;
  92. typedef enum {
  93. DISABLE = 0,
  94. ENABLE = 1
  95. } FunctionalState;
  96. typedef enum {
  97. false = 0,
  98. true = 1
  99. } bool;
  100. #endif
  101. #endif
  102. //========== Basic Parameter Information ==========
  103. //********************* Global *********************//
  104. // Global variable for dongle
  105. extern unsigned char g_u8_drv_interface;
  106. extern volatile unsigned char g_u8_gpio_irq_trigger;
  107. extern unsigned short g_u16_dev_id;
  108. extern unsigned char g_u8_raw_data_buffer[MAX_IMAGE_BUFFER_SIZE * 2];
  109. extern unsigned short g_u16_raw_data_tmp[MAX_IMAGE_BUFFER_SIZE];
  110. extern short g_i16_raw_data_1_short_buf[MAX_SENSING_PIN_NUM];
  111. extern short g_i16_raw_data_2_open_buf[MAX_SENSING_PIN_NUM];
  112. extern unsigned short g_u16_raw_data3_cc_buf[MAX_SENSING_PIN_NUM];
  113. extern unsigned short g_u16_uc_buf[MAX_SENSING_PIN_NUM];
  114. extern unsigned short g_u16_raw_data3_golden_cc_buf[MAX_SENSING_PIN_NUM];
  115. extern unsigned short g_u16_uc_golden_cc_buf[MAX_SENSING_PIN_NUM];
  116. extern unsigned int g_u32_test_result[MAX_SENSING_PIN_NUM]; // each node test result (open ng, short ng, uniformity ng..etc)
  117. extern unsigned char g_u8_wearable_pin_map[MAX_IMAGE_BUFFER_SIZE];
  118. extern unsigned char g_u8_test_result[MAX_SENSING_PIN_NUM];
  119. extern volatile unsigned short g_u16_test_items_host_cmd;
  120. extern unsigned short g_u16_test_items_tool_cmd;
  121. extern volatile unsigned short g_u16_panel_jig_set_test_items;
  122. extern unsigned int g_u32_wearable_test_result;
  123. extern unsigned char g_u8_channel_x;
  124. extern unsigned char g_u8_channel_y;
  125. extern unsigned char g_u8_is_normal_fw;
  126. extern unsigned char g_u8_data_buf[DATA_BUFFER_SIZE];
  127. extern unsigned char g_u8_mipi_read_buf[56];
  128. extern unsigned int g_u32_fw_cc_version;
  129. extern unsigned char g_u8_print_debug_msg;
  130. extern char g_i8_test_baseline_msg[30];
  131. extern bool b_is_auo_jig_testing;
  132. #if ENABLE_TEST_TIME_MEASURMENT || ENABLE_TEST_TIME_MEASURMENT_CC
  133. extern unsigned int g_u32_spend_time;
  134. #endif
  135. #if !SELFTEST
  136. extern unsigned char g_u8_ic_power_on_ng;
  137. #endif
  138. extern unsigned char g_u8_display_interface;
  139. extern unsigned char g_u8_PAGE_ADDR;
  140. extern int g_u32_dongle_flash_ini_addr;// 0xF000
  141. extern int g_u32_ini_threshold_addr;// DONGLE_FLASH_INI_ADDR + 16
  142. extern int g_u32_ini_para_addr;// INI_THRESHOLD_ADDR + 36
  143. //int u32_ini_raw_data_2_bl_addr;// INI_PARA_ADDR+48
  144. extern int g_u32_ini_raw_data_3_cc_addr;// INI_RAW_DATA2_BL_ADDR+72
  145. extern int g_u32_ini_uc_cc_addr;// INI_RAW_DATA_3_CC_ADDR + 72// INI_RAW_DATA2_ADDR
  146. extern int g_u32_initial_code_start_addr;
  147. extern void ic_drv_init(void);
  148. #endif /* end _DRVGLOBAL_H_*/
  149. /******************************************************************************
  150. ** End Of File
  151. ******************************************************************************/