upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / misc / modem / sipc4.h
1 /*
2  * Samsung modem IPC header verstion 4
3  *
4  * Copyright (C) 2010 Samsung Electronics Co.Ltd
5  * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6  *
7  * This program is free software; you can redistribute  it and/or modify it
8  * under  the terms of  the GNU General  Public License as published by the
9  * Free Software Foundation;  either version 2 of the  License, or (at your
10  * option) any later version.
11  */
12
13 /*
14  * phonet resource
15  * [0:4] - channel, 1 is default
16  * [5:6] - format
17  *
18  * If format is SIPC4_FMT and channel is 0, it transmits only raw datas, so it
19  * is used for special case such as modem boot.
20  */
21 enum sipc4_format {
22         SIPC4_FMT,
23         SIPC4_RAW,
24         SIPC4_RFS,
25         SIPC4_RESERVED,
26         SIPC4_FORMAT_MAX,
27 };
28
29 #define SIPC4_FORMAT(res)       (((res) >> 5) & 0x3)
30 #define SIPC4_CH(res)           ((res) & 0x1f)
31 #define SIPC4_RES(format, ch)   ((((format) & 0x3) << 5) | ((ch) & 0x1f))
32
33 #define SIPC4_NOT_HDLC_CH       0
34 #define SIPC4_DEFAULT_CH        1
35
36 #define SIPC4_RX_HDLC           (1 << 0)
37 #define SIPC4_RX_LAST           (1 << 1)
38
39 #define HDLC_START              0x7F
40 #define HDLC_END                0x7E
41
42 #define SIPC4_MAX_HDR_SIZE      48
43
44 struct sipc4_tx_data {
45         struct sk_buff          *skb;
46         unsigned char           res;
47 };
48
49 struct sipc_rx_hdr {
50         int len;
51         int frag_len;
52         char start;
53         char hdr[SIPC4_MAX_HDR_SIZE];
54 };
55
56 struct sipc4_rx_data {
57         struct net_device       *dev;
58         struct sk_buff          *skb;
59         struct page             *page;
60         int                     size;
61         int                     format;
62         int                     flags;
63         struct sipc_rx_hdr      *rx_hdr;
64 };
65
66 struct sipc4_rx_frag {
67         int                     data_len;
68 };
69
70 /* Formatted IPC frame */
71 struct fmt_hdr {
72         u16     len;
73         u8      control;
74 } __attribute__ ((packed));
75
76 #define FMT_MORE_BIT            (1 << 7)
77 #define FMT_MULTI_NR            0x80
78 #define FMT_INFOID_MASK         0x7f
79
80 /* RAW IPC frame */
81 struct raw_hdr {
82         u32     len;
83         u8      channel;
84         u8      control;
85 } __attribute__ ((packed));
86
87 /*
88  * RAW IPC frame channel ID
89  */
90 enum {
91         CHID_0 = 0,
92         CHID_CSD_VT_DATA,
93         CHID_PDS_PVT_CONTROL,
94         CHID_PDS_VT_AUDIO,
95         CHID_PDS_VT_VIDEO,
96         CHID_5,                /* 5 */
97         CHID_6,
98         CHID_CDMA_DATA,
99         CHID_PCM_DATA,
100         CHID_TRANSFER_SCREEN,
101         CHID_PSD_DATA1,        /* 10 */
102         CHID_PSD_DATA2,
103         CHID_PSD_DATA3,
104         CHID_PSD_DATA4,
105         CHID_PSD_DATA5,
106         CHID_PSD_DATA6,        /* 15 */
107         CHID_PSD_DATA7,
108         CHID_PSD_DATA8,
109         CHID_PSD_DATA9,
110         CHID_PSD_DATA10,
111         CHID_PSD_DATA11,       /* 20 */
112         CHID_PSD_DATA12,
113         CHID_PSD_DATA13,
114         CHID_PSD_DATA14,
115         CHID_PSD_DATA15,
116         CHID_BT_DUN,           /* 25 */
117         CHID_CIQ_BRIDGE_DATA,
118         CHID_27,
119         CHID_CP_LOG1,
120         CHID_CP_LOG2,
121         CHID_30,               /* 30 */
122         CHID_31,
123         CHID_MAX
124 };
125
126 /* RFS IPC Frame */
127 struct rfs_hdr {
128         u32 len;
129         u8 cmd;
130         u8 id;
131 } __attribute__ ((packed));
132
133 struct rfs_frag {
134         struct rfs_hdr header;
135         int len;
136 };
137
138 extern int sipc4_tx(struct sipc4_tx_data *tx_data);
139 extern int sipc4_rx(struct sipc4_rx_data *rx_data);
140 extern int pdp_netif_rx(struct net_device *parent_ndev, struct sk_buff *skb,
141                         int svnet_ch);