tizen 2.3.1 release
[framework/telephony/libtcore.git] / include / mux.h
1 /*
2  * libtcore
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Arijit Sen <arijit.sen@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #ifndef __MUX_H__
22 #define __MUX_H__
23
24 #include "queue.h"
25
26 /* CMUX modes */
27 typedef enum {
28         CMUX_MODE_BASIC = 0x00,
29         CMUX_MODE_ADVANCED
30 } tcore_cmux_mode;
31
32 /* CMUX Channel */
33 typedef struct cmux_channel tcore_cmux_channel;
34
35 /* Global MUX Object */
36 typedef struct cmux_obj tcore_cmux_object;
37
38 /* CMUX setup complete callback prototype */
39 typedef void (*cmux_setup_complete_cb_func) (gpointer user_data);
40
41 /* CMUX setup callback prototype */
42 typedef void (*cmux_setup_cb_func) (int channel_id, TcoreHal *hal,
43                                                                         gpointer user_data);
44
45 /* CMUX Channel close callback prototype */
46 typedef void (*cmux_channel_close_cb_func) (TcoreHal *hal, gpointer user_data);
47
48 /* CMUX initialization - Internal and Kernel */
49 TReturn tcore_cmux_init(TcoreHal *phy_hal, unsigned int frame_size,
50                                         TcorePendingResponseCallback resp_cb, void *resp_cb_data);
51
52 /* Setup Internal CMUX */
53 TReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
54         int max_channels, unsigned int cmux_buf_size, TcoreHal *phy_hal,
55         cmux_setup_cb_func channel_setup_cb, gpointer channel_setup_user_data,
56         cmux_setup_complete_cb_func setup_complete_cb, gpointer setup_complete_user_data);
57
58 /* Close CMUX */
59 void tcore_cmux_close(TcoreHal *phy_hal,
60         cmux_channel_close_cb_func channel_close_cb, gpointer channel_close_user_data);
61
62 /* HAL Receive for Internal CMUX */
63 void tcore_cmux_rcv_from_hal(TcoreHal *hal, unsigned char *data, size_t length);
64
65 #endif  /* __MUX_H__ */