1 #ifndef __CALI_DETECT_H__
2 #define __CALI_DETECT_H__
5 #include <linux/types.h>
6 //#include <asm/arch/bits.h>
7 #include <linux/string.h>
8 #include <android_bootimg.h>
9 #include <linux/mtd/mtd.h>
10 #include <linux/mtd/nand.h>
12 //#include <android_boot.h>
13 #include <environment.h>
14 #include <jffs2/jffs2.h>
15 #include <boot_mode.h>
16 #include <secure_efuse.h>
19 #define CALIBERATE_COMMAND_AUTOTEST 0x15
20 #define CALIBERATE_COMMAND_PROGRAMKEY 0x17
22 extern char *calibration_cmd_buf;
24 extern int get_cal_enum_ms(void);
25 extern int get_cal_io_ms(void);
26 extern int dwc_otg_driver_init(void);
27 extern void dwc_otg_driver_cleanup(void);
28 extern int usb_fastboot_initialize(void);
29 extern int usb_serial_init(void);
30 extern void usb_serial_cleanup(void);
31 extern int usb_serial_configed;
32 extern int usb_port_open;
33 extern int usb_read_done;
34 extern int usb_write_done;
35 extern int usb_trans_status;
36 extern int usb_gadget_handle_interrupts(void);
38 extern int gs_open(void);
39 extern int gs_close(void);
40 extern int gs_read(const unsigned char *buf, int *count);
41 extern int gs_write(const unsigned char *buf, int count);
42 extern void usb_wait_trans_done(int direct);
43 extern int usb_is_trans_done(int direct);
44 extern int usb_is_configured(void);
45 extern int usb_is_port_open(void);
46 extern void udc_power_on(void);
47 extern void udc_power_off(void);
48 extern void usb_in_cal(int flag);
51 #define mdelay(_ms) udelay(_ms*1000)
55 #define dprintf(fmt, args...) printf(fmt, ##args)
57 #define dprintf(fmt, args...)
61 #define IO_DEBUG 1 // open write and read debug
62 #define WRITE_DEBUG 1 // 0: for read debug, 1 for write debug
69 #define CALIBERATE_STRING_LEN 10
70 #define CALIBERATE_STRING_LEN_14 14
71 #define CALIBERATE_STRING_LEN_16 16
72 #define CALIBERATE_HEAD 0x7e
73 #define CALIBERATE_COMMOND_T 0xfe
74 #define CALIBERATE_PROKEY_COMMOND_T 0x62
75 #define CALIBERATE_CNF_LEN 0x02
76 #define CALIBERATE_CNF_SCS 0x0
77 #define CALIBERATE_CNF_FAIL 0x01
78 #define DIAG_AP_CMD_PROGRAM_KEY 0x09
79 #define DIAG_AP_CMD_EXIT_PROGRAM_KEY 0x0a
82 typedef struct msg_head_tag
84 unsigned int seq_num; // Message sequence number, used for flow control
85 unsigned short len; // The totoal size of the packet "sizeof(MSG_HEAD_T)
87 unsigned char type; // Main command type
88 unsigned char subtype; // Sub command type
89 }__attribute__((packed)) MSG_HEAD_T;
92 unsigned short status; // ==0: success, != 0: fail
93 unsigned short length; // length of result
94 } __attribute__((packed))TOOLS_DIAG_AP_CNF_T;
97 unsigned short cmd; // DIAG_AP_CMD_E
98 unsigned short length; // Length of structure
99 } __attribute__((packed))TOOLS_DIAG_AP_CMD_T;
102 unsigned short cmd; // DIAG_AP_CMD_E
103 unsigned short length; // Length of structure
105 } __attribute__((packed))TOOLS_DIAG_AP_EXIT_CMD_T;