1 /******************************************************************************
2 ** File Name: cmddef.h *
3 ** Author: Richard Yang *
5 ** Copyright: 2001 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This file includes some common message type defines for *
8 ******************************************************************************
10 ******************************************************************************
12 ** ------------------------------------------------------------------------- *
13 ** DATE NAME DESCRIPTION *
14 ** 20/09/2001 Richard.Yang Create. *
15 ** 25/12/2001 Lliu Add LOG_FILTER_F and log filter cmd set *
16 ** 01/06/2003 Eric.zhou Add Channel server CMD and Time update *
18 ** 16/09/2003 Xueliang.Wang Add a mode RESET_MODE to MCU_MODE_E *
19 ** 20/05/2004 Zhemin.Lin Add RPC cmd for digital camera(CR9397) *
20 ******************************************************************************/
23 #include "sci_types.h"
25 /**---------------------------------------------------------------------------*
27 **---------------------------------------------------------------------------*/
32 // This is the communication frame head
33 typedef struct msg_head_tag
35 uint32 seq_num; // Message sequence number, used for flow control
36 uint16 len; // The totoal size of the packet "sizeof(MSG_HEAD_T)
38 uint8 type; // Main command type
39 uint8 subtype; // Sub command type
42 #define CM_COPY_MSG_HEAD(msg, num, total_len, main_type, sub_type) \
43 ((MSG_HEAD_T *) msg)->seq_num = num; \
44 ((MSG_HEAD_T *) msg)->len = total_len;\
45 ((MSG_HEAD_T *) msg)->type = main_type;\
46 ((MSG_HEAD_T *) msg)->subtype = sub_type;
48 //Message Type define start
49 #define MSG_REQ_REP_START 0
50 #define DIAG_COMMAND_OFFSET 0
54 DIAG_SWVER_F = 0, // Information regarding MS software
56 DIAG_SOFTKEY_F = 1, // Soft key command
59 DIAG_GET_SYS_INFO_F = 4, // Get system information.
62 DIAG_CHIP_TEST_F = 6, // Direct chip test operation
63 DIAG_POWER_F = 7, // Power on/off MS
64 DIAG_SIM_F = 8, // Sim card command
68 DIAG_CHANGE_MODE_F = 12, // Set MCU mode: normal, test or calibration
70 DIAG_AT_CHLSRV_F = 14, // AT Command from channel server
72 DIAG_ADC_F = 15, // read ADC result
73 DIAG_PIN_TEST_F = 16, // for Auto pin-test
74 DIAG_CURRENT_TEST_F = 17,
75 DIAG_SIM_CARD_TEST_F = 18, // Test sim card
76 DIAG_AUDIO_TEST_F = 19, // test audio part
77 DIAG_KEYPAD_TEST_F = 20, // test keypad
78 DIAG_LCM_TEST_F = 21, // test lcd module
79 DIAG_VIBRATOR_TEST_F = 22, // test vibrator
83 DIAG_PRODUCTION_TEST_EXTEND_F = 25, // Product Test Extend Command.
84 DIAG_FORCE_ON_CELLS_F = 26,
86 DIAG_GET_MCU_MODE_F = 28, //query mcu mode
87 DIAG_CALIBRATION_NOISE_F = 29, // calibration noise check
88 DIAG_POWER_SUPPLY_F = 30,
90 DIAG_CALIBRATION = 32,
91 DIAG_CALIBRATION_BT_F = 33, // Bluetooth test
94 DIAG_TD_NV = 36, //DIAG_TD_NV=36, read/write the TD calibration parameter
95 DIAG_TV_PARAM = 37, // add for TV chip 08-03-07
96 DIAG_READ_ASSERT_F = 40, //read assert info from NV item.
98 DIAG_LAYER1_F = 50, // Read or write paramter by Layer1
99 DIAG_WIFI_TEST_F = 54, //wifi test
101 DIAG_SENSOR_REG_F = 90, // sensor register w/r tool
102 DIAG_FUN_CALL_F = 92,
104 DIAG_DIRECT_PHSCHK = 95,
105 DIAG_ENDIAN_CHECK_F = 97,
107 } diag_cmd_code_enum_type;
110 //yujun.ke add for layer1 to diag signals
113 L1_DIAG_RD_CALI_PARAM_CNF = DIAG<<8,
114 L1_DIAG_WR_CALI_PARAM_CNF
120 #define MSG_UNREG 100
121 #define MSG_REQ_REP_END 100
123 #define MSG_REQ_START 101
126 PS_REQ_F = 101, // Protocol stack request message.
127 ATC_CMD_R, // ATC command to ATC module
129 PPP_PACKET_R, // PPP packet request for ppp link!
131 } bs_env_cmd_enum_type;
132 #define MSG_REQ_END 150
134 #define MSG_ANONY_START 151
135 #define MSG_LINK_IND 0 // Added by Leo.Feng
136 // Notify ChannelServer Connect / Disconnect with MS
139 DIAG_LOG_A = 152, // log message
140 PS_L2_A, // L2 layer anonymous message.
141 // L1_IND_A, // L1 anonymous message.
143 DIAG_AT_A = 155, // AT Command message
145 DIAG_MOBILETV_DSP_LOG_F = 157,
146 DIAG_AUTOTEST_INFO_F = 158 // For Autotest INFORMATION
149 #define MSG_CONSOLE_A 159
150 #define DIAG_CONSOLE_MS 159
152 #define MSG_TOOLS_RESERVED 209
153 #define MSG_ANONY_END 210
154 #define MSG_TIME_OUT 211
155 #define MSG_BUF_FULL 212
156 #define MSG_SEND_OK 213
157 #define MSG_CRC_ERROR 214
158 #define MSG_LINK_ERROR 215
159 #define MSG_UNKNOWN_STRUCT 216
162 #define MSG_BOARD_ASSERT 255
165 // Normal assert information, subtype of ASSERT message.
171 // Dump sme buff memory end
172 DUMP_SME_BUFF_MEM_END
173 } ASSERT_DATA_TYPE_E;
176 /* Log filter command sets */
187 } log_cmd_set_enum_type;
189 /* PS related command sets */
194 } PS_CMD_SET_ENUM_TYPE;
201 DIAG_MEM_ALLOC_INFO_F,
203 } system_info_cmd_set_enum_type;
207 DIAG_NORMAL_KEY_MSG_INFO_F, // both send key down and up msg
208 DIAG_KEY_MSG_DOWN_INFO_F, // only send key down msg
209 DIAG_KEY_MSG_UP_INFO_F // only send key up msg
210 } softkey_cmd_set_enum_type;
212 /* BATTERY related command type sets*/
218 /* AT Like Command ERROR type sets */
219 #define ATCMD_ERROR_TYPE_BASE 0
222 ATCMD_SUCCESS = ATCMD_ERROR_TYPE_BASE,
230 } ATCMD_ERROR_TYPE_E;
240 } DIRECT_CHIP_TEST_TYPE_E;
246 NVITEM_PRODUCT_CTRL_READ,
247 NVITEM_PRODUCT_CTRL_WRITE,
248 NVITEM_PRODUCT_CTRL_ERASE,
249 NVITEM_GETLENGTH, /*5*/
253 #define MAX_WRITE_SIZE 100
263 int buffer[MAX_WRITE_SIZE];
265 /* Message type define end*/
276 LAYER1_TEST_MODE = 1,
277 ASSERT_BACK_MODE = 2,
278 CALIBRATION_MODE = 3,
279 DSP_CODE_DOWNLOAD_BACK = 4,
280 DSP_CODE_DOWNLOAD_BACK_CALIBRATION = 5,
284 CALIBRATION_POST_MODE = 9,
287 WATCHDOG_RESET_MODE = 12,
289 CALIBRATION_NV_ACCESS_MODE = 13,
290 CALIBRATION_POST_NO_LCM_MODE = 14,
292 TD_CALIBRATION_POST_MODE = 15,
293 TD_CALIBRATION_MODE = 16,
294 TD_CALIBRATION_POST_NO_LCM_MODE = 17,
304 *indicate that current is usb mcft mode
305 *maybe used only when changmode by pc tools
307 #define MCU_MODE_USB 0x80
325 ADC_0_HIGH_VOLTAGE = 0x81,
326 ADC_1_HIGH_VOLTAGE = 0x82,
327 ADC_2_HIGH_VOLTAGE = 0x83,
328 ADC_3_HIGH_VOLTAGE = 0x84,
329 ADC_4_HIGH_VOLTAGE = 0x85,
330 ADC_5_HIGH_VOLTAGE = 0x86,
331 ADC_6_HIGH_VOLTAGE = 0x87
334 // @lin.liu (2003-08-25), CR: ms4267
338 uint16 result; // the result that sent back to PC
341 #define MAX_TEST_PIN_NUM 292
343 //#define PIN_STATE_UNDEFINED 0x0
344 //#define PIN_STATE_PASS 0x1
345 //#define PIN_STATE_FAIED 0x2
346 //#define PIN_STATE_NOT_CHECKED 0x3
348 // We use 2bits for one pin.
349 // state[n][1:0] : state of pin 4*n + 0
350 // state[n][3:2] : state of pin 4*n + 1
351 // state[n][5:4] : state of pin 4*n + 2
352 // state[n][7:6] : state of pin 4*n + 3
357 uint16 pin_num; // the pin number of the module.( include PASS, FAILED, NOT_CHECKED )
358 uint8 pin_state[ (MAX_TEST_PIN_NUM) / 4 + 2]; // pin state.
364 MSG_HEAD_T msg_head; // type is DIAG_CALIBRATION_NOISE_F
368 uint32 EAR_noise_count;
369 uint32 speaker_noise_count;
372 uint32 check_time; // the time to check the noise count( ms )
376 }MSG_CALIBRATION_NOISE_T;
380 CURRENT_TEST_STOP = 0,
381 CURRENT_TEST_RF_CLOSED = 1,
382 CURRENT_TEST_DEEP_SLEEP = 2,
383 CURRENT_TEST_LED_ON = 3,
384 CURRENT_TEST_VIBRATOR_ON = 4,
385 CURRENT_TEST_RX_MIN_PEAK_VALUE = 5,
386 CURRENT_TEST_TX_MAX_PEAK_VALUE = 6,
387 CURRENT_TEST_CHARGING = 7,
388 CURRENT_TEST_LED_OFF = 8,
389 CURRENT_TEST_VIBRATOR_OFF = 9,
390 CURRENT_TEST_DEEP_GET_SLEEP_FLAG = 0xA,
391 CURRENT_TEST_DEEP_SLEEP_FLAG_ENABLE = 0xB,
392 CURRENT_TEST_DEEP_SLEEP_FLAG_DISABLE= 0xC,
393 CURRENT_TEST_DEEP_SLEEP_WAKEUP = 0xF // Be careful that the higer 8 bit is used for parameter of how long it sleeps
412 REG_READ_SUCCESS, // successful
413 REG_READ_ADDR_ERR, // address cann't access
414 REG_READ_OTHER_ERR // other error
419 REG_WRITE_SUCCESS, // successful
420 REG_WRITE_ADDR_ERR, // address cann't access
421 REG_WRITE_VALUE_ERR, // value error
422 REG_WRITE_OTHER_ERR // other error
423 } WRITE_RESULT_MODE_E;
427 uint32 mode; // MODE_ENUM
428 uint32 addr; // register address
429 uint32 value; // register value
430 }MSG_REG_T, *MSG_REG_PTR;
436 }MSG_FUNC_CALL_T, *MSG_FUNC_CALL_PTR;
438 #define MAX_FAILED_PIN_NUM 64
443 uint8 failed_pin[ MAX_FAILED_PIN_NUM + 4]; // +4 for overwrite check
449 //@lin.liu(2004-05-09). CR8889
450 //#define the subtype of type(DIAG_RPC_EFS_R).
476 //@Zhemin.Lin(2004-05-20), CR9397
481 RPC_DC_SETBYPASSMODE,
482 RPC_DC_SETPOWERSAVEMODE,
483 RPC_DC_SETPREVIEWWINSIZE,
484 RPC_DC_MOVEPREVIEWIN,
492 RPC_DC_SETSWIVELMODE,
493 RPC_DC_SETOVERLAYMODE,
497 RPC_DC_SETLIGHTSOURCE,
498 RPC_DC_SETLIGHTINTENSITY,
500 RPC_DC_ENABLEANTIBANDING,
503 RPC_DC_ADJUSTCONTRAST,
542 // The subtype of DIAG_FORCE_ON_CELLS_F Command
547 CANCEL_FORCE_ON_CELLS = 1
548 }FORCE_ON_CELLS_TYPE_E;
551 #define FORCE_ON_CELLS_NUM_MAX 6
557 // The param is valid when the subtype is FORCE_ON_CELLS
558 uint16 cell_number_and_status;
559 uint16 cell_list[ FORCE_ON_CELLS_NUM_MAX ];
561 }MSG_FORCE_ON_CELLS_T;
571 typedef enum _TOOL_TV_MSG_ID_E
573 TOOL_TV_SET_FREQ = 0, // ÉèÖÃƵµã
574 TOOL_TV_GET_DEMODULATION, // »ñµÃ½âµ÷ÎļþÐÅÏ¢
575 TOOL_TV_GET_FREQERROR, // »ñµÃƵÂÊÆ«²î
576 TOOL_TV_GET_RSSI, // »ñµÃRSSI´óС
577 TOOL_TV_GET_BLOCKERROR, // »ñµÃ½ÓÊÕµ½µÄ×Ü¿éÊý£¬³ö´íµÄ×Ü¿éÊý
578 TOOL_TV_SET_REGISTER, // дÈë¼Ä´æÆ÷Öµ
579 TOOL_TV_GET_REGISTER, // ¶ÁÈ¡¼Ä´æÆ÷Öµ
580 TOOL_TV_GET_PLL, // ¶ÁÈ¡PLLµÄËø¶¨ÐÅÏ¢
581 TOOL_TV_RESET_MODE, // ÉèÖÃSC6600Vģʽ
582 TOOL_TV_GET_MODE, // ²éѯµ±Ç°SC6600VµÄģʽ
583 TOOL_TV_BB_SHOW_PICTURE, // ¿ØÖÆLCD
584 TOOL_TV_START_RAM_ROM_TEST, // ²âÊÔRAM/ROM
585 TOOL_TV_DISPLAY_PICTURE, // ÏÔʾͼƬ
586 TOOL_TV_PERIPHERAL_TEST, // Peripheral²âÊÔ
587 TOOL_TV_START_AV_DECODE_TEST, // ·¢ÆðAudio Vedio Decode²âÊÔ
588 TOOL_TV_GET_AV_DECODE_TEST_STATE, // ²éѯ²âÊÔ״̬,È·ÈÏÊÇ·ñ²âÊÔÍê³É
589 TOOL_TV_GET_AV_DECODE_TEST_RESULT, // Audio Vedio Decode²âÊÔ½á¹û
590 TOOL_TV_START_CMMB_DEMOD, // ·¢ÆðCMMB Demod²âÊÔ
591 TOOL_TV_START_DATA_DISPLAY, // ¿ªÊ¼Êý¾Ý»Ø·Å
592 TOOL_TV_LCD_DISPLAY, // LCDÏÔʾ¿ØÖÆ
593 TOOL_TV_READ_NV, // ¶ÁNV²ÎÊý
594 TOOL_TV_WRITE_NV, // дNV²ÎÊý
595 TOOL_TV_GET_SERVICE_INFO, // »ñȡƵµã¼°ÆµµÀÐÅÏ¢
596 TOOL_TV_PLAY_BY_PARAM, // ¸ù¾Ý¸ø¶¨Æµµã¼°ÆµµÀÐÅÏ¢½øÐв¥·Å
597 TOOL_TV_SEARCH_NETWORK, // ËÑË÷ƵµÀ
598 TOOL_TV_SMD_CHECK, // SMD¼ì²â
600 TOOL_TV_CLOSE_WAITING_WIN, // ¹Ø±ÕµÈ´ý´°¿Ú(·Ç¹¤¾ßÃüÁî)
601 TOOL_TV_CMD_INVALID // ÎÞЧÃüÁî
603 /**---------------------------------------------------------------------------*
605 **---------------------------------------------------------------------------*/
609 #endif /*End cmddef.h*/