2 * This file is part of hayes-ril.
4 * Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 #define RIL_DEVICE_LOCK(ril_device_p) pthread_mutex_lock(&(ril_device_p->handlers->transport->mutex));
25 #define RIL_DEVICE_UNLOCK(ril_device_p) pthread_mutex_unlock(&(ril_device_p->handlers->transport->mutex));
27 #define DEV_GSM RIL_DEVICE_TYPE_GSM
28 #define DEV_CDMA RIL_DEVICE_TYPE_CDMA
30 extern struct ril_device *ril_device;
32 enum ril_device_type {
37 struct ril_device_power_handlers {
39 int (*sdata_create)(void **sdata);
40 int (*sdata_destroy)(void *sdata);
42 int (*power_on)(void *sdata);
43 int (*power_off)(void *sdata);
45 int (*suspend)(void *sdata);
46 int (*resume)(void *sdata);
48 int (*boot)(void *sdata);
51 struct ril_device_transport_handlers {
53 int (*sdata_create)(void **sdata);
54 int (*sdata_destroy)(void *sdata);
56 int (*open)(void *sdata);
57 int (*close)(void *sdata);
59 int (*send)(void *sdata, void **data, int length);
60 int (*recv)(void *sdata, void **data, int length);
62 int (*recv_poll)(void *sdata);
64 pthread_t recv_thread;
65 pthread_mutex_t mutex;
68 struct ril_device_handlers {
69 struct ril_device_power_handlers *power;
70 struct ril_device_transport_handlers *transport;
77 enum ril_device_type type;
78 struct ril_device_handlers *handlers;
82 void ril_device_register(struct ril_device **ril_device_p);
83 int ril_device_init(struct ril_device *ril_device_p);
84 int ril_device_deinit(struct ril_device *ril_device_p);
86 int ril_device_data_create(struct ril_device *ril_device_p);
87 int ril_device_data_destroy(struct ril_device *ril_device_p);
88 int ril_device_boot(struct ril_device *ril_device_p);
89 int ril_device_boot(struct ril_device *ril_device_p);
90 int ril_device_power_on(struct ril_device *ril_device_p);
91 int ril_device_power_off(struct ril_device *ril_device_p);
92 int ril_device_open(struct ril_device *ril_device_p);
93 int ril_device_close(struct ril_device *ril_device_p);
94 int ril_device_send(struct ril_device *ril_device_p, void *data, int length);
95 int ril_device_recv(struct ril_device *ril_device_p, void **data, int length);
96 int ril_device_recv_poll(struct ril_device *ril_device_p);
97 int ril_device_recv_thread_start(struct ril_device *ril_device_p);