1
2
3
4
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
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
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 void (*linkerror_ind)(void);
48 void (*enum_rsp)(void);
49 void (*sleep_rsp)(void);
50 void (*wake_rsp)(void);
51 void (*restart_rsp)(void);
52 void (*radioset_rsp)(void);
53 void (*reject_rsp)(struct cflayer *layer, u8 linkid,
54 struct cflayer *client_layer);
55};
56
57
58struct cfctrl_link_param {
59 enum cfctrl_srv linktype;
60 u8 priority;
61 u8 phyid;
62 u8 endpoint;
63 u8 chtype;
64
65 union {
66 struct {
67 u8 connid;
68 } video;
69
70 struct {
71 u32 connid;
72
73 } datagram;
74
75 struct {
76 u32 connid;
77 char volume[20];
78 } rfm;
79
80 struct {
81 u16 fifosize_kb;
82 u16 fifosize_bufs;
83 char name[16];
84 u8 params[255];
85 u16 paramlen;
86
87 } utility;
88 } u;
89};
90
91
92struct cfctrl_request_info {
93 int sequence_no;
94 enum cfctrl_cmd cmd;
95 u8 channel_id;
96 struct cfctrl_link_param param;
97 struct cflayer *client_layer;
98 struct list_head list;
99};
100
101struct cfctrl {
102 struct cfsrvl serv;
103 struct cfctrl_rsp res;
104 atomic_t req_seq_no;
105 atomic_t rsp_seq_no;
106 struct list_head list;
107
108 spinlock_t info_list_lock;
109#ifndef CAIF_NO_LOOP
110 u8 loop_linkid;
111 int loop_linkused[256];
112
113 spinlock_t loop_linkid_lock;
114#endif
115
116};
117
118void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid);
119int cfctrl_linkup_request(struct cflayer *cfctrl,
120 struct cfctrl_link_param *param,
121 struct cflayer *user_layer);
122int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid,
123 struct cflayer *client);
124
125struct cflayer *cfctrl_create(void);
126struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer);
127int cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer);
128void cfctrl_remove(struct cflayer *layr);
129
130#endif
131