fix gcc6 build error
[profile/mobile/platform/kernel/u-boot-tm1.git] / property / calibration_detect.h
1 #ifndef __CALI_DETECT_H__
2 #define __CALI_DETECT_H__
3 #include <config.h>
4 #include <common.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>
11 #include <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>
17
18
19 #define CALIBERATE_COMMAND_AUTOTEST  0x15
20 #define CALIBERATE_COMMAND_PROGRAMKEY 0x17
21
22 extern char *calibration_cmd_buf;
23
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);
37
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);
49
50
51 #define mdelay(_ms) udelay(_ms*1000)
52
53 //#define DEBUG
54 #ifdef DEBUG
55 #define dprintf(fmt, args...) printf(fmt, ##args)
56 #else
57 #define dprintf(fmt, args...) 
58 #endif
59
60 #if 0
61 #define IO_DEBUG 1     // open write and read debug
62 #define WRITE_DEBUG 1  // 0: for read debug, 1 for write debug
63 #else
64 #define IO_DEBUG 0
65 #define WRITE_DEBUG 0
66 #endif
67
68
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
80
81
82 typedef struct msg_head_tag
83 {
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)
86     // + packet size"
87     unsigned char   type;         // Main command type
88     unsigned char   subtype;      // Sub command type
89 }__attribute__((packed)) MSG_HEAD_T;
90
91 typedef struct {
92     unsigned short status;   // ==0: success, != 0: fail
93     unsigned short length;   // length of  result
94 } __attribute__((packed))TOOLS_DIAG_AP_CNF_T;
95
96 typedef struct {
97     unsigned short  cmd;        // DIAG_AP_CMD_E
98     unsigned short  length;   // Length of structure
99 } __attribute__((packed))TOOLS_DIAG_AP_CMD_T;
100
101 typedef struct {
102     unsigned short  cmd;        // DIAG_AP_CMD_E
103     unsigned short  length;   // Length of structure
104     unsigned short  para;
105 } __attribute__((packed))TOOLS_DIAG_AP_EXIT_CMD_T;
106 #endif