aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/devices/maguro
diff options
context:
space:
mode:
Diffstat (limited to 'samsung-ipc/devices/maguro')
-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
2 files changed, 65 insertions, 94 deletions
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