aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/caif/cfctrl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/caif/cfctrl.h')
-rw-r--r--include/net/caif/cfctrl.h138
1 files changed, 138 insertions, 0 deletions
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h
new file mode 100644
index 000000000000..dee25b86caa0
--- /dev/null
+++ b/include/net/caif/cfctrl.h
@@ -0,0 +1,138 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCTRL_H_
8#define CFCTRL_H_
9#include <net/caif/caif_layer.h>
10#include <net/caif/cfsrvl.h>
11
12/* CAIF Control packet commands */
13enum cfctrl_cmd {
14 CFCTRL_CMD_LINK_SETUP = 0,
15 CFCTRL_CMD_LINK_DESTROY = 1,
16 CFCTRL_CMD_LINK_ERR = 2,
17 CFCTRL_CMD_ENUM = 3,
18 CFCTRL_CMD_SLEEP = 4,
19 CFCTRL_CMD_WAKE = 5,
20 CFCTRL_CMD_LINK_RECONF = 6,
21 CFCTRL_CMD_START_REASON = 7,
22 CFCTRL_CMD_RADIO_SET = 8,
23 CFCTRL_CMD_MODEM_SET = 9,
24 CFCTRL_CMD_MASK = 0xf
25};
26
27/* Channel types */
28enum cfctrl_srv {
29 CFCTRL_SRV_DECM = 0,
30 CFCTRL_SRV_VEI = 1,
31 CFCTRL_SRV_VIDEO = 2,
32 CFCTRL_SRV_DBG = 3,
33 CFCTRL_SRV_DATAGRAM = 4,
34 CFCTRL_SRV_RFM = 5,
35 CFCTRL_SRV_UTIL = 6,
36 CFCTRL_SRV_MASK = 0xf
37};
38
39#define CFCTRL_RSP_BIT 0x20
40#define CFCTRL_ERR_BIT 0x10
41
42struct cfctrl_rsp {
43 void (*linksetup_rsp)(struct cflayer *layer, u8 linkid,
44 enum cfctrl_srv serv, u8 phyid,
45 struct cflayer *adapt_layer);
46 void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid,
47 struct cflayer *client_layer);
48 void (*linkerror_ind)(void);
49 void (*enum_rsp)(void);
50 void (*sleep_rsp)(void);
51 void (*wake_rsp)(void);
52 void (*restart_rsp)(void);
53 void (*radioset_rsp)(void);
54 void (*reject_rsp)(struct cflayer *layer, u8 linkid,
55 struct cflayer *client_layer);;
56};
57
58/* Link Setup Parameters for CAIF-Links. */
59struct cfctrl_link_param {
60 enum cfctrl_srv linktype;/* (T3,T0) Type of Channel */
61 u8 priority; /* (P4,P0) Priority of the channel */
62 u8 phyid; /* (U2-U0) Physical interface to connect */
63 u8 endpoint; /* (E1,E0) Endpoint for data channels */
64 u8 chtype; /* (H1,H0) Channel-Type, applies to
65 * VEI, DEBUG */
66 union {
67 struct {
68 u8 connid; /* (D7,D0) Video LinkId */
69 } video;
70
71 struct {
72 u32 connid; /* (N31,Ngit0) Connection ID used
73 * for Datagram */
74 } datagram;
75
76 struct {
77 u32 connid; /* Connection ID used for RFM */
78 char volume[20]; /* Volume to mount for RFM */
79 } rfm; /* Configuration for RFM */
80
81 struct {
82 u16 fifosize_kb; /* Psock FIFO size in KB */
83 u16 fifosize_bufs; /* Psock # signal buffers */
84 char name[16]; /* Name of the PSOCK service */
85 u8 params[255]; /* Link setup Parameters> */
86 u16 paramlen; /* Length of Link Setup
87 * Parameters */
88 } utility; /* Configuration for Utility Links (Psock) */
89 } u;
90};
91
92/* This structure is used internally in CFCTRL */
93struct cfctrl_request_info {
94 int sequence_no;
95 enum cfctrl_cmd cmd;
96 u8 channel_id;
97 struct cfctrl_link_param param;
98 struct cfctrl_request_info *next;
99 struct cflayer *client_layer;
100};
101
102struct cfctrl {
103 struct cfsrvl serv;
104 struct cfctrl_rsp res;
105 atomic_t req_seq_no;
106 atomic_t rsp_seq_no;
107 struct cfctrl_request_info *first_req;
108 /* Protects from simultaneous access to first_req list */
109 spinlock_t info_list_lock;
110#ifndef CAIF_NO_LOOP
111 u8 loop_linkid;
112 int loop_linkused[256];
113 /* Protects simultaneous access to loop_linkid and loop_linkused */
114 spinlock_t loop_linkid_lock;
115#endif
116
117};
118
119void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid);
120void cfctrl_linkup_request(struct cflayer *cfctrl,
121 struct cfctrl_link_param *param,
122 struct cflayer *user_layer);
123int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid,
124 struct cflayer *client);
125void cfctrl_sleep_req(struct cflayer *cfctrl);
126void cfctrl_wake_req(struct cflayer *cfctrl);
127void cfctrl_getstartreason_req(struct cflayer *cfctrl);
128struct cflayer *cfctrl_create(void);
129void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn);
130void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up);
131struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer);
132bool cfctrl_req_eq(struct cfctrl_request_info *r1,
133 struct cfctrl_request_info *r2);
134void cfctrl_insert_req(struct cfctrl *ctrl,
135 struct cfctrl_request_info *req);
136struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl,
137 struct cfctrl_request_info *req);
138#endif /* CFCTRL_H_ */