1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/*
* Copyright (C) 2010 Google, Inc.
* Copyright (C) 2010 Samsung Electronics.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __MODEM_PRJ_H__
#define __MODEM_PRJ_H__
#include <stdint.h>
#define MAX_LINK_DEVTYPE 3
#define MAX_RAW_DEVS 32
#define MAX_NUM_IO_DEV (MAX_RAW_DEVS + 4)
#define IOCTL_MODEM_ON _IO('o', 0x19)
#define IOCTL_MODEM_OFF _IO('o', 0x20)
#define IOCTL_MODEM_RESET _IO('o', 0x21)
#define IOCTL_MODEM_BOOT_ON _IO('o', 0x22)
#define IOCTL_MODEM_BOOT_OFF _IO('o', 0x23)
#define IOCTL_MODEM_START _IO('o', 0x24)
#define IOCTL_MODEM_PROTOCOL_SUSPEND _IO('o', 0x25)
#define IOCTL_MODEM_PROTOCOL_RESUME _IO('o', 0x26)
#define IOCTL_MODEM_STATUS _IO('o', 0x27)
#define IOCTL_MODEM_GOTA_START _IO('o', 0x28)
#define IOCTL_MODEM_FW_UPDATE _IO('o', 0x29)
#define IOCTL_MODEM_NET_SUSPEND _IO('o', 0x30)
#define IOCTL_MODEM_NET_RESUME _IO('o', 0x31)
#define IOCTL_MODEM_DUMP_START _IO('o', 0x32)
#define IOCTL_MODEM_DUMP_UPDATE _IO('o', 0x33)
#define IOCTL_MODEM_FORCE_CRASH_EXIT _IO('o', 0x34)
#define IOCTL_MODEM_CP_UPLOAD _IO('o', 0x35)
#define IOCTL_MODEM_DUMP_RESET _IO('o', 0x36)
#define IOCTL_DPRAM_SEND_BOOT _IO('o', 0x40)
#define IOCTL_DPRAM_INIT_STATUS _IO('o', 0x43)
/* ioctl command definitions. */
#define IOCTL_DPRAM_PHONE_POWON _IO('o', 0xd0)
#define IOCTL_DPRAM_PHONEIMG_LOAD _IO('o', 0xd1)
#define IOCTL_DPRAM_NVDATA_LOAD _IO('o', 0xd2)
#define IOCTL_DPRAM_PHONE_BOOTSTART _IO('o', 0xd3)
#define IOCTL_DPRAM_PHONE_UPLOAD_STEP1 _IO('o', 0xde)
#define IOCTL_DPRAM_PHONE_UPLOAD_STEP2 _IO('o', 0xdf)
/* modem status */
#define MODEM_OFF 0
#define MODEM_CRASHED 1
#define MODEM_RAMDUMP 2
#define MODEM_POWER_ON 3
#define MODEM_BOOTING_NORMAL 4
#define MODEM_BOOTING_RAMDUMP 5
#define MODEM_DUMPING 6
#define MODEM_RUNNING 7
#define HDLC_HEADER_MAX_SIZE 6 /* fmt 3, raw 6, rfs 6 */
#define PSD_DATA_CHID_BEGIN 0x2A
#define PSD_DATA_CHID_END 0x38
#define IP6VERSION 6
#define SOURCE_MAC_ADDR {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC}
/* Does modem ctl structure will use state ? or status defined below ?*/
enum modem_state {
STATE_OFFLINE,
STATE_CRASH_RESET, /* silent reset */
STATE_CRASH_EXIT, /* cp ramdump */
STATE_BOOTING,
STATE_ONLINE,
STATE_NV_REBUILDING, /* <= rebuilding start */
STATE_LOADER_DONE,
};
enum com_state {
COM_NONE,
COM_ONLINE,
COM_HANDSHAKE,
COM_BOOT,
COM_CRASH,
};
struct header_data {
char hdr[HDLC_HEADER_MAX_SIZE];
unsigned len;
unsigned frag_len;
char start; /*hdlc start header 0x7F*/
};
struct sipc4_hdlc_fmt_hdr {
uint16_t len;
uint8_t control;
} __attribute__((packed));
struct sipc4_fmt_hdr {
uint16_t len;
uint8_t msg_seq;
uint8_t ack_seq;
uint8_t main_cmd;
uint8_t sub_cmd;
uint8_t cmd_type;
} __attribute__((packed));
//Link control
#define IOCTL_LINK_CONTROL_ENABLE _IO('o', 0x30)
#define IOCTL_LINK_CONTROL_ACTIVE _IO('o', 0x31)
#define IOCTL_LINK_GET_HOSTWAKE _IO('o', 0x32)
#define IOCTL_LINK_CONNECTED _IO('o', 0x33)
#define IOCTL_LINK_SET_BIAS_CLEAR _IO('o', 0x34)
#endif //__MODEM_PRJ_H__
|