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"
24 //#include "tasks_id.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;
114 #define MSG_UNREG 100
115 #define MSG_REQ_REP_END 100
117 #define MSG_REQ_START 101
120 PS_REQ_F = 101, // Protocol stack request message.
121 ATC_CMD_R, // ATC command to ATC module
123 PPP_PACKET_R, // PPP packet request for ppp link!
125 } bs_env_cmd_enum_type;
126 #define MSG_REQ_END 150
128 #define MSG_ANONY_START 151
129 #define MSG_LINK_IND 0 // Added by Leo.Feng
130 // Notify ChannelServer Connect / Disconnect with MS
133 DIAG_LOG_A = 152, // log message
134 PS_L2_A, // L2 layer anonymous message.
135 // L1_IND_A, // L1 anonymous message.
137 DIAG_AT_A = 155, // AT Command message
139 DIAG_MOBILETV_DSP_LOG_F = 157,
140 DIAG_AUTOTEST_INFO_F = 158 // For Autotest INFORMATION
143 #define MSG_CONSOLE_A 159
144 #define DIAG_CONSOLE_MS 159
146 #define MSG_TOOLS_RESERVED 209
147 #define MSG_ANONY_END 210
148 #define MSG_TIME_OUT 211
149 #define MSG_BUF_FULL 212
150 #define MSG_SEND_OK 213
151 #define MSG_CRC_ERROR 214
152 #define MSG_LINK_ERROR 215
153 #define MSG_UNKNOWN_STRUCT 216
156 #define MSG_BOARD_ASSERT 255
159 // Normal assert information, subtype of ASSERT message.
165 // Dump sme buff memory end
166 DUMP_SME_BUFF_MEM_END
167 } ASSERT_DATA_TYPE_E;
170 /* Log filter command sets */
181 } log_cmd_set_enum_type;
183 /* PS related command sets */
188 } PS_CMD_SET_ENUM_TYPE;
195 DIAG_MEM_ALLOC_INFO_F,
197 } system_info_cmd_set_enum_type;
201 DIAG_NORMAL_KEY_MSG_INFO_F, // both send key down and up msg
202 DIAG_KEY_MSG_DOWN_INFO_F, // only send key down msg
203 DIAG_KEY_MSG_UP_INFO_F // only send key up msg
204 } softkey_cmd_set_enum_type;
206 /* BATTERY related command type sets*/
212 /* AT Like Command ERROR type sets */
213 #define ATCMD_ERROR_TYPE_BASE 0
216 ATCMD_SUCCESS = ATCMD_ERROR_TYPE_BASE,
224 } ATCMD_ERROR_TYPE_E;
234 } DIRECT_CHIP_TEST_TYPE_E;
240 NVITEM_PRODUCT_CTRL_READ,
241 NVITEM_PRODUCT_CTRL_WRITE,
242 NVITEM_PRODUCT_CTRL_ERASE,
243 NVITEM_GETLENGTH, /*5*/
247 #define MAX_WRITE_SIZE 100
257 int buffer[MAX_WRITE_SIZE];
259 /* Message type define end*/
270 LAYER1_TEST_MODE = 1,
271 ASSERT_BACK_MODE = 2,
272 CALIBRATION_MODE = 3,
273 DSP_CODE_DOWNLOAD_BACK = 4,
274 DSP_CODE_DOWNLOAD_BACK_CALIBRATION = 5,
278 CALIBRATION_POST_MODE = 9,
281 WATCHDOG_RESET_MODE = 12,
283 CALIBRATION_NV_ACCESS_MODE = 13,
284 CALIBRATION_POST_NO_LCM_MODE = 14,
286 TD_CALIBRATION_POST_MODE = 15,
287 TD_CALIBRATION_MODE = 16,
288 TD_CALIBRATION_POST_NO_LCM_MODE = 17,
298 *indicate that current is usb mcft mode
299 *maybe used only when changmode by pc tools
301 #define MCU_MODE_USB 0x80
319 ADC_0_HIGH_VOLTAGE = 0x81,
320 ADC_1_HIGH_VOLTAGE = 0x82,
321 ADC_2_HIGH_VOLTAGE = 0x83,
322 ADC_3_HIGH_VOLTAGE = 0x84,
323 ADC_4_HIGH_VOLTAGE = 0x85,
324 ADC_5_HIGH_VOLTAGE = 0x86,
325 ADC_6_HIGH_VOLTAGE = 0x87
328 // @lin.liu (2003-08-25), CR: ms4267
332 uint16 result; // the result that sent back to PC
335 #define MAX_TEST_PIN_NUM 292
337 //#define PIN_STATE_UNDEFINED 0x0
338 //#define PIN_STATE_PASS 0x1
339 //#define PIN_STATE_FAIED 0x2
340 //#define PIN_STATE_NOT_CHECKED 0x3
342 // We use 2bits for one pin.
343 // state[n][1:0] : state of pin 4*n + 0
344 // state[n][3:2] : state of pin 4*n + 1
345 // state[n][5:4] : state of pin 4*n + 2
346 // state[n][7:6] : state of pin 4*n + 3
351 uint16 pin_num; // the pin number of the module.( include PASS, FAILED, NOT_CHECKED )
352 uint8 pin_state[ (MAX_TEST_PIN_NUM) / 4 + 2]; // pin state.
358 MSG_HEAD_T msg_head; // type is DIAG_CALIBRATION_NOISE_F
362 uint32 EAR_noise_count;
363 uint32 speaker_noise_count;
366 uint32 check_time; // the time to check the noise count( ms )
370 }MSG_CALIBRATION_NOISE_T;
374 CURRENT_TEST_STOP = 0,
375 CURRENT_TEST_RF_CLOSED = 1,
376 CURRENT_TEST_DEEP_SLEEP = 2,
377 CURRENT_TEST_LED_ON = 3,
378 CURRENT_TEST_VIBRATOR_ON = 4,
379 CURRENT_TEST_RX_MIN_PEAK_VALUE = 5,
380 CURRENT_TEST_TX_MAX_PEAK_VALUE = 6,
381 CURRENT_TEST_CHARGING = 7,
382 CURRENT_TEST_LED_OFF = 8,
383 CURRENT_TEST_VIBRATOR_OFF = 9,
384 CURRENT_TEST_DEEP_GET_SLEEP_FLAG = 0xA,
385 CURRENT_TEST_DEEP_SLEEP_FLAG_ENABLE = 0xB,
386 CURRENT_TEST_DEEP_SLEEP_FLAG_DISABLE= 0xC,
387 CURRENT_TEST_DEEP_SLEEP_WAKEUP = 0xF // Be careful that the higer 8 bit is used for parameter of how long it sleeps
406 REG_READ_SUCCESS, // successful
407 REG_READ_ADDR_ERR, // address cann't access
408 REG_READ_OTHER_ERR // other error
413 REG_WRITE_SUCCESS, // successful
414 REG_WRITE_ADDR_ERR, // address cann't access
415 REG_WRITE_VALUE_ERR, // value error
416 REG_WRITE_OTHER_ERR // other error
417 } WRITE_RESULT_MODE_E;
421 uint32 mode; // MODE_ENUM
422 uint32 addr; // register address
423 uint32 value; // register value
424 }MSG_REG_T, *MSG_REG_PTR;
430 }MSG_FUNC_CALL_T, *MSG_FUNC_CALL_PTR;
432 #define MAX_FAILED_PIN_NUM 64
437 uint8 failed_pin[ MAX_FAILED_PIN_NUM + 4]; // +4 for overwrite check
443 //@lin.liu(2004-05-09). CR8889
444 //#define the subtype of type(DIAG_RPC_EFS_R).
470 //@Zhemin.Lin(2004-05-20), CR9397
475 RPC_DC_SETBYPASSMODE,
476 RPC_DC_SETPOWERSAVEMODE,
477 RPC_DC_SETPREVIEWWINSIZE,
478 RPC_DC_MOVEPREVIEWIN,
486 RPC_DC_SETSWIVELMODE,
487 RPC_DC_SETOVERLAYMODE,
491 RPC_DC_SETLIGHTSOURCE,
492 RPC_DC_SETLIGHTINTENSITY,
494 RPC_DC_ENABLEANTIBANDING,
497 RPC_DC_ADJUSTCONTRAST,
536 // The subtype of DIAG_FORCE_ON_CELLS_F Command
541 CANCEL_FORCE_ON_CELLS = 1
542 }FORCE_ON_CELLS_TYPE_E;
545 #define FORCE_ON_CELLS_NUM_MAX 6
551 // The param is valid when the subtype is FORCE_ON_CELLS
552 uint16 cell_number_and_status;
553 uint16 cell_list[ FORCE_ON_CELLS_NUM_MAX ];
555 }MSG_FORCE_ON_CELLS_T;
565 typedef enum _TOOL_TV_MSG_ID_E
567 TOOL_TV_SET_FREQ = 0, // ÉèÖÃƵµã
568 TOOL_TV_GET_DEMODULATION, // »ñµÃ½âµ÷ÎļþÐÅÏ¢
569 TOOL_TV_GET_FREQERROR, // »ñµÃƵÂÊÆ«²î
570 TOOL_TV_GET_RSSI, // »ñµÃRSSI´óС
571 TOOL_TV_GET_BLOCKERROR, // »ñµÃ½ÓÊÕµ½µÄ×Ü¿éÊý£¬³ö´íµÄ×Ü¿éÊý
572 TOOL_TV_SET_REGISTER, // дÈë¼Ä´æÆ÷Öµ
573 TOOL_TV_GET_REGISTER, // ¶ÁÈ¡¼Ä´æÆ÷Öµ
574 TOOL_TV_GET_PLL, // ¶ÁÈ¡PLLµÄËø¶¨ÐÅÏ¢
575 TOOL_TV_RESET_MODE, // ÉèÖÃSC6600Vģʽ
576 TOOL_TV_GET_MODE, // ²éѯµ±Ç°SC6600VµÄģʽ
577 TOOL_TV_BB_SHOW_PICTURE, // ¿ØÖÆLCD
578 TOOL_TV_START_RAM_ROM_TEST, // ²âÊÔRAM/ROM
579 TOOL_TV_DISPLAY_PICTURE, // ÏÔʾͼƬ
580 TOOL_TV_PERIPHERAL_TEST, // Peripheral²âÊÔ
581 TOOL_TV_START_AV_DECODE_TEST, // ·¢ÆðAudio Vedio Decode²âÊÔ
582 TOOL_TV_GET_AV_DECODE_TEST_STATE, // ²éѯ²âÊÔ״̬,È·ÈÏÊÇ·ñ²âÊÔÍê³É
583 TOOL_TV_GET_AV_DECODE_TEST_RESULT, // Audio Vedio Decode²âÊÔ½á¹û
584 TOOL_TV_START_CMMB_DEMOD, // ·¢ÆðCMMB Demod²âÊÔ
585 TOOL_TV_START_DATA_DISPLAY, // ¿ªÊ¼Êý¾Ý»Ø·Å
586 TOOL_TV_LCD_DISPLAY, // LCDÏÔʾ¿ØÖÆ
587 TOOL_TV_READ_NV, // ¶ÁNV²ÎÊý
588 TOOL_TV_WRITE_NV, // дNV²ÎÊý
589 TOOL_TV_GET_SERVICE_INFO, // »ñȡƵµã¼°ÆµµÀÐÅÏ¢
590 TOOL_TV_PLAY_BY_PARAM, // ¸ù¾Ý¸ø¶¨Æµµã¼°ÆµµÀÐÅÏ¢½øÐв¥·Å
591 TOOL_TV_SEARCH_NETWORK, // ËÑË÷ƵµÀ
592 TOOL_TV_SMD_CHECK, // SMD¼ì²â
594 TOOL_TV_CLOSE_WAITING_WIN, // ¹Ø±ÕµÈ´ý´°¿Ú(·Ç¹¤¾ßÃüÁî)
595 TOOL_TV_CMD_INVALID // ÎÞЧÃüÁî
597 /**---------------------------------------------------------------------------*
599 **---------------------------------------------------------------------------*/
603 #endif /*End cmddef.h*/