aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/devices
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-02-15 20:16:19 +0100
committerPaul Kocialkowski <contact@paulk.fr>2014-02-15 20:58:20 +0100
commit005645221f3d4dd432970f8f28d9092d66d61213 (patch)
tree6ff93168ae04da425313ada33631fee507cfd7da /samsung-ipc/devices
parentec82c3a5350b8747e1c0a7a0393ab0374dd9fbd5 (diff)
downloadexternal_libsamsung-ipc-005645221f3d4dd432970f8f28d9092d66d61213.zip
external_libsamsung-ipc-005645221f3d4dd432970f8f28d9092d66d61213.tar.gz
external_libsamsung-ipc-005645221f3d4dd432970f8f28d9092d66d61213.tar.bz2
ipc: Consistent coding style and major cleanup
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc/devices')
-rw-r--r--samsung-ipc/devices/aries/aries.c (renamed from samsung-ipc/devices/aries/aries_ipc.c)227
-rw-r--r--samsung-ipc/devices/aries/aries.h (renamed from samsung-ipc/devices/aries/aries_ipc.h)16
-rw-r--r--samsung-ipc/devices/crespo/crespo.c (renamed from samsung-ipc/devices/crespo/crespo_ipc.c)195
-rw-r--r--samsung-ipc/devices/crespo/crespo.h (renamed from samsung-ipc/devices/crespo/crespo_ipc.h)20
-rw-r--r--samsung-ipc/devices/galaxys2/galaxys2.c (renamed from samsung-ipc/devices/galaxys2/galaxys2_ipc.c)141
-rw-r--r--samsung-ipc/devices/galaxys2/galaxys2.h (renamed from samsung-ipc/devices/galaxys2/galaxys2_ipc.h)18
-rw-r--r--samsung-ipc/devices/i9300/i9300.c (renamed from samsung-ipc/devices/i9300/i9300_ipc.c)140
-rw-r--r--samsung-ipc/devices/i9300/i9300.h (renamed from samsung-ipc/devices/i9300/i9300_ipc.h)18
-rw-r--r--samsung-ipc/devices/maguro/maguro.c (renamed from samsung-ipc/devices/maguro/maguro_ipc.c)141
-rw-r--r--samsung-ipc/devices/maguro/maguro.h (renamed from samsung-ipc/devices/maguro/maguro_ipc.h)18
-rw-r--r--samsung-ipc/devices/n7100/n7100.c (renamed from samsung-ipc/devices/n7100/n7100_ipc.c)141
-rw-r--r--samsung-ipc/devices/n7100/n7100.h (renamed from samsung-ipc/devices/n7100/n7100_ipc.h)16
-rw-r--r--samsung-ipc/devices/piranha/piranha.c (renamed from samsung-ipc/devices/piranha/piranha_ipc.c)140
-rw-r--r--samsung-ipc/devices/piranha/piranha.h (renamed from samsung-ipc/devices/piranha/piranha_ipc.h)20
-rw-r--r--samsung-ipc/devices/xmm6160/xmm6160.c30
-rw-r--r--samsung-ipc/devices/xmm6160/xmm6160.h6
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260.c10
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260.h4
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260_hsic.c91
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260_hsic.h10
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260_mipi.c130
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260_mipi.h12
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260_sec_modem.c130
-rw-r--r--samsung-ipc/devices/xmm6260/xmm6260_sec_modem.h32
24 files changed, 774 insertions, 932 deletions
diff --git a/samsung-ipc/devices/aries/aries_ipc.c b/samsung-ipc/devices/aries/aries.c
index aede718..77fa4b6 100644
--- a/samsung-ipc/devices/aries/aries_ipc.c
+++ b/samsung-ipc/devices/aries/aries.c
@@ -38,22 +38,19 @@
#include "phonet.h"
#include "xmm6160.h"
-#include "aries_ipc.h"
+#include "aries.h"
-int aries_ipc_bootstrap(struct ipc_client *client)
+int aries_boot(struct ipc_client *client)
{
void *modem_image_data = NULL;
void *onedram_address = NULL;
unsigned int onedram_init;
unsigned int onedram_magic;
unsigned int onedram_deinit;
-
int onedram_fd = -1;
int serial_fd = -1;
-
struct timeval timeout;
fd_set fds;
-
unsigned char *p;
unsigned char *pp;
int rc;
@@ -62,7 +59,7 @@ int aries_ipc_bootstrap(struct ipc_client *client)
if (client == NULL || client->handlers == NULL || client->handlers->power_on == NULL || client->handlers->power_off == NULL)
return -1;
- ipc_client_log(client, "Starting aries modem bootstrap");
+ ipc_client_log(client, "Starting aries modem boot");
modem_image_data = file_data_read(ARIES_MODEM_IMAGE_DEVICE, ARIES_MODEM_IMAGE_SIZE, 0x1000, 0);
if (modem_image_data == NULL) {
@@ -239,31 +236,32 @@ complete:
return rc;
}
-int aries_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
+int aries_fmt_send(struct ipc_client *client, struct ipc_message *message)
{
struct ipc_fmt_header header;
- void *buffer = NULL;
+ void *buffer;
+ size_t length;
+ size_t count = 0;
+ size_t chunk;
unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || message == NULL)
return -1;
- ipc_fmt_header_fill(&header, request);
+ ipc_fmt_header_setup(&header, message);
length = header.length;
- buffer = malloc(header.length);
+ buffer = calloc(1, length);
memcpy(buffer, &header, sizeof(struct ipc_fmt_header));
- if (request->data != NULL && request->length > 0) {
+
+ if (message->data != NULL && message->size > 0) {
p = (unsigned char *) buffer + sizeof(header);
- memcpy(p, request->data, request->length);
+ memcpy(p, message->data, message->size);
}
- ipc_client_log_send(client, request, __func__);
+ ipc_client_log_send(client, message, __func__);
p = (unsigned char *) buffer;
@@ -272,7 +270,7 @@ int aries_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *reque
rc = client->handlers->write(client->handlers->transport_data, p, chunk);
if (rc < 0) {
- ipc_client_log(client, "Writing FMT data to the modem failed");
+ ipc_client_log(client, "Writing FMT data failed");
goto error;
}
@@ -293,52 +291,52 @@ complete:
return rc;
}
-int aries_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
+int aries_fmt_recv(struct ipc_client *client, struct ipc_message *message)
{
struct ipc_fmt_header *header;
- void *buffer = NULL;
+ void *buffer;
+ size_t length;
+ size_t count = 0;
+ size_t chunk;
unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || message == NULL)
return -1;
length = ARIES_BUFFER_LENGTH;
- buffer = malloc(length);
+ buffer = calloc(1, length);
rc = client->handlers->read(client->handlers->transport_data, buffer, length);
if (rc < (int) sizeof(struct ipc_fmt_header)) {
- ipc_client_log(client, "Reading FMT header from the modem failed");
+ ipc_client_log(client, "Reading FMT header failed");
goto error;
}
header = (struct ipc_fmt_header *) buffer;
- ipc_fmt_message_fill(header, response);
+ ipc_fmt_message_setup(header, message);
length = header->length - sizeof(struct ipc_fmt_header);
if (length > 0) {
- response->length = length;
- response->data = malloc(length);
+ message->size = length;
+ message->data = calloc(1, length);
count = rc - sizeof(struct ipc_fmt_header);
if (count > 0) {
p = (unsigned char *) buffer + sizeof(struct ipc_fmt_header);
- memcpy(response->data, p, count);
+ memcpy(message->data, p, count);
}
}
- p = (unsigned char *) response->data + count;
+ p = (unsigned char *) message->data + count;
while (count < length) {
chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
rc = client->handlers->read(client->handlers->transport_data, p, chunk);
if (rc < 0) {
- ipc_client_log(client, "Reading FMT data from the modem failed");
+ ipc_client_log(client, "Reading FMT data failed");
goto error;
}
@@ -346,7 +344,7 @@ int aries_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *respo
p += rc;
}
- ipc_client_log_recv(client, response, __func__);
+ ipc_client_log_recv(client, message, __func__);
rc = 0;
goto complete;
@@ -361,31 +359,31 @@ complete:
return rc;
}
-int aries_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
+int aries_rfs_send(struct ipc_client *client, struct ipc_message *message)
{
struct ipc_rfs_header header;
- void *buffer = NULL;
+ void *buffer;
+ size_t length;
+ size_t count = 0;
+ size_t chunk;
unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || message == NULL)
return -1;
- ipc_rfs_header_fill(&header, request);
+ ipc_rfs_header_setup(&header, message);
length = header.length;
- buffer = malloc(length);
+ buffer = calloc(1, length);
memcpy(buffer, &header, sizeof(header));
- if (request->data != NULL && request->length > 0) {
+ if (message->data != NULL && message->size > 0) {
p = (unsigned char *) buffer + sizeof(header);
- memcpy(p, request->data, request->length);
+ memcpy(p, message->data, message->size);
}
- ipc_client_log_send(client, request, __func__);
+ ipc_client_log_send(client, message, __func__);
p = (unsigned char *) buffer;
@@ -394,7 +392,7 @@ int aries_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *reque
rc = client->handlers->write(client->handlers->transport_data, p, chunk);
if (rc < 0) {
- ipc_client_log(client, "Writing RFS data to the modem failed");
+ ipc_client_log(client, "Writing RFS data failed");
goto error;
}
@@ -415,52 +413,52 @@ complete:
return rc;
}
-int aries_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
+int aries_rfs_recv(struct ipc_client *client, struct ipc_message *message)
{
struct ipc_rfs_header *header;
- void *buffer = NULL;
+ void *buffer;
+ size_t length;
+ size_t count = 0;
+ size_t chunk;
unsigned char *p;
- int length = 0;
- int count = 0;
- int chunk;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || message == NULL)
return -1;
length = ARIES_BUFFER_LENGTH;
- buffer = malloc(length);
+ buffer = calloc(1, length);
rc = client->handlers->read(client->handlers->transport_data, buffer, length);
if (rc < (int) sizeof(struct ipc_rfs_header)) {
- ipc_client_log(client, "Reading RFS header from the modem failed");
+ ipc_client_log(client, "Reading RFS header failed");
goto error;
}
header = (struct ipc_rfs_header *) buffer;
- ipc_rfs_message_fill(header, response);
+ ipc_rfs_message_setup(header, message);
length = header->length - sizeof(struct ipc_rfs_header);
if (length > 0) {
- response->length = length;
- response->data = malloc(length);
+ message->size = length;
+ message->data = calloc(1, length);
count = rc - sizeof(struct ipc_rfs_header);
if (count > 0) {
p = (unsigned char *) buffer + sizeof(struct ipc_rfs_header);
- memcpy(response->data, p, count);
+ memcpy(message->data, p, count);
}
}
- p = (unsigned char *) response->data + count;
+ p = (unsigned char *) message->data + count;
while (count < length) {
chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
rc = client->handlers->read(client->handlers->transport_data, p, chunk);
if (rc < 0) {
- ipc_client_log(client, "Reading RFS data from the modem failed");
+ ipc_client_log(client, "Reading RFS data failed");
goto error;
}
@@ -468,7 +466,7 @@ int aries_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *respo
p += rc;
}
- ipc_client_log_recv(client, response, __func__);
+ ipc_client_log_recv(client, message, __func__);
rc = 0;
goto complete;
@@ -483,23 +481,21 @@ complete:
return rc;
}
-int aries_ipc_open(void *data, int type)
+int aries_open(void *data, int type)
{
- struct aries_ipc_transport_data *transport_data;
+ struct aries_transport_data *transport_data;
struct sockaddr_pn *spn;
struct ifreq ifr;
-
int reuse;
int socket_rfs_magic;
-
int fd;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct aries_ipc_transport_data *) data;
- memset(data, 0, sizeof(struct aries_ipc_transport_data));
+ transport_data = (struct aries_transport_data *) data;
+ memset(data, 0, sizeof(struct aries_transport_data));
spn = &transport_data->spn;
@@ -558,15 +554,15 @@ int aries_ipc_open(void *data, int type)
return 0;
}
-int aries_ipc_close(void *data)
+int aries_close(void *data)
{
- struct aries_ipc_transport_data *transport_data;
+ struct aries_transport_data *transport_data;
int fd;
if (data == NULL)
return -1;
- transport_data = (struct aries_ipc_transport_data *) data;
+ transport_data = (struct aries_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -578,9 +574,9 @@ int aries_ipc_close(void *data)
return 0;
}
-int aries_ipc_read(void *data, void *buffer, unsigned int length)
+int aries_read(void *data, void *buffer, size_t length)
{
- struct aries_ipc_transport_data *transport_data;
+ struct aries_transport_data *transport_data;
int spn_size;
int fd;
int rc;
@@ -588,7 +584,7 @@ int aries_ipc_read(void *data, void *buffer, unsigned int length)
if (data == NULL || buffer == NULL || length == 0)
return -1;
- transport_data = (struct aries_ipc_transport_data *) data;
+ transport_data = (struct aries_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -596,13 +592,13 @@ int aries_ipc_read(void *data, void *buffer, unsigned int length)
spn_size = sizeof(struct sockaddr_pn);
- rc = recvfrom(fd, buffer, length, 0, (const struct sockaddr *) &transport_data->spn, &spn_size);
+ rc = recvfrom(fd, buffer, length, 0, (struct sockaddr *) &transport_data->spn, &spn_size);
return rc;
}
-int aries_ipc_write(void *data, void *buffer, unsigned int length)
+int aries_write(void *data, const void *buffer, size_t length)
{
- struct aries_ipc_transport_data *transport_data;
+ struct aries_transport_data *transport_data;
int spn_size;
int fd;
int rc;
@@ -610,7 +606,7 @@ int aries_ipc_write(void *data, void *buffer, unsigned int length)
if (data == NULL || buffer == NULL || length == 0)
return -1;
- transport_data = (struct aries_ipc_transport_data *) data;
+ transport_data = (struct aries_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -622,9 +618,9 @@ int aries_ipc_write(void *data, void *buffer, unsigned int length)
return rc;
}
-int aries_ipc_poll(void *data, struct timeval *timeout)
+int aries_poll(void *data, struct timeval *timeout)
{
- struct aries_ipc_transport_data *transport_data;
+ struct aries_transport_data *transport_data;
fd_set fds;
int fd;
int rc;
@@ -632,7 +628,7 @@ int aries_ipc_poll(void *data, struct timeval *timeout)
if (data == NULL)
return -1;
- transport_data = (struct aries_ipc_transport_data *) data;
+ transport_data = (struct aries_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -645,7 +641,7 @@ int aries_ipc_poll(void *data, struct timeval *timeout)
return rc;
}
-int aries_ipc_power_on(void *data)
+int aries_power_on(void *data)
{
char buffer[] = "on\n";
int value;
@@ -666,7 +662,7 @@ int aries_ipc_power_on(void *data)
return 0;
}
-int aries_ipc_power_off(void *data)
+int aries_power_off(void *data)
{
char buffer[] = "off\n";
int value;
@@ -687,18 +683,18 @@ int aries_ipc_power_off(void *data)
return 0;
}
-int aries_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
+int aries_data_create(void **transport_data, void **power_data,
+ void **gprs_data)
{
if (transport_data == NULL)
return -1;
- *transport_data = (void *) malloc(sizeof(struct aries_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct aries_ipc_transport_data));
+ *transport_data = calloc(1, sizeof(struct aries_transport_data));
return 0;
}
-int aries_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
+int aries_data_destroy(void *transport_data, void *power_data, void *gprs_data)
{
if (transport_data == NULL)
return -1;
@@ -708,7 +704,7 @@ int aries_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_da
return 0;
}
-int aries_ipc_gprs_activate(void *data, int cid)
+int aries_gprs_activate(void *data, int cid)
{
int rc;
@@ -719,7 +715,7 @@ int aries_ipc_gprs_activate(void *data, int cid)
return 0;
}
-int aries_ipc_gprs_deactivate(void *data, int cid)
+int aries_gprs_deactivate(void *data, int cid)
{
int rc;
@@ -730,10 +726,10 @@ int aries_ipc_gprs_deactivate(void *data, int cid)
return 0;
}
-char *aries_ipc_gprs_get_iface(int cid)
+char *aries_gprs_get_iface(int cid)
{
- struct ifreq ifr;
char *iface = NULL;
+ struct ifreq ifr;
int fd;
int rc;
int i;
@@ -758,52 +754,51 @@ char *aries_ipc_gprs_get_iface(int cid)
return NULL;
}
-int aries_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
+int aries_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
{
if (capabilities == NULL)
return -1;
- capabilities->port_list = 1;
- capabilities->cid_max = ARIES_GPRS_IFACE_COUNT;
+ capabilities->cid_count = ARIES_GPRS_IFACE_COUNT;
return 0;
}
-struct ipc_ops aries_ipc_fmt_ops = {
- .bootstrap = aries_ipc_bootstrap,
- .send = aries_ipc_fmt_send,
- .recv = aries_ipc_fmt_recv,
+struct ipc_client_ops aries_fmt_ops = {
+ .boot = aries_boot,
+ .send = aries_fmt_send,
+ .recv = aries_fmt_recv,
};
-struct ipc_ops aries_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = aries_ipc_rfs_send,
- .recv = aries_ipc_rfs_recv,
+struct ipc_client_ops aries_rfs_ops = {
+ .boot = NULL,
+ .send = aries_rfs_send,
+ .recv = aries_rfs_recv,
};
-struct ipc_handlers aries_ipc_handlers = {
- .open = aries_ipc_open,
- .close = aries_ipc_close,
- .read = aries_ipc_read,
- .write = aries_ipc_write,
- .poll = aries_ipc_poll,
+struct ipc_client_handlers aries_handlers = {
+ .open = aries_open,
+ .close = aries_close,
+ .read = aries_read,
+ .write = aries_write,
+ .poll = aries_poll,
.transport_data = NULL,
- .power_on = aries_ipc_power_on,
- .power_off = aries_ipc_power_off,
+ .power_on = aries_power_on,
+ .power_off = aries_power_off,
.power_data = NULL,
- .gprs_activate = aries_ipc_gprs_activate,
- .gprs_deactivate = aries_ipc_gprs_deactivate,
+ .gprs_activate = aries_gprs_activate,
+ .gprs_deactivate = aries_gprs_deactivate,
.gprs_data = NULL,
- .data_create = aries_ipc_data_create,
- .data_destroy = aries_ipc_data_destroy,
+ .data_create = aries_data_create,
+ .data_destroy = aries_data_destroy,
};
-struct ipc_gprs_specs aries_ipc_gprs_specs = {
- .gprs_get_iface = aries_ipc_gprs_get_iface,
- .gprs_get_capabilities = aries_ipc_gprs_get_capabilities,
+struct ipc_client_gprs_specs aries_gprs_specs = {
+ .gprs_get_iface = aries_gprs_get_iface,
+ .gprs_get_capabilities = aries_gprs_get_capabilities,
};
-struct ipc_nv_data_specs aries_ipc_nv_data_specs = {
+struct ipc_client_nv_data_specs aries_nv_data_specs = {
.nv_data_path = XMM6160_NV_DATA_PATH,
.nv_data_md5_path = XMM6160_NV_DATA_MD5_PATH,
.nv_data_backup_path = XMM6160_NV_DATA_BACKUP_PATH,
diff --git a/samsung-ipc/devices/aries/aries_ipc.h b/samsung-ipc/devices/aries/aries.h
index bb42f27..efa7870 100644
--- a/samsung-ipc/devices/aries/aries_ipc.h
+++ b/samsung-ipc/devices/aries/aries.h
@@ -20,8 +20,8 @@
#include "phonet.h"
-#ifndef __ARIES_IPC_H__
-#define __ARIES_IPC_H__
+#ifndef __ARIES_H__
+#define __ARIES_H__
#define ARIES_MODEM_IMAGE_SIZE 0xA00000
#define ARIES_PSI_SIZE 0x5000
@@ -49,16 +49,16 @@
#define ARIES_GPRS_IFACE_PREFIX "pdp"
#define ARIES_GPRS_IFACE_COUNT 3
-struct aries_ipc_transport_data {
+struct aries_transport_data {
struct sockaddr_pn spn;
int fd;
};
-extern struct ipc_ops aries_ipc_fmt_ops;
-extern struct ipc_ops aries_ipc_rfs_ops;
-extern struct ipc_handlers aries_ipc_handlers;
-extern struct ipc_gprs_specs aries_ipc_gprs_specs;
-extern struct ipc_nv_data_specs aries_ipc_nv_data_specs;
+extern struct ipc_client_ops aries_fmt_ops;
+extern struct ipc_client_ops aries_rfs_ops;
+extern struct ipc_client_handlers aries_handlers;
+extern struct ipc_client_gprs_specs aries_gprs_specs;
+extern struct ipc_client_nv_data_specs aries_nv_data_specs;
#endif
diff --git a/samsung-ipc/devices/crespo/crespo_ipc.c b/samsung-ipc/devices/crespo/crespo.c
index 94dc695..fe50012 100644
--- a/samsung-ipc/devices/crespo/crespo_ipc.c
+++ b/samsung-ipc/devices/crespo/crespo.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 2011 Joerie de Gram <j.de.gram@gmail.com>
* Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,22 +34,20 @@
#include "crespo_modem_ctl.h"
#include "xmm6160.h"
-#include "crespo_ipc.h"
+#include "crespo.h"
-int crespo_ipc_bootstrap(struct ipc_client *client)
+int crespo_boot(struct ipc_client *client)
{
void *modem_image_data = NULL;
-
int modem_ctl_fd = -1;
int serial_fd = -1;
-
unsigned char *p;
int rc;
if (client == NULL)
return -1;
- ipc_client_log(client, "Starting crespo modem bootstrap");
+ ipc_client_log(client, "Starting crespo modem boot");
modem_image_data = file_data_read(CRESPO_MODEM_IMAGE_DEVICE, CRESPO_MODEM_IMAGE_SIZE, 0x1000, 0);
if (modem_image_data == NULL) {
@@ -129,30 +127,30 @@ complete:
return rc;
}
-int crespo_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
+int crespo_fmt_send(struct ipc_client *client, struct ipc_message *message)
{
struct ipc_fmt_header header;
struct modem_io mio;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || message == NULL)
return -1;
- ipc_fmt_header_fill(&header, request);
+ ipc_fmt_header_setup(&header, message);
memset(&mio, 0, sizeof(struct modem_io));
- mio.size = request->length + sizeof(struct ipc_fmt_header);
- mio.data = malloc(mio.size);
+ mio.size = message->size + sizeof(struct ipc_fmt_header);
+ mio.data = calloc(1, mio.size);
memcpy(mio.data, &header, sizeof(struct ipc_fmt_header));
- if (request->data != NULL && request->length > 0)
- memcpy((void *) ((unsigned char *) mio.data + sizeof(struct ipc_fmt_header)), request->data, request->length);
+ if (message->data != NULL && message->size > 0)
+ memcpy((void *) ((unsigned char *) mio.data + sizeof(struct ipc_fmt_header)), message->data, message->size);
- ipc_client_log_send(client, request, __func__);
+ ipc_client_log_send(client, message, __func__);
rc = client->handlers->write(client->handlers->transport_data, (void *) &mio, sizeof(struct modem_io));
if (rc < 0) {
- ipc_client_log(client, "Writing FMT data to the modem failed");
+ ipc_client_log(client, "Writing FMT data failed");
goto error;
}
@@ -169,37 +167,37 @@ complete:
return rc;
}
-int crespo_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
+int crespo_fmt_recv(struct ipc_client *client, struct ipc_message *message)
{
struct ipc_fmt_header *header;
struct modem_io mio;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || message == NULL)
return -1;
memset(&mio, 0, sizeof(struct modem_io));
mio.size = CRESPO_BUFFER_LENGTH;
- mio.data = malloc(mio.size);
+ mio.data = calloc(1, mio.size);
rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
if (rc < 0 || mio.data == NULL || mio.size < sizeof(struct ipc_fmt_header)) {
- ipc_client_log(client, "Reading FMT data from the modem failed");
+ ipc_client_log(client, "Reading FMT data failed");
goto error;
}
header = (struct ipc_fmt_header *) mio.data;
- ipc_fmt_message_fill(header, response);
+ ipc_fmt_message_setup(header, message);
if (mio.size > sizeof(struct ipc_fmt_header)) {
- response->length = mio.size - sizeof(struct ipc_fmt_header);
- response->data = malloc(response->length);
+ message->size = mio.size - sizeof(struct ipc_fmt_header);
+ message->data = calloc(1, message->size);
- memcpy(response->data, (void *) ((unsigned char *) mio.data + sizeof(struct ipc_fmt_header)), response->length);
+ memcpy(message->data, (void *) ((unsigned char *) mio.data + sizeof(struct ipc_fmt_header)), message->size);
}
- ipc_client_log_recv(client, response, __func__);
+ ipc_client_log_recv(client, message, __func__);
rc = 0;
goto complete;
@@ -214,30 +212,30 @@ complete:
return rc;
}
-int crespo_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
+int crespo_rfs_send(struct ipc_client *client, struct ipc_message *message)
{
struct modem_io mio;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || message == NULL)
return -1;
memset(&mio, 0, sizeof(struct modem_io));
- mio.id = request->mseq;
- mio.cmd = request->index;
- mio.size = request->length;
+ mio.id = message->mseq;
+ mio.cmd = IPC_INDEX(message->command);
+ mio.size = message->size;
- if (request->data != NULL && request->length > 0) {
- mio.data = malloc(mio.size);
+ if (message->data != NULL && message->size > 0) {
+ mio.data = calloc(1, mio.size);
- memcpy(mio.data, request->data, request->length);
+ memcpy(mio.data, message->data, message->size);
}
- ipc_client_log_send(client, request, __func__);
+ ipc_client_log_send(client, message, __func__);
rc = client->handlers->write(client->handlers->transport_data, (void *) &mio, sizeof(struct modem_io));
if (rc < 0) {
- ipc_client_log(client, "Writing RFS data to the modem failed");
+ ipc_client_log(client, "Writing RFS data failed");
goto error;
}
@@ -254,37 +252,36 @@ complete:
return rc;
}
-int crespo_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
+int crespo_rfs_recv(struct ipc_client *client, struct ipc_message *message)
{
struct modem_io mio;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || message == NULL)
return -1;
memset(&mio, 0, sizeof(struct modem_io));
mio.size = CRESPO_BUFFER_LENGTH;
- mio.data = malloc(mio.size);
+ mio.data = calloc(1, mio.size);
rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
if (rc < 0 || mio.data == NULL || mio.size <= 0) {
- ipc_client_log(client, "Reading RFS data from the modem failed");
+ ipc_client_log(client, "Reading RFS data failed");
goto error;
}
- memset(response, 0, sizeof(struct ipc_message_info));
- response->aseq = mio.id;
- response->group = IPC_GROUP_RFS;
- response->index = mio.cmd;
+ memset(message, 0, sizeof(struct ipc_message));
+ message->aseq = mio.id;
+ message->command = IPC_COMMAND(IPC_GROUP_RFS, mio.cmd);
if (mio.size > 0) {
- response->length = mio.size;
- response->data = malloc(response->length);
+ message->size = mio.size;
+ message->data = calloc(1, message->size);
- memcpy(response->data, mio.data, response->length);
+ memcpy(message->data, mio.data, message->size);
}
- ipc_client_log_recv(client, response, __func__);
+ ipc_client_log_recv(client, message, __func__);
rc = 0;
goto complete;
@@ -299,15 +296,15 @@ complete:
return rc;
}
-int crespo_ipc_open(void *data, int type)
+int crespo_open(void *data, int type)
{
- struct crespo_ipc_transport_data *transport_data;
+ struct crespo_transport_data *transport_data;
int fd;
if (data == NULL)
return -1;
- transport_data = (struct crespo_ipc_transport_data *) data;
+ transport_data = (struct crespo_transport_data *) data;
switch (type) {
case IPC_CLIENT_TYPE_FMT:
@@ -328,15 +325,15 @@ int crespo_ipc_open(void *data, int type)
return 0;
}
-int crespo_ipc_close(void *data)
+int crespo_close(void *data)
{
- struct crespo_ipc_transport_data *transport_data;
+ struct crespo_transport_data *transport_data;
int fd;
if (data == NULL)
return -1;
- transport_data = (struct crespo_ipc_transport_data *) data;
+ transport_data = (struct crespo_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -348,16 +345,16 @@ int crespo_ipc_close(void *data)
return 0;
}
-int crespo_ipc_read(void *data, void *buffer, unsigned int length)
+int crespo_read(void *data, void *buffer, size_t length)
{
- struct crespo_ipc_transport_data *transport_data;
+ struct crespo_transport_data *transport_data;
int fd;
int rc;
if (data == NULL || buffer == NULL || length == 0)
return -1;
- transport_data = (struct crespo_ipc_transport_data *) data;
+ transport_data = (struct crespo_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -370,16 +367,16 @@ int crespo_ipc_read(void *data, void *buffer, unsigned int length)
return 0;
}
-int crespo_ipc_write(void *data, void *buffer, unsigned int length)
+int crespo_write(void *data, const void *buffer, size_t length)
{
- struct crespo_ipc_transport_data *transport_data;
+ struct crespo_transport_data *transport_data;
int fd;
int rc;
if (data == NULL || buffer == NULL || length == 0)
return -1;
- transport_data = (struct crespo_ipc_transport_data *) data;
+ transport_data = (struct crespo_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -392,9 +389,9 @@ int crespo_ipc_write(void *data, void *buffer, unsigned int length)
return 0;
}
-int crespo_ipc_poll(void *data, struct timeval *timeout)
+int crespo_poll(void *data, struct timeval *timeout)
{
- struct crespo_ipc_transport_data *transport_data;
+ struct crespo_transport_data *transport_data;
fd_set fds;
int fd;
int rc;
@@ -402,7 +399,7 @@ int crespo_ipc_poll(void *data, struct timeval *timeout)
if (data == NULL)
return -1;
- transport_data = (struct crespo_ipc_transport_data *) data;
+ transport_data = (struct crespo_transport_data *) data;
fd = transport_data->fd;
if (fd < 0)
@@ -415,7 +412,7 @@ int crespo_ipc_poll(void *data, struct timeval *timeout)
return rc;
}
-int crespo_ipc_power_on(void *data)
+int crespo_power_on(void *data)
{
int fd;
int rc;
@@ -434,7 +431,7 @@ int crespo_ipc_power_on(void *data)
return 0;
}
-int crespo_ipc_power_off(void *data)
+int crespo_power_off(void *data)
{
int fd;
int rc;
@@ -453,18 +450,18 @@ int crespo_ipc_power_off(void *data)
return 0;
}
-int crespo_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
+int crespo_data_create(void **transport_data, void **power_data,
+ void **gprs_data)
{
if (transport_data == NULL)
return -1;
- *transport_data = (void *) malloc(sizeof(struct crespo_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct crespo_ipc_transport_data));
+ *transport_data = calloc(1, sizeof(struct crespo_transport_data));
return 0;
}
-int crespo_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
+int crespo_data_destroy(void *transport_data, void *power_data, void *gprs_data)
{
if (transport_data == NULL)
return -1;
@@ -474,7 +471,7 @@ int crespo_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_d
return 0;
}
-char *crespo_ipc_gprs_get_iface_single(int cid)
+char *crespo_gprs_get_iface_single(int cid)
{
char *iface = NULL;
@@ -483,18 +480,17 @@ char *crespo_ipc_gprs_get_iface_single(int cid)
return iface;
}
-int crespo_ipc_gprs_get_capabilities_single(struct ipc_client_gprs_capabilities *capabilities)
+int crespo_gprs_get_capabilities_single(struct ipc_client_gprs_capabilities *capabilities)
{
if (capabilities == NULL)
return -1;
- capabilities->port_list = 0;
- capabilities->cid_max = 1;
+ capabilities->cid_count = 1;
return 0;
}
-char *crespo_ipc_gprs_get_iface(int cid)
+char *crespo_gprs_get_iface(int cid)
{
char *iface = NULL;
@@ -506,57 +502,56 @@ char *crespo_ipc_gprs_get_iface(int cid)
return iface;
}
-int crespo_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
+int crespo_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
{
if (capabilities == NULL)
return -1;
- capabilities->port_list = 0;
- capabilities->cid_max = CRESPO_GPRS_IFACE_COUNT;
+ capabilities->cid_count = CRESPO_GPRS_IFACE_COUNT;
return 0;
}
-struct ipc_ops crespo_ipc_fmt_ops = {
- .bootstrap = crespo_ipc_bootstrap,
- .send = crespo_ipc_fmt_send,
- .recv = crespo_ipc_fmt_recv,
+struct ipc_client_ops crespo_fmt_ops = {
+ .boot = crespo_boot,
+ .send = crespo_fmt_send,
+ .recv = crespo_fmt_recv,
};
-struct ipc_ops crespo_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = crespo_ipc_rfs_send,
- .recv = crespo_ipc_rfs_recv,
+struct ipc_client_ops crespo_rfs_ops = {
+ .boot = NULL,
+ .send = crespo_rfs_send,
+ .recv = crespo_rfs_recv,
};
-struct ipc_handlers crespo_ipc_handlers = {
- .open = crespo_ipc_open,
- .close = crespo_ipc_close,
- .read = crespo_ipc_read,
- .write = crespo_ipc_write,
- .poll = crespo_ipc_poll,
+struct ipc_client_handlers crespo_handlers = {
+ .open = crespo_open,
+ .close = crespo_close,
+ .read = crespo_read,
+ .write = crespo_write,
+ .poll = crespo_poll,
.transport_data = NULL,
- .power_on = crespo_ipc_power_on,
- .power_off = crespo_ipc_power_off,
+ .power_on = crespo_power_on,
+ .power_off = crespo_power_off,
.power_data = NULL,
.gprs_activate = NULL,
.gprs_deactivate = NULL,
.gprs_data = NULL,
- .data_create = crespo_ipc_data_create,
- .data_destroy = crespo_ipc_data_destroy,
+ .data_create = crespo_data_create,
+ .data_destroy = crespo_data_destroy,
};
-struct ipc_gprs_specs crespo_ipc_gprs_specs_single = {
- .gprs_get_iface = crespo_ipc_gprs_get_iface_single,
- .gprs_get_capabilities = crespo_ipc_gprs_get_capabilities_single,
+struct ipc_client_gprs_specs crespo_gprs_specs_single = {
+ .gprs_get_iface = crespo_gprs_get_iface_single,
+ .gprs_get_capabilities = crespo_gprs_get_capabilities_single,
};
-struct ipc_gprs_specs crespo_ipc_gprs_specs = {
- .gprs_get_iface = crespo_ipc_gprs_get_iface,
- .gprs_get_capabilities = crespo_ipc_gprs_get_capabilities,
+struct ipc_client_gprs_specs crespo_gprs_specs = {
+ .gprs_get_iface = crespo_gprs_get_iface,
+ .gprs_get_capabilities = crespo_gprs_get_capabilities,
};
-struct ipc_nv_data_specs crespo_ipc_nv_data_specs = {
+struct ipc_client_nv_data_specs crespo_nv_data_specs = {
.nv_data_path = XMM6160_NV_DATA_PATH,
.nv_data_md5_path = XMM6160_NV_DATA_MD5_PATH,
.nv_data_backup_path = XMM6160_NV_DATA_BACKUP_PATH,
diff --git a/samsung-ipc/devices/crespo/crespo_ipc.h b/samsung-ipc/devices/crespo/crespo.h
index ff984d8..97dff96 100644
--- a/samsung-ipc/devices/crespo/crespo_ipc.h
+++ b/samsung-ipc/devices/crespo/crespo.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
* along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __CRESPO_IPC_H__
-#define __CRESPO_IPC_H__
+#ifndef __CRESPO_H__
+#define __CRESPO_H__
#define CRESPO_MODEM_IMAGE_SIZE 0xD80000
#define CRESPO_PSI_SIZE 0x5000
@@ -34,16 +34,16 @@
#define CRESPO_GPRS_IFACE_PREFIX "rmnet"
#define CRESPO_GPRS_IFACE_COUNT 3
-struct crespo_ipc_transport_data {
+struct crespo_transport_data {
int fd;
};
-extern struct ipc_ops crespo_ipc_fmt_ops;
-extern struct ipc_ops crespo_ipc_rfs_ops;
-extern struct ipc_handlers crespo_ipc_handlers;
-extern struct ipc_gprs_specs crespo_ipc_gprs_specs_single;
-extern struct ipc_gprs_specs crespo_ipc_gprs_specs;
-extern struct ipc_nv_data_specs crespo_ipc_nv_data_specs;
+extern struct ipc_client_ops crespo_fmt_ops;
+extern struct ipc_client_ops crespo_rfs_ops;
+extern struct ipc_client_handlers crespo_handlers;
+extern struct ipc_client_gprs_specs crespo_gprs_specs_single;
+extern struct ipc_client_gprs_specs crespo_gprs_specs;
+extern struct ipc_client_nv_data_specs crespo_nv_data_specs;
#endif
diff --git a/samsung-ipc/devices/galaxys2/galaxys2_ipc.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index 44a315b..7070376 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2_ipc.c
+++ b/samsung-ipc/devices/galaxys2/galaxys2.c
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,22 +29,21 @@
#include "xmm6260.h"
#include "xmm6260_hsic.h"
#include "xmm6260_sec_modem.h"
-#include "galaxys2_ipc.h"
+#include "galaxys2.h"
-int galaxys2_ipc_bootstrap(struct ipc_client *client)
+int galaxys2_boot(struct ipc_client *client)
{
void *modem_image_data = NULL;
int modem_image_fd = -1;
int modem_boot_fd = -1;
int modem_link_fd = -1;
-
unsigned char *p;
int rc;
if (client == NULL)
return -1;
- ipc_client_log(client, "Starting galaxys2 modem bootstrap");
+ ipc_client_log(client, "Starting galaxys2 modem boot");
modem_image_fd = open(GALAXYS2_MODEM_IMAGE_DEVICE, O_RDONLY);
if (modem_image_fd < 0) {
@@ -230,106 +229,88 @@ complete:
return rc;
}
-
-int galaxys2_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int galaxys2_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int galaxys2_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int galaxys2_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int galaxys2_ipc_open(void *data, int type)
+int galaxys2_open(void *data, int type)
{
- struct galaxys2_ipc_transport_data *transport_data;
+ struct galaxys2_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct galaxys2_ipc_transport_data *) data;
+ transport_data = (struct galaxys2_transport_data *) data;
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
+ transport_data->fd = xmm6260_sec_modem_open(type);
if (transport_data->fd < 0)
return -1;
return 0;
}
-int galaxys2_ipc_close(void *data)
+int galaxys2_close(void *data)
{
- struct galaxys2_ipc_transport_data *transport_data;
+ struct galaxys2_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct galaxys2_ipc_transport_data *) data;
+ transport_data = (struct galaxys2_transport_data *) data;
- xmm6260_sec_modem_ipc_close(transport_data->fd);
+ xmm6260_sec_modem_close(transport_data->fd);
transport_data->fd = -1;
return 0;
}
-int galaxys2_ipc_read(void *data, void *buffer, unsigned int length)
+int galaxys2_read(void *data, void *buffer, size_t length)
{
- struct galaxys2_ipc_transport_data *transport_data;
+ struct galaxys2_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct galaxys2_ipc_transport_data *) data;
+ transport_data = (struct galaxys2_transport_data *) data;
+
+ rc = xmm6260_sec_modem_read(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
return rc;
}
-int galaxys2_ipc_write(void *data, void *buffer, unsigned int length)
+int galaxys2_write(void *data, const void *buffer, size_t length)
{
- struct galaxys2_ipc_transport_data *transport_data;
+ struct galaxys2_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct galaxys2_ipc_transport_data *) data;
+ transport_data = (struct galaxys2_transport_data *) data;
+
+ rc = xmm6260_sec_modem_write(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
return rc;
}
-int galaxys2_ipc_poll(void *data, struct timeval *timeout)
+int galaxys2_poll(void *data, struct timeval *timeout)
{
- struct galaxys2_ipc_transport_data *transport_data;
+ struct galaxys2_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct galaxys2_ipc_transport_data *) data;
+ transport_data = (struct galaxys2_transport_data *) data;
+
+ rc = xmm6260_sec_modem_poll(transport_data->fd, timeout);
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
return rc;
}
-int galaxys2_ipc_power_on(void *data)
+int galaxys2_power_on(void *data)
{
return 0;
}
-int galaxys2_ipc_power_off(void *data)
+int galaxys2_power_off(void *data)
{
int fd;
int rc;
@@ -348,18 +329,19 @@ int galaxys2_ipc_power_off(void *data)
return 0;
}
-int galaxys2_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
+int galaxys2_data_create(void **transport_data, void **power_data,
+ void **gprs_data)
{
if (transport_data == NULL)
return -1;
- *transport_data = (void *) malloc(sizeof(struct galaxys2_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct galaxys2_ipc_transport_data));
+ *transport_data = calloc(1, sizeof(struct galaxys2_transport_data));
return 0;
}
-int galaxys2_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
+int galaxys2_data_destroy(void *transport_data, void *power_data,
+ void *gprs_data)
{
if (transport_data == NULL)
return -1;
@@ -369,52 +351,41 @@ int galaxys2_ipc_data_destroy(void *transport_data, void *power_data, void *gprs
return 0;
}
-char *galaxys2_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int galaxys2_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops galaxys2_ipc_fmt_ops = {
- .bootstrap = galaxys2_ipc_bootstrap,
- .send = galaxys2_ipc_fmt_send,
- .recv = galaxys2_ipc_fmt_recv,
+struct ipc_client_ops galaxys2_fmt_ops = {
+ .boot = galaxys2_boot,
+ .send = xmm6260_sec_modem_fmt_send,
+ .recv = xmm6260_sec_modem_fmt_recv,
};
-struct ipc_ops galaxys2_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = galaxys2_ipc_rfs_send,
- .recv = galaxys2_ipc_rfs_recv,
+struct ipc_client_ops galaxys2_rfs_ops = {
+ .boot = NULL,
+ .send = xmm6260_sec_modem_rfs_send,
+ .recv = xmm6260_sec_modem_rfs_recv,
};
-struct ipc_handlers galaxys2_ipc_handlers = {
- .read = galaxys2_ipc_read,
- .write = galaxys2_ipc_write,
- .open = galaxys2_ipc_open,
- .close = galaxys2_ipc_close,
- .poll = galaxys2_ipc_poll,
+struct ipc_client_handlers galaxys2_handlers = {
+ .read = galaxys2_read,
+ .write = galaxys2_write,
+ .open = galaxys2_open,
+ .close = galaxys2_close,
+ .poll = galaxys2_poll,
.transport_data = NULL,
- .power_on = galaxys2_ipc_power_on,
- .power_off = galaxys2_ipc_power_off,
+ .power_on = galaxys2_power_on,
+ .power_off = galaxys2_power_off,
.power_data = NULL,
.gprs_activate = NULL,
.gprs_deactivate = NULL,
.gprs_data = NULL,
- .data_create = galaxys2_ipc_data_create,
- .data_destroy = galaxys2_ipc_data_destroy,
+ .data_create = galaxys2_data_create,
+ .data_destroy = galaxys2_data_destroy,
};
-struct ipc_gprs_specs galaxys2_ipc_gprs_specs = {
- .gprs_get_iface = galaxys2_ipc_gprs_get_iface,
- .gprs_get_capabilities = galaxys2_ipc_gprs_get_capabilities,
+struct ipc_client_gprs_specs galaxys2_gprs_specs = {
+ .gprs_get_iface = xmm6260_sec_modem_gprs_get_iface,
+ .gprs_get_capabilities = xmm6260_sec_modem_gprs_get_capabilities,
};
-struct ipc_nv_data_specs galaxys2_ipc_nv_data_specs = {
+struct ipc_client_nv_data_specs galaxys2_nv_data_specs = {
.nv_data_path = XMM6260_NV_DATA_PATH,
.nv_data_md5_path = XMM6260_NV_DATA_MD5_PATH,
.nv_data_backup_path = XMM6260_NV_DATA_BACKUP_PATH,
diff --git a/samsung-ipc/devices/galaxys2/galaxys2_ipc.h b/samsung-ipc/devices/galaxys2/galaxys2.h
index 7d68465..5d315c6 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2_ipc.h
+++ b/samsung-ipc/devices/galaxys2/galaxys2.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
* along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __GALAXYS2_IPC_H__
-#define __GALAXYS2_IPC_H__
+#ifndef __GALAXYS2_H__
+#define __GALAXYS2_H__
#define GALAXYS2_MODEM_IMAGE_SIZE 0x1000000
#define GALAXYS2_PSI_OFFSET 0
@@ -34,15 +34,15 @@
#define GALAXYS2_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p8"
-struct galaxys2_ipc_transport_data {
+struct galaxys2_transport_data {
int fd;
};
-extern struct ipc_ops galaxys2_ipc_fmt_ops;
-extern struct ipc_ops galaxys2_ipc_rfs_ops;
-extern struct ipc_handlers galaxys2_ipc_handlers;
-extern struct ipc_gprs_specs galaxys2_ipc_gprs_specs;
-extern struct ipc_nv_data_specs galaxys2_ipc_nv_data_specs;
+extern struct ipc_client_ops galaxys2_fmt_ops;
+extern struct ipc_client_ops galaxys2_rfs_ops;
+extern struct ipc_client_handlers galaxys2_handlers;
+extern struct ipc_client_gprs_specs galaxys2_gprs_specs;
+extern struct ipc_client_nv_data_specs galaxys2_nv_data_specs;
#endif
diff --git a/samsung-ipc/devices/i9300/i9300_ipc.c b/samsung-ipc/devices/i9300/i9300.c
index b7364df..a3c22bd 100644
--- a/samsung-ipc/devices/i9300/i9300_ipc.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,22 +29,21 @@
#include "xmm6260.h"
#include "xmm6260_hsic.h"
#include "xmm6260_sec_modem.h"
-#include "i9300_ipc.h"
+#include "i9300.h"
-int i9300_ipc_bootstrap(struct ipc_client *client)
+int i9300_boot(struct ipc_client *client)
{
void *modem_image_data = NULL;
int modem_image_fd = -1;
int modem_boot_fd = -1;
int modem_link_fd = -1;
-
unsigned char *p;
int rc;
if (client == NULL)
return -1;
- ipc_client_log(client, "Starting i9300 modem bootstrap");
+ ipc_client_log(client, "Starting i9300 modem boot");
modem_image_fd = open(I9300_MODEM_IMAGE_DEVICE, O_RDONLY);
if (modem_image_fd < 0) {
@@ -224,106 +223,88 @@ complete:
return rc;
}
-
-int i9300_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int i9300_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int i9300_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int i9300_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int i9300_ipc_open(void *data, int type)
+int i9300_open(void *data, int type)
{
- struct i9300_ipc_transport_data *transport_data;
+ struct i9300_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct i9300_ipc_transport_data *) data;
+ transport_data = (struct i9300_transport_data *) data;
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
+ transport_data->fd = xmm6260_sec_modem_open(type);
if (transport_data->fd < 0)
return -1;
return 0;
}
-int i9300_ipc_close(void *data)
+int i9300_close(void *data)
{
- struct i9300_ipc_transport_data *transport_data;
+ struct i9300_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct i9300_ipc_transport_data *) data;
+ transport_data = (struct i9300_transport_data *) data;
- xmm6260_sec_modem_ipc_close(transport_data->fd);
+ xmm6260_sec_modem_close(transport_data->fd);
transport_data->fd = -1;
return 0;
}
-int i9300_ipc_read(void *data, void *buffer, unsigned int length)
+int i9300_read(void *data, void *buffer, size_t length)
{
- struct i9300_ipc_transport_data *transport_data;
+ struct i9300_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct i9300_ipc_transport_data *) data;
+ transport_data = (struct i9300_transport_data *) data;
+
+ rc = xmm6260_sec_modem_read(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
return rc;
}
-int i9300_ipc_write(void *data, void *buffer, unsigned int length)
+int i9300_write(void *data, const void *buffer, size_t length)
{
- struct i9300_ipc_transport_data *transport_data;
+ struct i9300_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct i9300_ipc_transport_data *) data;
+ transport_data = (struct i9300_transport_data *) data;
+
+ rc = xmm6260_sec_modem_write(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
return rc;
}
-int i9300_ipc_poll(void *data, struct timeval *timeout)
+int i9300_poll(void *data, struct timeval *timeout)
{
- struct i9300_ipc_transport_data *transport_data;
+ struct i9300_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct i9300_ipc_transport_data *) data;
+ transport_data = (struct i9300_transport_data *) data;
+
+ rc = xmm6260_sec_modem_poll(transport_data->fd, timeout);
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
return rc;
}
-int i9300_ipc_power_on(void *data)
+int i9300_power_on(void *data)
{
return 0;
}
-int i9300_ipc_power_off(void *data)
+int i9300_power_off(void *data)
{
int fd;
int rc;
@@ -342,18 +323,18 @@ int i9300_ipc_power_off(void *data)
return 0;
}
-int i9300_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
+int i9300_data_create(void **transport_data, void **power_data,
+ void **gprs_data)
{
if (transport_data == NULL)
return -1;
- *transport_data = (void *) malloc(sizeof(struct i9300_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct i9300_ipc_transport_data));
+ *transport_data = calloc(1, sizeof(struct i9300_transport_data));
return 0;
}
-int i9300_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
+int i9300_data_destroy(void *transport_data, void *power_data, void *gprs_data)
{
if (transport_data == NULL)
return -1;
@@ -363,52 +344,41 @@ int i9300_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_da
return 0;
}
-char *i9300_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int i9300_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops i9300_ipc_fmt_ops = {
- .bootstrap = i9300_ipc_bootstrap,
- .send = i9300_ipc_fmt_send,
- .recv = i9300_ipc_fmt_recv,
+struct ipc_client_ops i9300_fmt_ops = {
+ .boot = i9300_boot,
+ .send = xmm6260_sec_modem_fmt_send,
+ .recv = xmm6260_sec_modem_fmt_recv,
};
-struct ipc_ops i9300_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = i9300_ipc_rfs_send,
- .recv = i9300_ipc_rfs_recv,
+struct ipc_client_ops i9300_rfs_ops = {
+ .boot = NULL,
+ .send = xmm6260_sec_modem_rfs_send,
+ .recv = xmm6260_sec_modem_rfs_recv,
};
-struct ipc_handlers i9300_ipc_handlers = {
- .read = i9300_ipc_read,
- .write = i9300_ipc_write,
- .open = i9300_ipc_open,
- .close = i9300_ipc_close,
- .poll = i9300_ipc_poll,
+struct ipc_client_handlers i9300_handlers = {
+ .read = i9300_read,
+ .write = i9300_write,
+ .open = i9300_open,
+ .close = i9300_close,
+ .poll = i9300_poll,
.transport_data = NULL,
- .power_on = i9300_ipc_power_on,
- .power_off = i9300_ipc_power_off,
+ .power_on = i9300_power_on,
+ .power_off = i9300_power_off,
.power_data = NULL,
.gprs_activate = NULL,
.gprs_deactivate = NULL,
.gprs_data = NULL,
- .data_create = i9300_ipc_data_create,
- .data_destroy = i9300_ipc_data_destroy,
+ .data_create = i9300_data_create,
+ .data_destroy = i9300_data_destroy,
};
-struct ipc_gprs_specs i9300_ipc_gprs_specs = {
- .gprs_get_iface = i9300_ipc_gprs_get_iface,
- .gprs_get_capabilities = i9300_ipc_gprs_get_capabilities,
+struct ipc_client_gprs_specs i9300_gprs_specs = {
+ .gprs_get_iface = xmm6260_sec_modem_gprs_get_iface,
+ .gprs_get_capabilities = xmm6260_sec_modem_gprs_get_capabilities,
};
-struct ipc_nv_data_specs i9300_ipc_nv_data_specs = {
+struct ipc_client_nv_data_specs i9300_nv_data_specs = {
.nv_data_path = XMM6260_NV_DATA_PATH,
.nv_data_md5_path = XMM6260_NV_DATA_MD5_PATH,
.nv_data_backup_path = XMM6260_NV_DATA_BACKUP_PATH,
diff --git a/samsung-ipc/devices/i9300/i9300_ipc.h b/samsung-ipc/devices/i9300/i9300.h
index 901c28d..9e63c4b 100644
--- a/samsung-ipc/devices/i9300/i9300_ipc.h
+++ b/samsung-ipc/devices/i9300/i9300.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
* along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __I9300_IPC_H__
-#define __I9300_IPC_H__
+#ifndef __I9300_H__
+#define __I9300_H__
#define I9300_MODEM_IMAGE_SIZE 0x1000000
#define I9300_PSI_OFFSET 0x1000
@@ -34,15 +34,15 @@
#define I9300_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p7"
-struct i9300_ipc_transport_data {
+struct i9300_transport_data {
int fd;
};
-extern struct ipc_ops i9300_ipc_fmt_ops;
-extern struct ipc_ops i9300_ipc_rfs_ops;
-extern struct ipc_handlers i9300_ipc_handlers;
-extern struct ipc_gprs_specs i9300_ipc_gprs_specs;
-extern struct ipc_nv_data_specs i9300_ipc_nv_data_specs;
+extern struct ipc_client_ops i9300_fmt_ops;
+extern struct ipc_client_ops i9300_rfs_ops;
+extern struct ipc_client_handlers i9300_handlers;
+extern struct ipc_client_gprs_specs i9300_gprs_specs;
+extern struct ipc_client_nv_data_specs i9300_nv_data_specs;
#endif
diff --git a/samsung-ipc/devices/maguro/maguro_ipc.c b/samsung-ipc/devices/maguro/maguro.c
index 632cd3b..f157883 100644
--- a/samsung-ipc/devices/maguro/maguro_ipc.c
+++ b/samsung-ipc/devices/maguro/maguro.c
@@ -2,7 +2,7 @@
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,22 +31,21 @@
#include "xmm6260.h"
#include "xmm6260_mipi.h"
#include "xmm6260_sec_modem.h"
-#include "maguro_ipc.h"
+#include "maguro.h"
-int maguro_ipc_bootstrap(struct ipc_client *client)
+int maguro_boot(struct ipc_client *client)
{
void *modem_image_data = NULL;
int modem_image_fd = -1;
int modem_boot_fd = -1;
void *mps_data = NULL;
-
unsigned char *p;
int rc;
if (client == NULL)
return -1;
- ipc_client_log(client, "Starting maguro modem bootstrap");
+ ipc_client_log(client, "Starting maguro modem boot");
modem_image_fd = open(MAGURO_MODEM_IMAGE_DEVICE, O_RDONLY);
if (modem_image_fd < 0) {
@@ -206,106 +205,88 @@ complete:
return rc;
}
-
-int maguro_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int maguro_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int maguro_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int maguro_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int maguro_ipc_open(void *data, int type)
+int maguro_open(void *data, int type)
{
- struct maguro_ipc_transport_data *transport_data;
+ struct maguro_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct maguro_ipc_transport_data *) data;
+ transport_data = (struct maguro_transport_data *) data;
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
+ transport_data->fd = xmm6260_sec_modem_open(type);
if (transport_data->fd < 0)
return -1;
return 0;
}
-int maguro_ipc_close(void *data)
+int maguro_close(void *data)
{
- struct maguro_ipc_transport_data *transport_data;
+ struct maguro_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct maguro_ipc_transport_data *) data;
+ transport_data = (struct maguro_transport_data *) data;
- xmm6260_sec_modem_ipc_close(transport_data->fd);
+ xmm6260_sec_modem_close(transport_data->fd);
transport_data->fd = -1;
return 0;
}
-int maguro_ipc_read(void *data, void *buffer, unsigned int length)
+int maguro_read(void *data, void *buffer, size_t length)
{
- struct maguro_ipc_transport_data *transport_data;
+ struct maguro_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct maguro_ipc_transport_data *) data;
+ transport_data = (struct maguro_transport_data *) data;
+
+ rc = xmm6260_sec_modem_read(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
return rc;
}
-int maguro_ipc_write(void *data, void *buffer, unsigned int length)
+int maguro_write(void *data, const void *buffer, size_t length)
{
- struct maguro_ipc_transport_data *transport_data;
+ struct maguro_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct maguro_ipc_transport_data *) data;
+ transport_data = (struct maguro_transport_data *) data;
+
+ rc = xmm6260_sec_modem_write(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
return rc;
}
-int maguro_ipc_poll(void *data, struct timeval *timeout)
+int maguro_poll(void *data, struct timeval *timeout)
{
- struct maguro_ipc_transport_data *transport_data;
+ struct maguro_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct maguro_ipc_transport_data *) data;
+ transport_data = (struct maguro_transport_data *) data;
+
+ rc = xmm6260_sec_modem_poll(transport_data->fd, timeout);
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
return rc;
}
-int maguro_ipc_power_on(void *data)
+int maguro_power_on(void *data)
{
return 0;
}
-int maguro_ipc_power_off(void *data)
+int maguro_power_off(void *data)
{
int fd;
int rc;
@@ -324,18 +305,19 @@ int maguro_ipc_power_off(void *data)
return 0;
}
-int maguro_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
+int maguro_data_create(void **transport_data, void **power_data,
+ void **gprs_data)
{
if (transport_data == NULL)
return -1;
- *transport_data = (void *) malloc(sizeof(struct maguro_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct maguro_ipc_transport_data));
+ *transport_data = calloc(1, sizeof(struct maguro_transport_data));
return 0;
}
-int maguro_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
+int maguro_data_destroy(void *transport_data, void *power_data,
+ void *gprs_data)
{
if (transport_data == NULL)
return -1;
@@ -345,52 +327,41 @@ int maguro_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_d
return 0;
}
-char *maguro_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int maguro_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops maguro_ipc_fmt_ops = {
- .bootstrap = maguro_ipc_bootstrap,
- .send = maguro_ipc_fmt_send,
- .recv = maguro_ipc_fmt_recv,
+struct ipc_client_ops maguro_fmt_ops = {
+ .boot = maguro_boot,
+ .send = xmm6260_sec_modem_fmt_send,
+ .recv = xmm6260_sec_modem_fmt_recv,
};
-struct ipc_ops maguro_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = maguro_ipc_rfs_send,
- .recv = maguro_ipc_rfs_recv,
+struct ipc_client_ops maguro_rfs_ops = {
+ .boot = NULL,
+ .send = xmm6260_sec_modem_rfs_send,
+ .recv = xmm6260_sec_modem_rfs_recv,
};
-struct ipc_handlers maguro_ipc_handlers = {
- .read = maguro_ipc_read,
- .write = maguro_ipc_write,
- .open = maguro_ipc_open,
- .close = maguro_ipc_close,
- .poll = maguro_ipc_poll,
+struct ipc_client_handlers maguro_handlers = {
+ .read = maguro_read,
+ .write = maguro_write,
+ .open = maguro_open,
+ .close = maguro_close,
+ .poll = maguro_poll,
.transport_data = NULL,
- .power_on = maguro_ipc_power_on,
- .power_off = maguro_ipc_power_off,
+ .power_on = maguro_power_on,
+ .power_off = maguro_power_off,
.power_data = NULL,
.gprs_activate = NULL,
.gprs_deactivate = NULL,
.gprs_data = NULL,
- .data_create = maguro_ipc_data_create,
- .data_destroy = maguro_ipc_data_destroy,
+ .data_create = maguro_data_create,
+ .data_destroy = maguro_data_destroy,
};
-struct ipc_gprs_specs maguro_ipc_gprs_specs = {
- .gprs_get_iface = maguro_ipc_gprs_get_iface,
- .gprs_get_capabilities = maguro_ipc_gprs_get_capabilities,
+struct ipc_client_gprs_specs maguro_gprs_specs = {
+ .gprs_get_iface = xmm6260_sec_modem_gprs_get_iface,
+ .gprs_get_capabilities = xmm6260_sec_modem_gprs_get_capabilities,
};
-struct ipc_nv_data_specs maguro_ipc_nv_data_specs = {
+struct ipc_client_nv_data_specs maguro_nv_data_specs = {
.nv_data_path = MAGURO_NV_DATA_PATH,
.nv_data_md5_path = MAGURO_NV_DATA_MD5_PATH,
.nv_data_backup_path = MAGURO_NV_DATA_BACKUP_PATH,
diff --git a/samsung-ipc/devices/maguro/maguro_ipc.h b/samsung-ipc/devices/maguro/maguro.h
index c58178c..cc15bd6 100644
--- a/samsung-ipc/devices/maguro/maguro_ipc.h
+++ b/samsung-ipc/devices/maguro/maguro.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
* along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __MAGURO_IPC_H__
-#define __MAGURO_IPC_H__
+#ifndef __MAGURO_H__
+#define __MAGURO_H__
#define MAGURO_MODEM_IMAGE_SIZE 0x1000000
#define MAGURO_PSI_OFFSET 0
@@ -41,15 +41,15 @@
#define MAGURO_NV_DATA_BACKUP_PATH "/factory/.nv_data.bak"
#define MAGURO_NV_DATA_BACKUP_MD5_PATH "/factory/.nv_data.bak.md5"
-struct maguro_ipc_transport_data {
+struct maguro_transport_data {
int fd;
};
-extern struct ipc_ops maguro_ipc_fmt_ops;
-extern struct ipc_ops maguro_ipc_rfs_ops;
-extern struct ipc_handlers maguro_ipc_handlers;
-extern struct ipc_gprs_specs maguro_ipc_gprs_specs;
-extern struct ipc_nv_data_specs maguro_ipc_nv_data_specs;
+extern struct ipc_client_ops maguro_fmt_ops;
+extern struct ipc_client_ops maguro_rfs_ops;
+extern struct ipc_client_handlers maguro_handlers;
+extern struct ipc_client_gprs_specs maguro_gprs_specs;
+extern struct ipc_client_nv_data_specs maguro_nv_data_specs;
#endif
diff --git a/samsung-ipc/devices/n7100/n7100_ipc.c b/samsung-ipc/devices/n7100/n7100.c
index ad118da..c72dcdd 100644
--- a/samsung-ipc/devices/n7100/n7100_ipc.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,22 +29,21 @@
#include "xmm6260.h"
#include "xmm6260_hsic.h"
#include "xmm6260_sec_modem.h"
-#include "n7100_ipc.h"
+#include "n7100.h"
-int n7100_ipc_bootstrap(struct ipc_client *client)
+int n7100_boot(struct ipc_client *client)
{
void *modem_image_data = NULL;
int modem_image_fd = -1;
int modem_boot_fd = -1;
int modem_link_fd = -1;
-
unsigned char *p;
int rc;
if (client == NULL)
return -1;
- ipc_client_log(client, "Starting n7100 modem bootstrap");
+ ipc_client_log(client, "Starting n7100 modem boot");
modem_image_fd = open(N7100_MODEM_IMAGE_DEVICE, O_RDONLY);
if (modem_image_fd < 0) {
@@ -224,106 +223,88 @@ complete:
return rc;
}
-
-int n7100_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int n7100_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int n7100_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int n7100_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int n7100_ipc_open(void *data, int type)
+int n7100_open(void *data, int type)
{
- struct n7100_ipc_transport_data *transport_data;
+ struct n7100_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct n7100_ipc_transport_data *) data;
+ transport_data = (struct n7100_transport_data *) data;
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
+ transport_data->fd = xmm6260_sec_modem_open(type);
if (transport_data->fd < 0)
return -1;
return 0;
}
-int n7100_ipc_close(void *data)
+int n7100_close(void *data)
{
- struct n7100_ipc_transport_data *transport_data;
+ struct n7100_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct n7100_ipc_transport_data *) data;
+ transport_data = (struct n7100_transport_data *) data;
- xmm6260_sec_modem_ipc_close(transport_data->fd);
+ xmm6260_sec_modem_close(transport_data->fd);
transport_data->fd = -1;
return 0;
}
-int n7100_ipc_read(void *data, void *buffer, unsigned int length)
+int n7100_read(void *data, void *buffer, size_t length)
{
- struct n7100_ipc_transport_data *transport_data;
+ struct n7100_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct n7100_ipc_transport_data *) data;
+ transport_data = (struct n7100_transport_data *) data;
+
+ rc = xmm6260_sec_modem_read(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
return rc;
}
-int n7100_ipc_write(void *data, void *buffer, unsigned int length)
+int n7100_write(void *data, const void *buffer, size_t length)
{
- struct n7100_ipc_transport_data *transport_data;
+ struct n7100_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct n7100_ipc_transport_data *) data;
+ transport_data = (struct n7100_transport_data *) data;
+
+ rc = xmm6260_sec_modem_write(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
return rc;
}
-int n7100_ipc_poll(void *data, struct timeval *timeout)
+int n7100_poll(void *data, struct timeval *timeout)
{
- struct n7100_ipc_transport_data *transport_data;
+ struct n7100_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct n7100_ipc_transport_data *) data;
+ transport_data = (struct n7100_transport_data *) data;
+
+ rc = xmm6260_sec_modem_poll(transport_data->fd, timeout);
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
return rc;
}
-int n7100_ipc_power_on(void *data)
+int n7100_power_on(void *data)
{
return 0;
}
-int n7100_ipc_power_off(void *data)
+int n7100_power_off(void *data)
{
int fd;
int rc;
@@ -342,18 +323,19 @@ int n7100_ipc_power_off(void *data)
return 0;
}
-int n7100_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
+int n7100_data_create(void **transport_data, void **power_data,
+ void **gprs_data)
{
if (transport_data == NULL)
return -1;
- *transport_data = (void *) malloc(sizeof(struct n7100_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct n7100_ipc_transport_data));
+ *transport_data = calloc(1, sizeof(struct n7100_transport_data));
return 0;
}
-int n7100_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
+int n7100_data_destroy(void *transport_data, void *power_data,
+ void *gprs_data)
{
if (transport_data == NULL)
return -1;
@@ -363,52 +345,41 @@ int n7100_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_da
return 0;
}
-char *n7100_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int n7100_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops n7100_ipc_fmt_ops = {
- .bootstrap = n7100_ipc_bootstrap,
- .send = n7100_ipc_fmt_send,
- .recv = n7100_ipc_fmt_recv,
+struct ipc_client_ops n7100_fmt_ops = {
+ .boot = n7100_boot,
+ .send = xmm6260_sec_modem_fmt_send,
+ .recv = xmm6260_sec_modem_fmt_recv,
};
-struct ipc_ops n7100_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = n7100_ipc_rfs_send,
- .recv = n7100_ipc_rfs_recv,
+struct ipc_client_ops n7100_rfs_ops = {
+ .boot = NULL,
+ .send = xmm6260_sec_modem_rfs_send,
+ .recv = xmm6260_sec_modem_rfs_recv,
};
-struct ipc_handlers n7100_ipc_handlers = {
- .read = n7100_ipc_read,
- .write = n7100_ipc_write,
- .open = n7100_ipc_open,
- .close = n7100_ipc_close,
- .poll = n7100_ipc_poll,
+struct ipc_client_handlers n7100_handlers = {
+ .read = n7100_read,
+ .write = n7100_write,
+ .open = n7100_open,
+ .close = n7100_close,
+ .poll = n7100_poll,
.transport_data = NULL,
- .power_on = n7100_ipc_power_on,
- .power_off = n7100_ipc_power_off,
+ .power_on = n7100_power_on,
+ .power_off = n7100_power_off,
.power_data = NULL,
.gprs_activate = NULL,
.gprs_deactivate = NULL,
.gprs_data = NULL,
- .data_create = n7100_ipc_data_create,
- .data_destroy = n7100_ipc_data_destroy,
+ .data_create = n7100_data_create,
+ .data_destroy = n7100_data_destroy,
};
-struct ipc_gprs_specs n7100_ipc_gprs_specs = {
- .gprs_get_iface = n7100_ipc_gprs_get_iface,
- .gprs_get_capabilities = n7100_ipc_gprs_get_capabilities,
+struct ipc_client_gprs_specs n7100_gprs_specs = {
+ .gprs_get_iface = xmm6260_sec_modem_gprs_get_iface,
+ .gprs_get_capabilities = xmm6260_sec_modem_gprs_get_capabilities,
};
-struct ipc_nv_data_specs n7100_ipc_nv_data_specs = {
+struct ipc_client_nv_data_specs n7100_nv_data_specs = {
.nv_data_path = XMM6260_NV_DATA_PATH,
.nv_data_md5_path = XMM6260_NV_DATA_MD5_PATH,
.nv_data_backup_path = XMM6260_NV_DATA_BACKUP_PATH,
diff --git a/samsung-ipc/devices/n7100/n7100_ipc.h b/samsung-ipc/devices/n7100/n7100.h
index 0008627..5ffd353 100644
--- a/samsung-ipc/devices/n7100/n7100_ipc.h
+++ b/samsung-ipc/devices/n7100/n7100.h
@@ -17,8 +17,8 @@
* along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __N7100_IPC_H__
-#define __N7100_IPC_H__
+#ifndef __N7100_H__
+#define __N7100_H__
#define N7100_MODEM_IMAGE_SIZE 0x1000000
#define N7100_PSI_OFFSET 0x1000
@@ -34,15 +34,15 @@
#define N7100_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p10"
-struct n7100_ipc_transport_data {
+struct n7100_transport_data {
int fd;
};
-extern struct ipc_ops n7100_ipc_fmt_ops;
-extern struct ipc_ops n7100_ipc_rfs_ops;
-extern struct ipc_handlers n7100_ipc_handlers;
-extern struct ipc_gprs_specs n7100_ipc_gprs_specs;
-extern struct ipc_nv_data_specs n7100_ipc_nv_data_specs;
+extern struct ipc_client_ops n7100_fmt_ops;
+extern struct ipc_client_ops n7100_rfs_ops;
+extern struct ipc_client_handlers n7100_handlers;
+extern struct ipc_client_gprs_specs n7100_gprs_specs;
+extern struct ipc_client_nv_data_specs n7100_nv_data_specs;
#endif
diff --git a/samsung-ipc/devices/piranha/piranha_ipc.c b/samsung-ipc/devices/piranha/piranha.c
index 88754dd..44af920 100644
--- a/samsung-ipc/devices/piranha/piranha_ipc.c
+++ b/samsung-ipc/devices/piranha/piranha.c
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,21 +29,20 @@
#include "xmm6260.h"
#include "xmm6260_mipi.h"
#include "xmm6260_sec_modem.h"
-#include "piranha_ipc.h"
+#include "piranha.h"
-int piranha_ipc_bootstrap(struct ipc_client *client)
+int piranha_boot(struct ipc_client *client)
{
void *modem_image_data = NULL;
int modem_image_fd = -1;
int modem_boot_fd = -1;
-
unsigned char *p;
int rc;
if (client == NULL)
return -1;
- ipc_client_log(client, "Starting piranha modem bootstrap");
+ ipc_client_log(client, "Starting piranha modem boot");
modem_image_fd = open(PIRANHA_MODEM_IMAGE_DEVICE, O_RDONLY);
if (modem_image_fd < 0) {
@@ -172,105 +171,88 @@ complete:
return rc;
}
-int piranha_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_fmt_send(client, request);
-}
-
-int piranha_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
-{
- return xmm6260_sec_modem_ipc_fmt_recv(client, response);
-}
-
-int piranha_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
-{
- return xmm6260_sec_modem_ipc_rfs_send(client, request);
-}
-
-int piranha_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
+int piranha_open(void *data, int type)
{
- return xmm6260_sec_modem_ipc_rfs_recv(client, response);
-}
-
-int piranha_ipc_open(void *data, int type)
-{
- struct piranha_ipc_transport_data *transport_data;
+ struct piranha_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct piranha_ipc_transport_data *) data;
+ transport_data = (struct piranha_transport_data *) data;
- transport_data->fd = xmm6260_sec_modem_ipc_open(type);
+ transport_data->fd = xmm6260_sec_modem_open(type);
if (transport_data->fd < 0)
return -1;
return 0;
}
-int piranha_ipc_close(void *data)
+int piranha_close(void *data)
{
- struct piranha_ipc_transport_data *transport_data;
+ struct piranha_transport_data *transport_data;
if (data == NULL)
return -1;
- transport_data = (struct piranha_ipc_transport_data *) data;
+ transport_data = (struct piranha_transport_data *) data;
- xmm6260_sec_modem_ipc_close(transport_data->fd);
+ xmm6260_sec_modem_close(transport_data->fd);
transport_data->fd = -1;
return 0;
}
-int piranha_ipc_read(void *data, void *buffer, unsigned int length)
+int piranha_read(void *data, void *buffer, size_t length)
{
- struct piranha_ipc_transport_data *transport_data;
+ struct piranha_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct piranha_ipc_transport_data *) data;
+ transport_data = (struct piranha_transport_data *) data;
+
+ rc = xmm6260_sec_modem_read(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_read(transport_data->fd, buffer, length);
return rc;
}
-int piranha_ipc_write(void *data, void *buffer, unsigned int length)
+int piranha_write(void *data, const void *buffer, size_t length)
{
- struct piranha_ipc_transport_data *transport_data;
+ struct piranha_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct piranha_ipc_transport_data *) data;
+ transport_data = (struct piranha_transport_data *) data;
+
+ rc = xmm6260_sec_modem_write(transport_data->fd, buffer, length);
- rc = xmm6260_sec_modem_ipc_write(transport_data->fd, buffer, length);
return rc;
}
-int piranha_ipc_poll(void *data, struct timeval *timeout)
+int piranha_poll(void *data, struct timeval *timeout)
{
- struct piranha_ipc_transport_data *transport_data;
+ struct piranha_transport_data *transport_data;
int rc;
if (data == NULL)
return -1;
- transport_data = (struct piranha_ipc_transport_data *) data;
+ transport_data = (struct piranha_transport_data *) data;
+
+ rc = xmm6260_sec_modem_poll(transport_data->fd, timeout);
- rc = xmm6260_sec_modem_ipc_poll(transport_data->fd, timeout);
return rc;
}
-int piranha_ipc_power_on(void *data)
+int piranha_power_on(void *data)
{
return 0;
}
-int piranha_ipc_power_off(void *data)
+int piranha_power_off(void *data)
{
int fd;
int rc;
@@ -289,18 +271,19 @@ int piranha_ipc_power_off(void *data)
return 0;
}
-int piranha_ipc_data_create(void **transport_data, void **power_data, void **gprs_data)
+int piranha_data_create(void **transport_data, void **power_data,
+ void **gprs_data)
{
if (transport_data == NULL)
return -1;
- *transport_data = (void *) malloc(sizeof(struct piranha_ipc_transport_data));
- memset(*transport_data, 0, sizeof(struct piranha_ipc_transport_data));
+ *transport_data = calloc(1, sizeof(struct piranha_transport_data));
return 0;
}
-int piranha_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_data)
+int piranha_data_destroy(void *transport_data, void *power_data,
+ void *gprs_data)
{
if (transport_data == NULL)
return -1;
@@ -310,52 +293,41 @@ int piranha_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_
return 0;
}
-char *piranha_ipc_gprs_get_iface(int cid)
-{
- return xmm6260_sec_modem_ipc_gprs_get_iface(cid);
-}
-
-
-int piranha_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
-{
- return xmm6260_sec_modem_ipc_gprs_get_capabilities(capabilities);
-}
-
-struct ipc_ops piranha_ipc_fmt_ops = {
- .bootstrap = piranha_ipc_bootstrap,
- .send = piranha_ipc_fmt_send,
- .recv = piranha_ipc_fmt_recv,
+struct ipc_client_ops piranha_fmt_ops = {
+ .boot = piranha_boot,
+ .send = xmm6260_sec_modem_fmt_send,
+ .recv = xmm6260_sec_modem_fmt_recv,
};
-struct ipc_ops piranha_ipc_rfs_ops = {
- .bootstrap = NULL,
- .send = piranha_ipc_rfs_send,
- .recv = piranha_ipc_rfs_recv,
+struct ipc_client_ops piranha_rfs_ops = {
+ .boot = NULL,
+ .send = xmm6260_sec_modem_rfs_send,
+ .recv = xmm6260_sec_modem_rfs_recv,
};
-struct ipc_handlers piranha_ipc_handlers = {
- .read = piranha_ipc_read,
- .write = piranha_ipc_write,
- .open = piranha_ipc_open,
- .close = piranha_ipc_close,
- .poll = piranha_ipc_poll,
+struct ipc_client_handlers piranha_handlers = {
+ .read = piranha_read,
+ .write = piranha_write,
+ .open = piranha_open,
+ .close = piranha_close,
+ .poll = piranha_poll,
.transport_data = NULL,
- .power_on = piranha_ipc_power_on,
- .power_off = piranha_ipc_power_off,
+ .power_on = piranha_power_on,
+ .power_off = piranha_power_off,
.power_data = NULL,
.gprs_activate = NULL,
.gprs_deactivate = NULL,
.gprs_data = NULL,
- .data_create = piranha_ipc_data_create,
- .data_destroy = piranha_ipc_data_destroy,
+ .data_create = piranha_data_create,
+ .data_destroy = piranha_data_destroy,
};
-struct ipc_gprs_specs piranha_ipc_gprs_specs = {
- .gprs_get_iface = piranha_ipc_gprs_get_iface,
- .gprs_get_capabilities = piranha_ipc_gprs_get_capabilities,
+struct ipc_client_gprs_specs piranha_gprs_specs = {
+ .gprs_get_iface = xmm6260_sec_modem_gprs_get_iface,
+ .gprs_get_capabilities = xmm6260_sec_modem_gprs_get_capabilities,
};
-struct ipc_nv_data_specs piranha_ipc_nv_data_specs = {
+struct ipc_client_nv_data_specs piranha_nv_data_specs = {
.nv_data_path = XMM6260_NV_DATA_PATH,
.nv_data_md5_path = XMM6260_NV_DATA_MD5_PATH,
.nv_data_backup_path = XMM6260_NV_DATA_BACKUP_PATH,
diff --git a/samsung-ipc/devices/piranha/piranha_ipc.h b/samsung-ipc/devices/piranha/piranha.h
index 7cff520..834f7c3 100644
--- a/samsung-ipc/devices/piranha/piranha_ipc.h
+++ b/samsung-ipc/devices/piranha/piranha.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
* along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __PIRANHA_IPC_H__
-#define __PIRANHA_IPC_H__
+#ifndef __PIRANHA_H__
+#define __PIRANHA_H__
#define PIRANHA_MODEM_IMAGE_SIZE 0x1400000
#define PIRANHA_PSI_OFFSET 0x1000
@@ -34,16 +34,16 @@
#define PIRANHA_MODEM_IMAGE_DEVICE "/dev/block/mmcblk0p8"
-struct piranha_ipc_transport_data {
+struct piranha_transport_data {
int fd;
};
-extern struct ipc_ops piranha_ipc_fmt_ops;
-extern struct ipc_ops piranha_ipc_rfs_ops;
-extern struct ipc_handlers piranha_ipc_handlers;
-extern struct ipc_gprs_specs piranha_ipc_gprs_specs;
-extern struct ipc_nv_data_specs piranha_ipc_nv_data_specs;
-extern struct ipc_nv_data_specs piranha_ipc_nv_data_specs;
+extern struct ipc_client_ops piranha_fmt_ops;
+extern struct ipc_client_ops piranha_rfs_ops;
+extern struct ipc_client_handlers piranha_handlers;
+extern struct ipc_client_gprs_specs piranha_gprs_specs;
+extern struct ipc_client_nv_data_specs piranha_nv_data_specs;
+extern struct ipc_client_nv_data_specs piranha_nv_data_specs;
#endif
diff --git a/samsung-ipc/devices/xmm6160/xmm6160.c b/samsung-ipc/devices/xmm6160/xmm6160.c
index 2c4d64b..c0c5c35 100644
--- a/samsung-ipc/devices/xmm6160/xmm6160.c
+++ b/samsung-ipc/devices/xmm6160/xmm6160.c
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
#include "xmm6160.h"
int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
- void *psi_data, unsigned short psi_size)
+ const void *psi_data, unsigned short psi_size)
{
char at[] = XMM6160_AT;
unsigned char version;
@@ -38,17 +38,15 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
unsigned char psi_magic;
unsigned char psi_crc;
unsigned char psi_ack;
-
struct termios termios;
struct timeval timeout;
fd_set fds;
-
+ size_t length;
unsigned char *p;
- int length;
int rc;
int i;
- if (client == NULL || serial_fd < 0 || psi_data == NULL || psi_size <= 0)
+ if (client == NULL || serial_fd < 0 || psi_data == NULL || psi_size == 0)
return -1;
tcgetattr(serial_fd, &termios);
@@ -62,7 +60,7 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
length = strlen(at);
for (i = 0; i < XMM6160_AT_COUNT; i++) {
rc = write(serial_fd, at, length);
- if (rc < length) {
+ if (rc < (int) length) {
ipc_client_log(client, "Writing AT in ASCII failed");
goto error;
}
@@ -185,15 +183,14 @@ complete:
}
int xmm6160_firmware_send(struct ipc_client *client, int device_fd,
- void *device_address, void *firmware_data, int firmware_size)
+ void *device_address, const void *firmware_data, size_t firmware_size)
{
- int wc;
-
+ size_t wc;
unsigned char *p;
int rc;
int i;
- if (client == NULL || (device_fd < 0 && device_address == NULL) || firmware_data == NULL || firmware_size <= 0)
+ if (client == NULL || (device_fd < 0 && device_address == NULL) || firmware_data == NULL || firmware_size == 0)
return -1;
p = (unsigned char *) firmware_data;
@@ -204,7 +201,7 @@ int xmm6160_firmware_send(struct ipc_client *client, int device_fd,
wc = 0;
while (wc < firmware_size) {
rc = write(device_fd, (void *) p, firmware_size - wc);
- if (rc < 0) {
+ if (rc <= 0) {
ipc_client_log(client, "Writing firmware failed");
goto error;
}
@@ -229,9 +226,8 @@ int xmm6160_nv_data_send(struct ipc_client *client, int device_fd,
void *device_address)
{
void *nv_data = NULL;
- int nv_size;
- int wc;
-
+ size_t nv_size;
+ size_t wc;
unsigned char *p;
int rc;
@@ -239,6 +235,8 @@ int xmm6160_nv_data_send(struct ipc_client *client, int device_fd,
return -1;
nv_size = ipc_client_nv_data_size(client);
+ if (nv_size == 0)
+ return -1;
nv_data = ipc_nv_data_load(client);
if (nv_data == NULL) {
@@ -255,7 +253,7 @@ int xmm6160_nv_data_send(struct ipc_client *client, int device_fd,
wc = 0;
while (wc < nv_size) {
rc = write(device_fd, p, nv_size - wc);
- if (rc < 0) {
+ if (rc <= 0) {
ipc_client_log(client, "Writing modem image failed");
goto error;
}
diff --git a/samsung-ipc/devices/xmm6160/xmm6160.h b/samsung-ipc/devices/xmm6160/xmm6160.h
index 14f337a..22ae2be 100644
--- a/samsung-ipc/devices/xmm6160/xmm6160.h
+++ b/samsung-ipc/devices/xmm6160/xmm6160.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,9 +37,9 @@
#define XMM6160_NV_DATA_CHUNK_SIZE 0x1000
int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
- void *psi_data, unsigned short psi_size);
+ const void *psi_data, unsigned short psi_size);
int xmm6160_firmware_send(struct ipc_client *client, int device_fd,
- void *device_address, void *firmware_data, int firmware_size);
+ void *device_address, const void *firmware_data, size_t firmware_size);
int xmm6160_nv_data_send(struct ipc_client *client, int device_fd,
void *device_address);
diff --git a/samsung-ipc/devices/xmm6260/xmm6260.c b/samsung-ipc/devices/xmm6260/xmm6260.c
index 416f6c2..2711caf 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260.c
+++ b/samsung-ipc/devices/xmm6260/xmm6260.c
@@ -2,7 +2,7 @@
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,18 +23,18 @@
#include "xmm6260.h"
-unsigned char xmm6260_crc_calculate(void *buffer, int length)
+unsigned char xmm6260_crc_calculate(const void *data, size_t size)
{
unsigned char crc;
unsigned char *p;
- if (buffer == NULL || length <= 0)
+ if (data == NULL || size == 0)
return 0;
- p = (unsigned char *) buffer;
+ p = (unsigned char *) data;
crc = 0;
- while (length--)
+ while (size--)
crc ^= *p++;
return crc;
diff --git a/samsung-ipc/devices/xmm6260/xmm6260.h b/samsung-ipc/devices/xmm6260/xmm6260.h
index c116ede..bc55a44 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260.h
+++ b/samsung-ipc/devices/xmm6260/xmm6260.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@
#define XMM6260_NV_DATA_SIZE 0x200000
#define XMM6260_NV_DATA_CHUNK_SIZE 0x1000
-unsigned char xmm6260_crc_calculate(void *buffer, int length);
+unsigned char xmm6260_crc_calculate(const void *data, size_t size);
#endif
diff --git a/samsung-ipc/devices/xmm6260/xmm6260_hsic.c b/samsung-ipc/devices/xmm6260/xmm6260_hsic.c
index 747ebd1..24b6567 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260_hsic.c
+++ b/samsung-ipc/devices/xmm6260/xmm6260_hsic.c
@@ -2,7 +2,7 @@
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* Based on the incomplete C++ implementation which is:
* Copyright (C) 2012 Sergey Gridasov <grindars@gmail.com>
@@ -37,7 +37,6 @@ int xmm6260_hsic_ack_read(int device_fd, unsigned short ack)
{
struct timeval timeout;
fd_set fds;
-
unsigned short value;
int rc;
int i;
@@ -66,20 +65,18 @@ int xmm6260_hsic_ack_read(int device_fd, unsigned short ack)
}
int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size)
+ const void *psi_data, unsigned short psi_size)
{
struct xmm6260_hsic_psi_header psi_header;
char at[] = XMM6260_AT;
unsigned char psi_ack;
unsigned char chip_id;
unsigned char psi_crc;
-
struct timeval timeout;
fd_set fds;
- int wc;
-
+ size_t wc;
+ size_t length;
unsigned char *p;
- int length;
int rc;
int i;
@@ -98,7 +95,7 @@ int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
timeout.tv_usec = 100000;
rc = write(device_fd, at, length);
- if (rc < length) {
+ if (rc < (int) length) {
ipc_client_log(client, "Writing ATAT in ASCII failed");
goto error;
}
@@ -129,7 +126,7 @@ int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
psi_ack = 0;
rc = read(device_fd, &psi_ack, sizeof(psi_ack));
- if (rc < 0 || psi_ack != XMM6260_HSIC_BOOT0_ACK) {
+ if (rc <= 0 || psi_ack != XMM6260_HSIC_BOOT0_ACK) {
ipc_client_log(client, "Reading boot ACK failed");
goto error;
}
@@ -142,7 +139,7 @@ int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
chip_id = 0;
rc = read(device_fd, &chip_id, sizeof(chip_id));
- if (rc < 0) {
+ if (rc <= 0) {
ipc_client_log(client, "Reading chip id failed");
goto error;
}
@@ -164,7 +161,7 @@ int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
wc = 0;
while (wc < psi_size) {
rc = write(device_fd, (void *) p, psi_size - wc);
- if (rc < 0) {
+ if (rc <= 0) {
ipc_client_log(client, "Writing PSI failed");
goto error;
}
@@ -234,25 +231,23 @@ complete:
}
int xmm6260_hsic_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size)
+ const void *ebl_data, size_t ebl_size)
{
unsigned char ebl_crc;
-
- int chunk;
- int count;
- int wc;
-
+ size_t chunk;
+ size_t count;
+ size_t wc;
+ size_t size;
unsigned char *p;
- int length;
int rc;
- if (client == NULL || device_fd < 0 || ebl_data == NULL || ebl_size <= 0)
+ if (client == NULL || device_fd < 0 || ebl_data == NULL || ebl_size == 0)
return -1;
- length = sizeof(ebl_size);
+ size = sizeof(ebl_size);
- rc = write(device_fd, &ebl_size, length);
- if (rc < length) {
+ rc = write(device_fd, &ebl_size, size);
+ if (rc < (int) size) {
ipc_client_log(client, "Writing EBL size failed");
goto error;
}
@@ -272,7 +267,7 @@ int xmm6260_hsic_ebl_send(struct ipc_client *client, int device_fd,
count = chunk < ebl_size - wc ? chunk : ebl_size - wc;
rc = write(device_fd, (void *) p, count);
- if (rc < 0) {
+ if (rc <= 0) {
ipc_client_log(client, "Writing EBL failed");
goto error;
}
@@ -309,20 +304,18 @@ complete:
}
int xmm6260_hsic_command_send(int device_fd, unsigned short code,
- void *data, int size, int command_data_size, int ack)
+ const void *data, size_t size, size_t command_data_size, int ack)
{
struct xmm6260_hsic_command_header header;
void *buffer = NULL;
- int length;
-
+ size_t length;
struct timeval timeout;
fd_set fds;
-
unsigned char *p;
int rc;
int i;
- if (device_fd < 0 || data == NULL || size <= 0 || command_data_size < size)
+ if (device_fd < 0 || data == NULL || size == 0 || command_data_size == 0 || command_data_size < size)
return -1;
header.checksum = (size & 0xffff) + code;
@@ -331,11 +324,11 @@ int xmm6260_hsic_command_send(int device_fd, unsigned short code,
p = (unsigned char *) data;
- for (i = 0; i < size; i++)
+ for (i = 0; i < (int) size; i++)
header.checksum += *p++;
length = command_data_size + sizeof(header);
- buffer = malloc(length);
+ buffer = calloc(1, length);
memset(buffer, 0, length);
p = (unsigned char *) buffer;
@@ -344,7 +337,7 @@ int xmm6260_hsic_command_send(int device_fd, unsigned short code,
memcpy(p, data, size);
rc = write(device_fd, buffer, length);
- if (rc < length)
+ if (rc < (int) length)
goto error;
if (!ack) {
@@ -373,7 +366,7 @@ int xmm6260_hsic_command_send(int device_fd, unsigned short code,
goto error;
rc = read(device_fd, buffer, command_data_size);
- if (rc < command_data_size)
+ if (rc < (int) command_data_size)
goto error;
if (header.code != code)
@@ -392,16 +385,16 @@ complete:
return rc;
}
-int xmm6260_hsic_modem_data_send(int device_fd, void *data, int size, int address)
+int xmm6260_hsic_modem_data_send(int device_fd, const void *data, size_t size,
+ int address)
{
- int chunk;
- int count;
- int c;
-
+ size_t chunk;
+ size_t count;
+ size_t c;
unsigned char *p;
int rc;
- if (device_fd < 0 || data == NULL || size <= 0)
+ if (device_fd < 0 || data == NULL || size == 0)
return -1;
rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_FLASH_SET_ADDRESS, &address, sizeof(address), XMM6260_HSIC_FLASH_SET_ADDRESS_SIZE, 1);
@@ -436,11 +429,9 @@ complete:
int xmm6260_hsic_port_config_send(struct ipc_client *client, int device_fd)
{
void *buffer = NULL;
- int length;
-
+ size_t length;
struct timeval timeout;
fd_set fds;
-
int rc;
if (client == NULL || device_fd < 0)
@@ -457,14 +448,14 @@ int xmm6260_hsic_port_config_send(struct ipc_client *client, int device_fd)
goto error;
length = XMM6260_HSIC_PORT_CONFIG_SIZE;
- buffer = malloc(length);
+ buffer = calloc(1, length);
rc = select(device_fd + 1, &fds, NULL, NULL, &timeout);
if (rc <= 0)
goto error;
rc = read(device_fd, buffer, length);
- if (rc < length) {
+ if (rc < (int) length) {
ipc_client_log(client, "Reading port config failed");
goto error;
}
@@ -490,11 +481,11 @@ complete:
}
int xmm6260_hsic_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size)
+ const void *sec_data, size_t sec_size)
{
int rc;
- if (client == NULL || device_fd < 0 || sec_data == NULL || sec_size <= 0)
+ if (client == NULL || device_fd < 0 || sec_data == NULL || sec_size == 0)
return -1;
rc = xmm6260_hsic_command_send(device_fd, XMM6260_COMMAND_SEC_START, sec_data, sec_size, XMM6260_HSIC_SEC_START_SIZE, 1);
@@ -507,7 +498,7 @@ int xmm6260_hsic_sec_start_send(struct ipc_client *client, int device_fd,
int xmm6260_hsic_sec_end_send(struct ipc_client *client, int device_fd)
{
unsigned short sec_data;
- int sec_size;
+ size_t sec_size;
int rc;
if (client == NULL || device_fd < 0)
@@ -524,11 +515,11 @@ int xmm6260_hsic_sec_end_send(struct ipc_client *client, int device_fd)
}
int xmm6260_hsic_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size)
+ const void *firmware_data, size_t firmware_size)
{
int rc;
- if (client == NULL || device_fd < 0 || firmware_data == NULL || firmware_size <= 0)
+ if (client == NULL || device_fd < 0 || firmware_data == NULL || firmware_size == 0)
return -1;
rc = xmm6260_hsic_modem_data_send(device_fd, firmware_data, firmware_size, XMM6260_FIRMWARE_ADDRESS);
@@ -541,13 +532,15 @@ int xmm6260_hsic_firmware_send(struct ipc_client *client, int device_fd,
int xmm6260_hsic_nv_data_send(struct ipc_client *client, int device_fd)
{
void *nv_data = NULL;
- int nv_size;
+ size_t nv_size;
int rc;
if (client == NULL || device_fd < 0)
return -1;
nv_size = ipc_client_nv_data_size(client);
+ if (nv_size == 0)
+ return -1;
nv_data = ipc_nv_data_load(client);
if (nv_data == NULL) {
diff --git a/samsung-ipc/devices/xmm6260/xmm6260_hsic.h b/samsung-ipc/devices/xmm6260/xmm6260_hsic.h
index 4e25bce..1728a4c 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260_hsic.h
+++ b/samsung-ipc/devices/xmm6260/xmm6260_hsic.h
@@ -2,7 +2,7 @@
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,16 +51,16 @@ struct xmm6260_hsic_command_header {
} __attribute__((packed));
int xmm6260_hsic_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size);
+ const void *psi_data, unsigned short psi_size);
int xmm6260_hsic_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size);
+ const void *ebl_data, size_t ebl_size);
int xmm6260_hsic_port_config_send(struct ipc_client *client, int device_fd);
int xmm6260_hsic_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size);
+ const void *sec_data, size_t sec_size);
int xmm6260_hsic_sec_end_send(struct ipc_client *client, int device_fd);
int xmm6260_hsic_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size);
+ const void *firmware_data, size_t firmware_size);
int xmm6260_hsic_nv_data_send(struct ipc_client *client, int device_fd);
int xmm6260_hsic_hw_reset_send(struct ipc_client *client, int device_fd);
diff --git a/samsung-ipc/devices/xmm6260/xmm6260_mipi.c b/samsung-ipc/devices/xmm6260/xmm6260_mipi.c
index a14fd20..dd2a560 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260_mipi.c
+++ b/samsung-ipc/devices/xmm6260/xmm6260_mipi.c
@@ -2,7 +2,7 @@
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* Based on the incomplete C++ implementation which is:
* Copyright (C) 2012 Sergey Gridasov <grindars@gmail.com>
@@ -33,12 +33,12 @@
#include "xmm6260.h"
#include "xmm6260_mipi.h"
-int xmm6260_mipi_crc_calculate(void *buffer, int length)
+int xmm6260_mipi_crc_calculate(const void *data, size_t size)
{
unsigned char crc;
int mipi_crc;
- crc = xmm6260_crc_calculate(buffer, length);
+ crc = xmm6260_crc_calculate(data, size);
mipi_crc = (crc << 24) | 0xffffff;
return mipi_crc;
@@ -48,7 +48,6 @@ int xmm6260_mipi_ack_read(int device_fd, unsigned short ack)
{
struct timeval timeout;
fd_set fds;
-
unsigned int value;
int rc;
int i;
@@ -77,18 +76,16 @@ int xmm6260_mipi_ack_read(int device_fd, unsigned short ack)
}
int xmm6260_mipi_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size)
+ const void *psi_data, unsigned short psi_size)
{
struct xmm6260_mipi_psi_header psi_header;
char at[] = XMM6260_AT;
int psi_crc;
-
struct timeval timeout;
fd_set fds;
- int wc;
-
+ size_t wc;
+ size_t length;
unsigned char *p;
- int length;
int rc;
int i;
@@ -107,7 +104,7 @@ int xmm6260_mipi_psi_send(struct ipc_client *client, int device_fd,
timeout.tv_usec = 100000;
rc = write(device_fd, at, length);
- if (rc < length) {
+ if (rc < (int) length) {
ipc_client_log(client, "Writing ATAT in ASCII failed");
goto error;
}
@@ -147,7 +144,7 @@ int xmm6260_mipi_psi_send(struct ipc_client *client, int device_fd,
wc = 0;
while (wc < psi_size) {
rc = write(device_fd, (void *) p, psi_size - wc);
- if (rc < 0) {
+ if (rc <= 0) {
ipc_client_log(client, "Writing PSI failed");
goto error;
}
@@ -184,20 +181,19 @@ complete:
}
int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size)
+ const void *ebl_data, size_t ebl_size)
{
unsigned short boot_magic[4];
unsigned char ebl_crc;
-
- int chunk;
- int count;
- int wc;
-
+ size_t chunk;
+ size_t count;
+ size_t wc;
+ size_t size;
+ size_t length;
unsigned char *p;
- int length;
int rc;
- if (client == NULL || device_fd < 0 || ebl_data == NULL || ebl_size <= 0)
+ if (client == NULL || device_fd < 0 || ebl_data == NULL || ebl_size == 0)
return -1;
boot_magic[0] = 0;
@@ -214,7 +210,7 @@ int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
}
rc = write(device_fd, &boot_magic, length);
- if (rc < length) {
+ if (rc < (int) length) {
ipc_client_log(client, "Writing boot magic failed");
goto error;
}
@@ -226,16 +222,16 @@ int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
goto error;
}
- length = sizeof(ebl_size);
+ size = sizeof(ebl_size);
- rc = write(device_fd, &length, sizeof(length));
- if (rc < (int) sizeof(length)) {
+ rc = write(device_fd, &size, sizeof(size));
+ if (rc < (int) sizeof(size)) {
ipc_client_log(client, "Writing EBL size length failed");
goto error;
}
- rc = write(device_fd, &ebl_size, length);
- if (rc < length) {
+ rc = write(device_fd, &ebl_size, size);
+ if (rc < (int) size) {
ipc_client_log(client, "Writing EBL size failed");
goto error;
}
@@ -249,8 +245,8 @@ int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
ebl_size++;
- rc = write(device_fd, &ebl_size, length);
- if (rc < length) {
+ rc = write(device_fd, &ebl_size, size);
+ if (rc < (int) size) {
ipc_client_log(client, "Writing EBL size failed");
goto error;
}
@@ -265,7 +261,7 @@ int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
count = chunk < ebl_size - wc ? chunk : ebl_size - wc;
rc = write(device_fd, (void *) p, count);
- if (rc < 0) {
+ if (rc <= 0) {
ipc_client_log(client, "Writing EBL failed");
goto error;
}
@@ -302,19 +298,17 @@ complete:
}
int xmm6260_mipi_command_send(int device_fd, unsigned short code,
- void *data, int size, int ack, int short_footer)
+ const void *data, size_t size, int ack, int short_footer)
{
struct xmm6260_mipi_command_header header;
struct xmm6260_mipi_command_footer footer;
- int footer_size;
void *buffer = NULL;
- int length;
-
+ size_t length;
+ size_t footer_length;
struct timeval timeout;
fd_set fds;
- int chunk;
- int c;
-
+ size_t chunk;
+ size_t c;
unsigned char *p;
int rc;
int i;
@@ -333,25 +327,25 @@ int xmm6260_mipi_command_send(int device_fd, unsigned short code,
p = (unsigned char *) data;
- for (i = 0; i < size; i++)
+ for (i = 0; i < (int) size; i++)
footer.checksum += *p++;
- footer_size = sizeof(footer);
+ footer_length = sizeof(footer);
if (short_footer)
- footer_size -= sizeof(short);
+ footer_length -= sizeof(short);
- length = sizeof(header) + size + footer_size;
- buffer = malloc(length);
+ length = sizeof(header) + size + footer_length;
+ buffer = calloc(1, length);
p = (unsigned char *) buffer;
memcpy(p, &header, sizeof(header));
p += sizeof(header);
memcpy(p, data, size);
p += size;
- memcpy(p, &footer, footer_size);
+ memcpy(p, &footer, footer_length);
rc = write(device_fd, buffer, length);
- if (rc < length)
+ if (rc < (int) length)
goto error;
free(buffer);
@@ -383,7 +377,7 @@ int xmm6260_mipi_command_send(int device_fd, unsigned short code,
if (length < (int) sizeof(buffer))
goto error;
- buffer = malloc(length);
+ buffer = calloc(1, length);
p = (unsigned char *) buffer;
memcpy(p, &length, sizeof(length));
@@ -397,7 +391,7 @@ int xmm6260_mipi_command_send(int device_fd, unsigned short code,
goto error;
rc = read(device_fd, (void *) p, chunk);
- if (rc < chunk)
+ if (rc < (int) chunk)
goto error;
p += rc;
@@ -421,16 +415,16 @@ complete:
return rc;
}
-int xmm6260_mipi_modem_data_send(int device_fd, void *data, int size, int address)
+int xmm6260_mipi_modem_data_send(int device_fd, const void *data, size_t size,
+ int address)
{
- int chunk;
- int count;
- int c;
-
+ size_t chunk;
+ size_t count;
+ size_t c;
unsigned char *p;
int rc;
- if (device_fd < 0 || data == NULL || size <= 0)
+ if (device_fd < 0 || data == NULL || size == 0)
return -1;
rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_FLASH_SET_ADDRESS, &address, sizeof(address), 1, 0);
@@ -465,14 +459,12 @@ complete:
int xmm6260_mipi_port_config_send(struct ipc_client *client, int device_fd)
{
void *buffer = NULL;
- int length;
-
+ size_t length;
struct timeval timeout;
fd_set fds;
- int chunk;
- int count;
- int c;
-
+ size_t chunk;
+ size_t count;
+ size_t c;
unsigned char *p;
int rc;
@@ -490,13 +482,13 @@ int xmm6260_mipi_port_config_send(struct ipc_client *client, int device_fd)
goto error;
rc = read(device_fd, &length, sizeof(length));
- if (rc < (int) sizeof(length) || length <= 0) {
+ if (rc < (int) sizeof(length) || length == 0) {
ipc_client_log(client, "Reading port config length failed");
goto error;
}
ipc_client_log(client, "Read port config length (0x%x)", length);
- buffer = malloc(length);
+ buffer = calloc(1, length);
p = (unsigned char *) buffer;
@@ -510,7 +502,7 @@ int xmm6260_mipi_port_config_send(struct ipc_client *client, int device_fd)
goto error;
rc = read(device_fd, p, count);
- if (rc < count) {
+ if (rc < (int) count) {
ipc_client_log(client, "Reading port config failed");
goto error;
}
@@ -540,11 +532,11 @@ complete:
}
int xmm6260_mipi_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size)
+ const void *sec_data, size_t sec_size)
{
int rc;
- if (client == NULL || device_fd < 0 || sec_data == NULL || sec_size <= 0)
+ if (client == NULL || device_fd < 0 || sec_data == NULL || sec_size == 0)
return -1;
rc = xmm6260_mipi_command_send(device_fd, XMM6260_COMMAND_SEC_START, sec_data, sec_size, 1, 0);
@@ -557,7 +549,7 @@ int xmm6260_mipi_sec_start_send(struct ipc_client *client, int device_fd,
int xmm6260_mipi_sec_end_send(struct ipc_client *client, int device_fd)
{
unsigned short sec_data;
- int sec_size;
+ size_t sec_size;
int rc;
if (client == NULL || device_fd < 0)
@@ -574,11 +566,11 @@ int xmm6260_mipi_sec_end_send(struct ipc_client *client, int device_fd)
}
int xmm6260_mipi_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size)
+ const void *firmware_data, size_t firmware_size)
{
int rc;
- if (client == NULL || device_fd < 0 || firmware_data == NULL || firmware_size <= 0)
+ if (client == NULL || device_fd < 0 || firmware_data == NULL || firmware_size == 0)
return -1;
rc = xmm6260_mipi_modem_data_send(device_fd, firmware_data, firmware_size, XMM6260_FIRMWARE_ADDRESS);
@@ -591,13 +583,15 @@ int xmm6260_mipi_firmware_send(struct ipc_client *client, int device_fd,
int xmm6260_mipi_nv_data_send(struct ipc_client *client, int device_fd)
{
void *nv_data = NULL;
- int nv_size;
+ size_t nv_size;
int rc;
if (client == NULL || device_fd < 0)
return -1;
nv_size = ipc_client_nv_data_size(client);
+ if (nv_size == 0)
+ return -1;
nv_data = ipc_nv_data_load(client);
if (nv_data == NULL) {
@@ -624,11 +618,11 @@ complete:
}
int xmm6260_mipi_mps_data_send(struct ipc_client *client, int device_fd,
- void *mps_data, int mps_size)
+ const void *mps_data, size_t mps_size)
{
int rc;
- if (client == NULL || device_fd < 0 || mps_data == NULL || mps_size <= 0)
+ if (client == NULL || device_fd < 0 || mps_data == NULL || mps_size == 0)
return -1;
rc = xmm6260_mipi_modem_data_send(device_fd, mps_data, mps_size, XMM6260_MPS_DATA_ADDRESS);
@@ -641,7 +635,7 @@ int xmm6260_mipi_mps_data_send(struct ipc_client *client, int device_fd,
int xmm6260_mipi_hw_reset_send(struct ipc_client *client, int device_fd)
{
unsigned int hw_reset_data;
- int hw_reset_size;
+ size_t hw_reset_size;
int rc;
if (client == NULL || device_fd < 0)
diff --git a/samsung-ipc/devices/xmm6260/xmm6260_mipi.h b/samsung-ipc/devices/xmm6260/xmm6260_mipi.h
index 4c9d7d2..4744369 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260_mipi.h
+++ b/samsung-ipc/devices/xmm6260/xmm6260_mipi.h
@@ -2,7 +2,7 @@
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -53,19 +53,19 @@ struct xmm6260_mipi_command_footer {
} __attribute__((packed));
int xmm6260_mipi_psi_send(struct ipc_client *client, int device_fd,
- void *psi_data, unsigned short psi_size);
+ const void *psi_data, unsigned short psi_size);
int xmm6260_mipi_ebl_send(struct ipc_client *client, int device_fd,
- void *ebl_data, int ebl_size);
+ const void *ebl_data, size_t ebl_size);
int xmm6260_mipi_port_config_send(struct ipc_client *client, int device_fd);
int xmm6260_mipi_sec_start_send(struct ipc_client *client, int device_fd,
- void *sec_data, int sec_size);
+ const void *sec_data, size_t sec_size);
int xmm6260_mipi_sec_end_send(struct ipc_client *client, int device_fd);
int xmm6260_mipi_firmware_send(struct ipc_client *client, int device_fd,
- void *firmware_data, int firmware_size);
+ const void *firmware_data, size_t firmware_size);
int xmm6260_mipi_nv_data_send(struct ipc_client *client, int device_fd);
int xmm6260_mipi_mps_data_send(struct ipc_client *client, int device_fd,
- void *mps_data, int mps_size);
+ const void *mps_data, size_t mps_size);
int xmm6260_mipi_hw_reset_send(struct ipc_client *client, int device_fd);
#endif
diff --git a/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.c b/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.c
index e7b89b3..06731a7 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.c
+++ b/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.c
@@ -2,7 +2,7 @@
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com>
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -171,34 +171,37 @@ int xmm6260_sec_modem_link_get_hostwake_wait(int device_fd)
return -1;
}
-int xmm6260_sec_modem_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request)
+int xmm6260_sec_modem_fmt_send(struct ipc_client *client,
+ struct ipc_message *message)
{
struct ipc_fmt_header header;
void *buffer;
+ size_t length;
+ size_t count;
unsigned char *p;
- int count;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || message == NULL)
return -1;
- ipc_fmt_header_fill(&header, request);
+ ipc_fmt_header_setup(&header, message);
- buffer = malloc(header.length);
+ length = header.length;
+ buffer = calloc(1, length);
memcpy(buffer, &header, sizeof(struct ipc_fmt_header));
- if (request->data != NULL && request->length > 0)
- memcpy((void *) ((unsigned char *) buffer + sizeof(struct ipc_fmt_header)), request->data, request->length);
+ if (message->data != NULL && message->size > 0)
+ memcpy((void *) ((unsigned char *) buffer + sizeof(struct ipc_fmt_header)), message->data, message->size);
- ipc_client_log_send(client, request, __func__);
+ ipc_client_log_send(client, message, __func__);
p = (unsigned char *) buffer;
count = 0;
- while (count < header.length) {
- rc = client->handlers->write(client->handlers->transport_data, p, header.length - count);
+ while (count < length) {
+ rc = client->handlers->write(client->handlers->transport_data, p, length - count);
if (rc <= 0) {
- ipc_client_log(client, "Writing FMT data to the modem failed");
+ ipc_client_log(client, "Writing FMT data failed");
goto error;
}
@@ -219,36 +222,37 @@ complete:
return rc;
}
-int xmm6260_sec_modem_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response)
+int xmm6260_sec_modem_fmt_recv(struct ipc_client *client,
+ struct ipc_message *message)
{
struct ipc_fmt_header *header;
void *buffer = NULL;
+ size_t length;
+ size_t count;
unsigned char *p;
- int length;
- int count;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || message == NULL)
return -1;
length = XMM6260_DATA_SIZE;
- buffer = malloc(length);
+ buffer = calloc(1, length);
rc = client->handlers->read(client->handlers->transport_data, buffer, length);
if (rc < (int) sizeof(struct ipc_fmt_header)) {
- ipc_client_log(client, "Reading FMT header from the modem failed");
+ ipc_client_log(client, "Reading FMT header failed");
goto error;
}
header = (struct ipc_fmt_header *) buffer;
- ipc_fmt_message_fill(header, response);
+ ipc_fmt_message_setup(header, message);
if (header->length > sizeof(struct ipc_fmt_header)) {
- response->length = header->length - sizeof(struct ipc_fmt_header);
- response->data = malloc(response->length);
+ message->size = header->length - sizeof(struct ipc_fmt_header);
+ message->data = calloc(1, message->size);
- p = (unsigned char *) response->data;
+ p = (unsigned char *) message->data;
count = rc - sizeof(struct ipc_fmt_header);
if (count > 0) {
@@ -256,10 +260,10 @@ int xmm6260_sec_modem_ipc_fmt_recv(struct ipc_client *client, struct ipc_message
p += count;
}
- while (count < (int) response->length) {
- rc = client->handlers->read(client->handlers->transport_data, p, response->length - count);
+ while (count < message->size) {
+ rc = client->handlers->read(client->handlers->transport_data, p, message->size - count);
if (rc <= 0) {
- ipc_client_log(client, "Reading FMT data from the modem failed");
+ ipc_client_log(client, "Reading FMT data failed");
goto error;
}
@@ -268,7 +272,7 @@ int xmm6260_sec_modem_ipc_fmt_recv(struct ipc_client *client, struct ipc_message
}
}
- ipc_client_log_recv(client, response, __func__);
+ ipc_client_log_recv(client, message, __func__);
rc = 0;
goto complete;
@@ -283,35 +287,37 @@ complete:
return rc;
}
-int xmm6260_sec_modem_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request)
+int xmm6260_sec_modem_rfs_send(struct ipc_client *client,
+ struct ipc_message *message)
{
struct ipc_rfs_header header;
void *buffer;
+ size_t length;
+ size_t count;
unsigned char *p;
- int count;
int rc;
-
- if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || request == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->write == NULL || message == NULL)
return -1;
- ipc_rfs_header_fill(&header, request);
+ ipc_rfs_header_setup(&header, message);
- buffer = malloc(header.length);
+ length = header.length;
+ buffer = calloc(1, length);
memcpy(buffer, &header, sizeof(struct ipc_rfs_header));
- if (request->data != NULL && request->length > 0)
- memcpy((void *) ((unsigned char *) buffer + sizeof(struct ipc_rfs_header)), request->data, request->length);
+ if (message->data != NULL && message->size > 0)
+ memcpy((void *) ((unsigned char *) buffer + sizeof(struct ipc_rfs_header)), message->data, message->size);
- ipc_client_log_send(client, request, __func__);
+ ipc_client_log_send(client, message, __func__);
p = (unsigned char *) buffer;
count = 0;
- while (count < (int) header.length) {
- rc = client->handlers->write(client->handlers->transport_data, p, header.length - count);
+ while (count < length) {
+ rc = client->handlers->write(client->handlers->transport_data, p, length - count);
if (rc <= 0) {
- ipc_client_log(client, "Writing RFS data to the modem failed");
+ ipc_client_log(client, "Writing RFS data failed");
goto error;
}
@@ -332,36 +338,37 @@ complete:
return rc;
}
-int xmm6260_sec_modem_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response)
+int xmm6260_sec_modem_rfs_recv(struct ipc_client *client,
+ struct ipc_message *message)
{
struct ipc_rfs_header *header;
void *buffer = NULL;
+ size_t length;
+ size_t count;
unsigned char *p;
- int length;
- int count;
int rc;
- if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
+ if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || message == NULL)
return -1;
length = XMM6260_DATA_SIZE;
- buffer = malloc(length);
+ buffer = calloc(1, length);
rc = client->handlers->read(client->handlers->transport_data, buffer, length);
if (rc < (int) sizeof(struct ipc_rfs_header)) {
- ipc_client_log(client, "Reading RFS header from the modem failed");
+ ipc_client_log(client, "Reading RFS header failed");
goto error;
}
header = (struct ipc_rfs_header *) buffer;
- ipc_rfs_message_fill(header, response);
+ ipc_rfs_message_setup(header, message);
if (header->length > sizeof(struct ipc_rfs_header)) {
- response->length = header->length - sizeof(struct ipc_rfs_header);
- response->data = malloc(response->length);
+ message->size = header->length - sizeof(struct ipc_rfs_header);
+ message->data = calloc(1, message->size);
- p = (unsigned char *) response->data;
+ p = (unsigned char *) message->data;
count = rc - sizeof(struct ipc_rfs_header);
if (count > 0) {
@@ -369,10 +376,10 @@ int xmm6260_sec_modem_ipc_rfs_recv(struct ipc_client *client, struct ipc_message
p += count;
}
- while (count < (int) response->length) {
- rc = client->handlers->read(client->handlers->transport_data, p, response->length - count);
+ while (count < message->size) {
+ rc = client->handlers->read(client->handlers->transport_data, p, message->size - count);
if (rc <= 0) {
- ipc_client_log(client, "Reading RFS data from the modem failed");
+ ipc_client_log(client, "Reading RFS data failed");
goto error;
}
@@ -381,7 +388,7 @@ int xmm6260_sec_modem_ipc_rfs_recv(struct ipc_client *client, struct ipc_message
}
}
- ipc_client_log_recv(client, response, __func__);
+ ipc_client_log_recv(client, message, __func__);
rc = 0;
goto complete;
@@ -396,7 +403,7 @@ complete:
return rc;
}
-int xmm6260_sec_modem_ipc_open(int type)
+int xmm6260_sec_modem_open(int type)
{
int fd;
@@ -414,7 +421,7 @@ int xmm6260_sec_modem_ipc_open(int type)
return fd;
}
-int xmm6260_sec_modem_ipc_close(int fd)
+int xmm6260_sec_modem_close(int fd)
{
if (fd < 0)
return -1;
@@ -424,7 +431,7 @@ int xmm6260_sec_modem_ipc_close(int fd)
return 0;
}
-int xmm6260_sec_modem_ipc_read(int fd, void *buffer, unsigned int length)
+int xmm6260_sec_modem_read(int fd, void *buffer, size_t length)
{
int rc;
@@ -432,10 +439,11 @@ int xmm6260_sec_modem_ipc_read(int fd, void *buffer, unsigned int length)
return -1;
rc = read(fd, buffer, length);
+
return rc;
}
-int xmm6260_sec_modem_ipc_write(int fd, void *buffer, unsigned int length)
+int xmm6260_sec_modem_write(int fd, const void *buffer, size_t length)
{
int rc;
@@ -443,10 +451,11 @@ int xmm6260_sec_modem_ipc_write(int fd, void *buffer, unsigned int length)
return -1;
rc = write(fd, buffer, length);
+
return rc;
}
-int xmm6260_sec_modem_ipc_poll(int fd, struct timeval *timeout)
+int xmm6260_sec_modem_poll(int fd, struct timeval *timeout)
{
fd_set fds;
int rc;
@@ -468,7 +477,7 @@ int xmm6260_sec_modem_ipc_poll(int fd, struct timeval *timeout)
return rc;
}
-char *xmm6260_sec_modem_ipc_gprs_get_iface(int cid)
+char *xmm6260_sec_modem_gprs_get_iface(int cid)
{
char *iface = NULL;
@@ -480,13 +489,12 @@ char *xmm6260_sec_modem_ipc_gprs_get_iface(int cid)
return iface;
}
-int xmm6260_sec_modem_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
+int xmm6260_sec_modem_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities)
{
if (capabilities == NULL)
return -1;
- capabilities->port_list = 0;
- capabilities->cid_max = XMM6260_SEC_MODEM_GPRS_IFACE_COUNT;
+ capabilities->cid_count = XMM6260_SEC_MODEM_GPRS_IFACE_COUNT;
return 0;
}
diff --git a/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.h b/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.h
index 8895fbb..d1c6fe6 100644
--- a/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.h
+++ b/samsung-ipc/devices/xmm6260/xmm6260_sec_modem.h
@@ -1,7 +1,7 @@
/*
* This file is part of libsamsung-ipc.
*
- * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,19 +40,23 @@ int xmm6260_sec_modem_link_control_active(int device_fd, int active);
int xmm6260_sec_modem_link_connected_wait(int device_fd);
int xmm6260_sec_modem_link_get_hostwake_wait(int device_fd);
-int xmm6260_sec_modem_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *request);
-int xmm6260_sec_modem_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *response);
-int xmm6260_sec_modem_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *request);
-int xmm6260_sec_modem_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *response);
-
-int xmm6260_sec_modem_ipc_open(int type);
-int xmm6260_sec_modem_ipc_close(int fd);
-int xmm6260_sec_modem_ipc_read(int fd, void *buffer, unsigned int length);
-int xmm6260_sec_modem_ipc_write(int fd, void *buffer, unsigned int length);
-int xmm6260_sec_modem_ipc_poll(int fd, struct timeval *timeout);
-
-char *xmm6260_sec_modem_ipc_gprs_get_iface(int cid);
-int xmm6260_sec_modem_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities);
+int xmm6260_sec_modem_fmt_send(struct ipc_client *client,
+ struct ipc_message *message);
+int xmm6260_sec_modem_fmt_recv(struct ipc_client *client,
+ struct ipc_message *message);
+int xmm6260_sec_modem_rfs_send(struct ipc_client *client,
+ struct ipc_message *message);
+int xmm6260_sec_modem_rfs_recv(struct ipc_client *client,
+ struct ipc_message *message);
+
+int xmm6260_sec_modem_open(int type);
+int xmm6260_sec_modem_close(int fd);
+int xmm6260_sec_modem_read(int fd, void *buffer, size_t length);
+int xmm6260_sec_modem_write(int fd, const void *buffer, size_t length);
+int xmm6260_sec_modem_poll(int fd, struct timeval *timeout);
+
+char *xmm6260_sec_modem_gprs_get_iface(int cid);
+int xmm6260_sec_modem_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabilities);
#endif