tizen 2.4 release
[kernel/u-boot-tm1.git] / modem_boot / cmd_def.h
1 #ifndef CMD_DEFINE_H
2 #define CMD_DEFINE_H
3
4 typedef enum _CMD_TYPE
5 {
6     BSL_PKT_TYPE_MIN = 0,                       /* the bottom of the DL packet type range */
7     BSL_CMD_TYPE_MIN = BSL_PKT_TYPE_MIN,        /* 0x0 */
8
9     /* Link Control */
10     BSL_CMD_CONNECT = BSL_CMD_TYPE_MIN,         /* 0x0 */
11     /* Data Download */
12     /* the start flag of the data downloading */
13     BSL_CMD_START_DATA,                         /* 0x1 */
14     /* the midst flag of the data downloading */
15     BSL_CMD_MIDST_DATA,                         /* 0x2 */
16     /* the end flag of the data downloading */
17     BSL_CMD_END_DATA,                           /* 0x3 */
18     /* Execute from a certain address */
19     BSL_CMD_EXEC_DATA,                          /* 0x4 */
20     BSL_CMD_NORMAL_RESET,                       /* 0x5 */
21     BSL_CMD_READ_FLASH,                         /* 0x6 */
22     BSL_CMD_READ_CHIP_TYPE,                     /* 0x7 */
23     BSL_CMD_LOOKUP_NVITEM,                      /* 0x8 */
24     BSL_SET_BAUDRATE,                           /* 0x9 */
25     BSL_ERASE_FLASH,                            /* 0xA */
26     BSL_REPARTITION,                            /* 0xB */
27     BSL_CMD_SWITCH_MODE = 0x0D,
28     BSL_CMD_READ_FLASH_START =0x10,/*0x10*/
29     BSL_CMD_READ_FLASH_MIDST,           /*0x11*/
30     BSL_CMD_READ_FLASH_END,             /*0x12*/
31     BSL_CMD_TYPE_MAX,
32
33     /* Start of the Command can be transmited by phone*/
34     BSL_REP_TYPE_MIN = 0x80,
35
36     /* The operation acknowledge */
37     BSL_REP_ACK = BSL_REP_TYPE_MIN,         /* 0x80 */
38     BSL_REP_VER,                            /* 0x81 */
39
40     /* the operation not acknowledge */
41     /* system  */
42     BSL_REP_INVALID_CMD,                    /* 0x82 */
43     BSL_REP_UNKNOW_CMD,                     /* 0x83 */
44     BSL_REP_OPERATION_FAILED,               /* 0x84 */
45
46     /* Link Control*/
47     BSL_REP_NOT_SUPPORT_BAUDRATE,           /* 0x85 */
48
49     /* Data Download */
50     BSL_REP_DOWN_NOT_START,                 /* 0x86 */
51     BSL_REP_DOWN_MULTI_START,               /* 0x87 */
52     BSL_REP_DOWN_EARLY_END,                 /* 0x88 */
53     BSL_REP_DOWN_DEST_ERROR,                /* 0x89 */
54     BSL_REP_DOWN_SIZE_ERROR,                /* 0x8A */
55     BSL_REP_VERIFY_ERROR,                   /* 0x8B */
56     BSL_REP_NOT_VERIFY,                     /* 0x8C */
57
58     /* Phone Internal Error */
59     BSL_PHONE_NOT_ENOUGH_MEMORY,            /* 0x8D */
60     BSL_PHONE_WAIT_INPUT_TIMEOUT,           /* 0x8E */
61
62     /* Phone Internal return value */
63     BSL_PHONE_SUCCEED,                      /* 0x8F */
64     BSL_PHONE_VALID_BAUDRATE,               /* 0x90 */
65     BSL_PHONE_REPEAT_CONTINUE,              /* 0x91 */
66     BSL_PHONE_REPEAT_BREAK,                 /* 0x92 */
67
68     BSL_REP_READ_FLASH,                     /* 0x93 */
69     BSL_REP_READ_CHIP_TYPE,                 /* 0x94 */
70     BSL_REP_LOOKUP_NVITEM,                  /* 0x95 */
71
72     BSL_INCOMPATIBLE_PARTITION,             /* 0x96 */
73     BSL_UNKNOWN_DEVICE,                     /* 0x97 */
74     BSL_INVALID_DEVICE_SIZE,                /* 0x98 */
75
76     BSL_ILLEGAL_SDRAM,                      /* 0x99 */
77     BSL_WRONG_SDRAM_PARAMETER,              /* 0x9a */
78     BSL_EEROR_CHECKSUM = 0xA0,
79     BSL_CHECKSUM_DIFF,
80     BSL_WRITE_ERROR,
81     BSL_PKT_TYPE_MAX
82 } CMD_TYPE;
83
84 typedef CMD_TYPE DLSTATUS;
85
86 typedef CMD_TYPE cmd_pkt_type;
87 typedef cmd_pkt_type ret_status;
88
89
90 /**---------------------------------------------------------------------------*
91  ** The Follow defines the packet processed result table                      *
92  ** packet_protocol:                                                          *
93  ** HDLC_FLAG   PKT_TYPE     DATALENGHT    [DATA]    CRC       HDLC_FLAG      *
94  **   0x7E      MAX:255      MAX:65536      ...      ...          0x7E        *
95  **    1           2             2           0        2             1         *
96  ** response_packet:                                                          *
97  **   0x7E      MAX:255          0           --      ...          0x7E        *
98  **    1           2             2           --       2             1         *
99  ** response packet length: 8 bytes                                           *
100  **---------------------------------------------------------------------------*/
101
102 typedef struct _PKT_HEADER
103 {
104     unsigned short type;
105     unsigned short size;
106 } PKT_HEADER, *PPKT_HEADER;
107
108 typedef struct pkt_header_tag
109 {
110     unsigned short type;
111     unsigned short length;
112 } pkt_header, *pkt_header_ptr;
113
114 #define PKT_FLAG_SIZE              1
115 #define PKT_CRC_SIZE               2
116 #define PKT_TYPE_SIZE              1
117 #define PKT_LEN_SIZE               2
118
119 #define PKT_HEADER_SIZE            sizeof(PKT_HEADER)
120 #define DATA_ADDR                  PKT_HEADER_SIZE
121
122
123 #define SEND_ERROR_RSP(x)         \
124     {                       \
125         FDL_SendAckPacket(x);        \
126         while(1);           \
127     }
128 #endif /* CMD_DEFINE_H */