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,
108 } diag_cmd_code_enum_type;
111 //yujun.ke add for layer1 to diag signals
114 L1_DIAG_RD_CALI_PARAM_CNF = DIAG<<8,
115 L1_DIAG_WR_CALI_PARAM_CNF
121 #define MSG_UNREG 100
122 #define MSG_REQ_REP_END 100
124 #define MSG_REQ_START 101
127 PS_REQ_F = 101, // Protocol stack request message.
128 ATC_CMD_R, // ATC command to ATC module
130 PPP_PACKET_R, // PPP packet request for ppp link!
132 } bs_env_cmd_enum_type;
133 #define MSG_REQ_END 150
135 #define MSG_ANONY_START 151
136 #define MSG_LINK_IND 0 // Added by Leo.Feng
137 // Notify ChannelServer Connect / Disconnect with MS
140 DIAG_LOG_A = 152, // log message
141 PS_L2_A, // L2 layer anonymous message.
142 // L1_IND_A, // L1 anonymous message.
144 DIAG_AT_A = 155, // AT Command message
146 DIAG_MOBILETV_DSP_LOG_F = 157,
147 DIAG_AUTOTEST_INFO_F = 158 // For Autotest INFORMATION
150 #define MSG_CONSOLE_A 159
151 #define DIAG_CONSOLE_MS 159
153 #define MSG_TOOLS_RESERVED 209
154 #define MSG_ANONY_END 210
155 #define MSG_TIME_OUT 211
156 #define MSG_BUF_FULL 212
157 #define MSG_SEND_OK 213
158 #define MSG_CRC_ERROR 214
159 #define MSG_LINK_ERROR 215
160 #define MSG_UNKNOWN_STRUCT 216
163 #define MSG_BOARD_ASSERT 255
166 // Normal assert information, subtype of ASSERT message.
172 // Dump sme buff memory end
173 DUMP_SME_BUFF_MEM_END
174 } ASSERT_DATA_TYPE_E;
177 /* Log filter command sets */
188 } log_cmd_set_enum_type;
190 /* PS related command sets */
195 } PS_CMD_SET_ENUM_TYPE;
202 DIAG_MEM_ALLOC_INFO_F,
204 } system_info_cmd_set_enum_type;
208 DIAG_NORMAL_KEY_MSG_INFO_F, // both send key down and up msg
209 DIAG_KEY_MSG_DOWN_INFO_F, // only send key down msg
210 DIAG_KEY_MSG_UP_INFO_F // only send key up msg
211 } softkey_cmd_set_enum_type;
213 /* BATTERY related command type sets*/
219 /* AT Like Command ERROR type sets */
220 #define ATCMD_ERROR_TYPE_BASE 0
223 ATCMD_SUCCESS = ATCMD_ERROR_TYPE_BASE,
231 } ATCMD_ERROR_TYPE_E;
241 } DIRECT_CHIP_TEST_TYPE_E;
247 NVITEM_PRODUCT_CTRL_READ,
248 NVITEM_PRODUCT_CTRL_WRITE,
249 NVITEM_PRODUCT_CTRL_ERASE,
250 NVITEM_GETLENGTH, /*5*/
254 #define MAX_WRITE_SIZE 100
264 int buffer[MAX_WRITE_SIZE];
266 /* Message type define end*/
277 LAYER1_TEST_MODE = 1,
278 ASSERT_BACK_MODE = 2,
279 CALIBRATION_MODE = 3,
280 DSP_CODE_DOWNLOAD_BACK = 4,
281 DSP_CODE_DOWNLOAD_BACK_CALIBRATION = 5,
285 CALIBRATION_POST_MODE = 9,
288 WATCHDOG_RESET_MODE = 12,
290 CALIBRATION_NV_ACCESS_MODE = 13,
291 CALIBRATION_POST_NO_LCM_MODE = 14,
293 TD_CALIBRATION_POST_MODE = 15,
294 TD_CALIBRATION_MODE = 16,
295 TD_CALIBRATION_POST_NO_LCM_MODE = 17,
305 *indicate that current is usb mcft mode
306 *maybe used only when changmode by pc tools
308 #define MCU_MODE_USB 0x80
326 ADC_0_HIGH_VOLTAGE = 0x81,
327 ADC_1_HIGH_VOLTAGE = 0x82,
328 ADC_2_HIGH_VOLTAGE = 0x83,
329 ADC_3_HIGH_VOLTAGE = 0x84,
330 ADC_4_HIGH_VOLTAGE = 0x85,
331 ADC_5_HIGH_VOLTAGE = 0x86,
332 ADC_6_HIGH_VOLTAGE = 0x87
335 // @lin.liu (2003-08-25), CR: ms4267
339 uint16 result; // the result that sent back to PC
342 #define MAX_TEST_PIN_NUM 292
344 //#define PIN_STATE_UNDEFINED 0x0
345 //#define PIN_STATE_PASS 0x1
346 //#define PIN_STATE_FAIED 0x2
347 //#define PIN_STATE_NOT_CHECKED 0x3
349 // We use 2bits for one pin.
350 // state[n][1:0] : state of pin 4*n + 0
351 // state[n][3:2] : state of pin 4*n + 1
352 // state[n][5:4] : state of pin 4*n + 2
353 // state[n][7:6] : state of pin 4*n + 3
358 uint16 pin_num; // the pin number of the module.( include PASS, FAILED, NOT_CHECKED )
359 uint8 pin_state[ (MAX_TEST_PIN_NUM) / 4 + 2]; // pin state.
365 MSG_HEAD_T msg_head; // type is DIAG_CALIBRATION_NOISE_F
369 uint32 EAR_noise_count;
370 uint32 speaker_noise_count;
373 uint32 check_time; // the time to check the noise count( ms )
377 }MSG_CALIBRATION_NOISE_T;
381 CURRENT_TEST_STOP = 0,
382 CURRENT_TEST_RF_CLOSED = 1,
383 CURRENT_TEST_DEEP_SLEEP = 2,
384 CURRENT_TEST_LED_ON = 3,
385 CURRENT_TEST_VIBRATOR_ON = 4,
386 CURRENT_TEST_RX_MIN_PEAK_VALUE = 5,
387 CURRENT_TEST_TX_MAX_PEAK_VALUE = 6,
388 CURRENT_TEST_CHARGING = 7,
389 CURRENT_TEST_LED_OFF = 8,
390 CURRENT_TEST_VIBRATOR_OFF = 9,
391 CURRENT_TEST_DEEP_GET_SLEEP_FLAG = 0xA,
392 CURRENT_TEST_DEEP_SLEEP_FLAG_ENABLE = 0xB,
393 CURRENT_TEST_DEEP_SLEEP_FLAG_DISABLE= 0xC,
394 CURRENT_TEST_DEEP_SLEEP_WAKEUP = 0xF // Be careful that the higer 8 bit is used for parameter of how long it sleeps
413 REG_READ_SUCCESS, // successful
414 REG_READ_ADDR_ERR, // address cann't access
415 REG_READ_OTHER_ERR // other error
420 REG_WRITE_SUCCESS, // successful
421 REG_WRITE_ADDR_ERR, // address cann't access
422 REG_WRITE_VALUE_ERR, // value error
423 REG_WRITE_OTHER_ERR // other error
424 } WRITE_RESULT_MODE_E;
428 uint32 mode; // MODE_ENUM
429 uint32 addr; // register address
430 uint32 value; // register value
431 }MSG_REG_T, *MSG_REG_PTR;
437 }MSG_FUNC_CALL_T, *MSG_FUNC_CALL_PTR;
439 #define MAX_FAILED_PIN_NUM 64
444 uint8 failed_pin[ MAX_FAILED_PIN_NUM + 4]; // +4 for overwrite check
450 //@lin.liu(2004-05-09). CR8889
451 //#define the subtype of type(DIAG_RPC_EFS_R).
477 //@Zhemin.Lin(2004-05-20), CR9397
482 RPC_DC_SETBYPASSMODE,
483 RPC_DC_SETPOWERSAVEMODE,
484 RPC_DC_SETPREVIEWWINSIZE,
485 RPC_DC_MOVEPREVIEWIN,
493 RPC_DC_SETSWIVELMODE,
494 RPC_DC_SETOVERLAYMODE,
498 RPC_DC_SETLIGHTSOURCE,
499 RPC_DC_SETLIGHTINTENSITY,
501 RPC_DC_ENABLEANTIBANDING,
504 RPC_DC_ADJUSTCONTRAST,
543 // The subtype of DIAG_FORCE_ON_CELLS_F Command
548 CANCEL_FORCE_ON_CELLS = 1
549 }FORCE_ON_CELLS_TYPE_E;
552 #define FORCE_ON_CELLS_NUM_MAX 6
558 // The param is valid when the subtype is FORCE_ON_CELLS
559 uint16 cell_number_and_status;
560 uint16 cell_list[ FORCE_ON_CELLS_NUM_MAX ];
562 }MSG_FORCE_ON_CELLS_T;
572 typedef enum _TOOL_TV_MSG_ID_E
574 TOOL_TV_SET_FREQ = 0, // ÉèÖÃƵµã
575 TOOL_TV_GET_DEMODULATION, // »ñµÃ½âµ÷ÎļþÐÅÏ¢
576 TOOL_TV_GET_FREQERROR, // »ñµÃƵÂÊÆ«²î
577 TOOL_TV_GET_RSSI, // »ñµÃRSSI´óС
578 TOOL_TV_GET_BLOCKERROR, // »ñµÃ½ÓÊÕµ½µÄ×Ü¿éÊý£¬³ö´íµÄ×Ü¿éÊý
579 TOOL_TV_SET_REGISTER, // дÈë¼Ä´æÆ÷Öµ
580 TOOL_TV_GET_REGISTER, // ¶ÁÈ¡¼Ä´æÆ÷Öµ
581 TOOL_TV_GET_PLL, // ¶ÁÈ¡PLLµÄËø¶¨ÐÅÏ¢
582 TOOL_TV_RESET_MODE, // ÉèÖÃSC6600Vģʽ
583 TOOL_TV_GET_MODE, // ²éѯµ±Ç°SC6600VµÄģʽ
584 TOOL_TV_BB_SHOW_PICTURE, // ¿ØÖÆLCD
585 TOOL_TV_START_RAM_ROM_TEST, // ²âÊÔRAM/ROM
586 TOOL_TV_DISPLAY_PICTURE, // ÏÔʾͼƬ
587 TOOL_TV_PERIPHERAL_TEST, // Peripheral²âÊÔ
588 TOOL_TV_START_AV_DECODE_TEST, // ·¢ÆðAudio Vedio Decode²âÊÔ
589 TOOL_TV_GET_AV_DECODE_TEST_STATE, // ²éѯ²âÊÔ״̬,È·ÈÏÊÇ·ñ²âÊÔÍê³É
590 TOOL_TV_GET_AV_DECODE_TEST_RESULT, // Audio Vedio Decode²âÊÔ½á¹û
591 TOOL_TV_START_CMMB_DEMOD, // ·¢ÆðCMMB Demod²âÊÔ
592 TOOL_TV_START_DATA_DISPLAY, // ¿ªÊ¼Êý¾Ý»Ø·Å
593 TOOL_TV_LCD_DISPLAY, // LCDÏÔʾ¿ØÖÆ
594 TOOL_TV_READ_NV, // ¶ÁNV²ÎÊý
595 TOOL_TV_WRITE_NV, // дNV²ÎÊý
596 TOOL_TV_GET_SERVICE_INFO, // »ñȡƵµã¼°ÆµµÀÐÅÏ¢
597 TOOL_TV_PLAY_BY_PARAM, // ¸ù¾Ý¸ø¶¨Æµµã¼°ÆµµÀÐÅÏ¢½øÐв¥·Å
598 TOOL_TV_SEARCH_NETWORK, // ËÑË÷ƵµÀ
599 TOOL_TV_SMD_CHECK, // SMD¼ì²â
601 TOOL_TV_CLOSE_WAITING_WIN, // ¹Ø±ÕµÈ´ý´°¿Ú(·Ç¹¤¾ßÃüÁî)
602 TOOL_TV_CMD_INVALID // ÎÞЧÃüÁî
607 DIAG_AP_CMD_ADC = 0x0001,
612 uint16 cmd; // DIAG_AP_CMD_E
613 uint16 length; // Length of structure
614 } TOOLS_DIAG_AP_CMD_T;
617 uint32 operate; // 0: Get ADC 1: Load ADC 2: Save ADC
618 uint32 parameters[12];
622 uint16 status; // ==0: success, != 0: fail
623 uint16 length; // length of result
624 } TOOLS_DIAG_AP_CNF_T;
626 /**---------------------------------------------------------------------------*
628 **---------------------------------------------------------------------------*/
632 #endif /*End cmddef.h*/