aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-06-30 18:46:06 +0200
committerPaul Kocialkowski <contact@paulk.fr>2013-06-30 18:46:06 +0200
commita058b95d4603103cfa9b569756ce2592d9641c3c (patch)
tree6b0a4e26d0700041127f88ef4708164db9ddeb9a /samsung-ipc
parentc79aeafe5a44717d04fe4d14edf0ed71e7052783 (diff)
downloadexternal_libsamsung-ipc-a058b95d4603103cfa9b569756ce2592d9641c3c.zip
external_libsamsung-ipc-a058b95d4603103cfa9b569756ce2592d9641c3c.tar.gz
external_libsamsung-ipc-a058b95d4603103cfa9b569756ce2592d9641c3c.tar.bz2
Prefix per-device headers definitions with the device name
Change-Id: I90362b4fe9ecb21fd09e27d4a15a43033ed7adaf Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc')
-rw-r--r--samsung-ipc/device/aries/aries_ipc.c127
-rw-r--r--samsung-ipc/device/aries/aries_ipc.h44
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.c88
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.h20
-rw-r--r--samsung-ipc/device/xmm6160/xmm6160.c26
-rw-r--r--samsung-ipc/device/xmm6160/xmm6160.h12
6 files changed, 159 insertions, 158 deletions
diff --git a/samsung-ipc/device/aries/aries_ipc.c b/samsung-ipc/device/aries/aries_ipc.c
index 4e3d273..237aeb1 100644
--- a/samsung-ipc/device/aries/aries_ipc.c
+++ b/samsung-ipc/device/aries/aries_ipc.c
@@ -61,21 +61,21 @@ int aries_ipc_bootstrap(struct ipc_client *client)
ipc_client_log(client, "Starting aries modem bootstrap");
- modem_image_data = file_data_read(MODEM_IMAGE_DEVICE, MODEM_IMAGE_SIZE, 0x1000);
+ modem_image_data = file_data_read(ARIES_MODEM_IMAGE_DEVICE, ARIES_MODEM_IMAGE_SIZE, 0x1000);
if (modem_image_data == NULL) {
ipc_client_log(client, "Reading modem image data failed");
goto error;
}
ipc_client_log(client, "Read modem image data");
- onedram_fd = open(ONEDRAM_DEVICE, O_RDWR);
+ onedram_fd = open(ARIES_ONEDRAM_DEVICE, O_RDWR);
if (onedram_fd < 0) {
ipc_client_log(client, "Opening onedram failed");
goto error;
}
ipc_client_log(client, "Opened onedram");
- rc = network_iface_down(MODEM_NETWORK_IFACE, AF_PHONET, SOCK_DGRAM);
+ rc = network_iface_down(ARIES_MODEM_IFACE, AF_PHONET, SOCK_DGRAM);
if (rc < 0) {
ipc_client_log(client, "Turning modem network iface down failed");
goto error;
@@ -98,7 +98,7 @@ int aries_ipc_bootstrap(struct ipc_client *client)
}
ipc_client_log(client, "Powered the modem on");
- serial_fd = open(MODEM_SERIAL_DEVICE, O_RDWR | O_NDELAY);
+ serial_fd = open(ARIES_MODEM_SERIAL_DEVICE, O_RDWR | O_NDELAY);
if (serial_fd < 0) {
ipc_client_log(client, "Opening serial failed");
goto error;
@@ -107,7 +107,7 @@ int aries_ipc_bootstrap(struct ipc_client *client)
usleep(100000);
- rc = xmm6160_psi_send(client, serial_fd, modem_image_data, MODEM_IMAGE_SIZE);
+ rc = xmm6160_psi_send(client, serial_fd, modem_image_data, ARIES_MODEM_IMAGE_SIZE);
if (rc < 0) {
ipc_client_log(client, "Sending XMM6160 PSI failed");
goto error;
@@ -140,38 +140,38 @@ int aries_ipc_bootstrap(struct ipc_client *client)
ipc_client_log(client, "Reading onedram init failed");
goto error;
}
- } while (onedram_init != ONEDRAM_INIT);
+ } while (onedram_init != ARIES_ONEDRAM_INIT);
ipc_client_log(client, "Read onedram init (0x%x)", onedram_init);
- onedram_address = mmap(NULL, ONEDRAM_MEMORY_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, onedram_fd, 0);
+ onedram_address = mmap(NULL, ARIES_ONEDRAM_MEMORY_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, onedram_fd, 0);
if (onedram_address == NULL || onedram_address == (void *) 0xffffffff) {
ipc_client_log(client, "Mapping onedram to memory failed");
goto error;
}
ipc_client_log(client, "Mapped onedram to memory");
- rc = xmm6160_modem_image_send(client, -1, onedram_address, modem_image_data, MODEM_IMAGE_SIZE, 0);
+ rc = xmm6160_modem_image_send(client, -1, onedram_address, modem_image_data, ARIES_MODEM_IMAGE_SIZE, 0);
if (rc < 0) {
ipc_client_log(client, "Sending XMM6160 modem image failed");
goto error;
}
ipc_client_log(client, "Sent XMM6160 modem image");
- rc = xmm6160_nv_data_send(client, -1, onedram_address, NV_DATA_OFFSET);
+ rc = xmm6160_nv_data_send(client, -1, onedram_address, ARIES_NV_DATA_OFFSET);
if (rc < 0) {
ipc_client_log(client, "Sending XMM6160 nv_data failed");
goto error;
}
ipc_client_log(client, "Sent XMM6160 nv_data");
- munmap(onedram_address, ONEDRAM_MEMORY_SIZE);
+ munmap(onedram_address, ARIES_ONEDRAM_MEMORY_SIZE);
onedram_address = NULL;
rc = ioctl(onedram_fd, ONEDRAM_REL_SEM);
if (rc < 0)
goto error;
- onedram_magic = ONEDRAM_MAGIC;
+ onedram_magic = ARIES_ONEDRAM_MAGIC;
rc = write(onedram_fd, &onedram_magic, sizeof(onedram_magic));
if (rc < (int) sizeof(onedram_magic)) {
ipc_client_log(client, "Writing onedram magic failed");
@@ -203,7 +203,7 @@ int aries_ipc_bootstrap(struct ipc_client *client)
ipc_client_log(client, "Reading onedram deinit failed");
goto error;
}
- } while (onedram_deinit != ONEDRAM_DEINIT);
+ } while (onedram_deinit != ARIES_ONEDRAM_DEINIT);
ipc_client_log(client, "Read onedram deinit (0x%x)", onedram_deinit);
rc = 0;
@@ -220,7 +220,7 @@ complete:
close(serial_fd);
if (onedram_address != NULL)
- munmap(onedram_address, ONEDRAM_MEMORY_SIZE);
+ munmap(onedram_address, ARIES_ONEDRAM_MEMORY_SIZE);
if (onedram_fd >= 0)
close(onedram_fd);
@@ -262,9 +262,9 @@ int aries_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *respo
if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
return -1;
- buffer = malloc(MODEM_DATA_SIZE);
+ buffer = malloc(ARIES_DATA_SIZE);
- rc = client->handlers->read(client->handlers->transport_data, buffer, MODEM_DATA_SIZE);
+ rc = client->handlers->read(client->handlers->transport_data, buffer, ARIES_DATA_SIZE);
if (rc < 0) {
ipc_client_log(client, "Reading FMT data from the modem failed");
goto error;
@@ -336,7 +336,7 @@ int aries_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *respo
if (client == NULL || client->handlers == NULL || client->handlers->read == NULL || response == NULL)
return -1;
- length = MODEM_DATA_SIZE;
+ length = ARIES_DATA_SIZE;
buffer = malloc(length);
rc = client->handlers->read(client->handlers->transport_data, buffer, length);
@@ -372,9 +372,9 @@ complete:
return rc;
}
-int aries_ipc_open(void *transport_data, int type)
+int aries_ipc_open(void *data, int type)
{
- struct aries_ipc_transport_data *data;
+ struct aries_ipc_transport_data *transport_data;
struct sockaddr_pn *spn;
struct ifreq ifr;
@@ -384,16 +384,16 @@ int aries_ipc_open(void *transport_data, int type)
int fd;
int rc;
- if (transport_data == NULL)
+ if (data == NULL)
return -1;
- data = (struct aries_ipc_transport_data *) transport_data;
+ transport_data = (struct aries_ipc_transport_data *) data;
memset(data, 0, sizeof(struct aries_ipc_transport_data));
- spn = &data->spn;
+ spn = &transport_data->spn;
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, MODEM_NETWORK_IFACE, IFNAMSIZ);
+ strncpy(ifr.ifr_name, ARIES_MODEM_IFACE, IFNAMSIZ);
spn->spn_family = AF_PHONET;
spn->spn_dev = 0;
@@ -401,10 +401,10 @@ int aries_ipc_open(void *transport_data, int type)
switch (type)
{
case IPC_CLIENT_TYPE_FMT:
- spn->spn_resource = MODEM_FMT_SPN_RESSOURCE;
+ spn->spn_resource = ARIES_MODEM_FMT_SPN;
break;
case IPC_CLIENT_TYPE_RFS:
- spn->spn_resource = MODEM_RFS_SPN_RESSOURCE;
+ spn->spn_resource = ARIES_MODEM_RFS_SPN;
break;
default:
break;
@@ -431,105 +431,106 @@ int aries_ipc_open(void *transport_data, int type)
if (rc < 0)
return -1;
- data->fd = fd;
+ transport_data->fd = fd;
if (type == IPC_CLIENT_TYPE_RFS)
{
- socket_rfs_magic = MODEM_SOCKET_RFS_MAGIC;
+ socket_rfs_magic = ARIES_SOCKET_RFS_MAGIC;
rc = setsockopt(fd, SOL_SOCKET, SO_IPC_RFS, &socket_rfs_magic, sizeof(socket_rfs_magic));
if (rc < 0)
return -1;
}
- rc = network_iface_up(MODEM_NETWORK_IFACE, AF_PHONET, SOCK_DGRAM);
+ rc = network_iface_up(ARIES_MODEM_IFACE, AF_PHONET, SOCK_DGRAM);
if (rc < 0)
return -1;
return 0;
}
-int aries_ipc_close(void *transport_data)
+int aries_ipc_close(void *data)
{
- struct aries_ipc_transport_data *data;
+ struct aries_ipc_transport_data *transport_data;
int fd;
- if (transport_data == NULL)
+ if (data == NULL)
return -1;
- data = (struct aries_ipc_transport_data *) transport_data;
+ transport_data = (struct aries_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
+ transport_data->fd = -1;
close(fd);
return 0;
}
-int aries_ipc_read(void *transport_data, void *buffer, unsigned int length)
+int aries_ipc_read(void *data, void *buffer, unsigned int length)
{
- struct aries_ipc_transport_data *data;
+ struct aries_ipc_transport_data *transport_data;
int spn_size;
int fd;
int rc;
- if (transport_data == NULL || buffer == NULL || length == 0)
+ if (data == NULL || buffer == NULL || length == 0)
return -1;
- data = (struct aries_ipc_transport_data *) transport_data;
+ transport_data = (struct aries_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
spn_size = sizeof(struct sockaddr_pn);
- rc = recvfrom(fd, buffer, length, 0, (const struct sockaddr *) &data->spn, &spn_size);
+ rc = recvfrom(fd, buffer, length, 0, (const struct sockaddr *) &transport_data->spn, &spn_size);
if (rc < 0)
return -1;
return 0;
}
-int aries_ipc_write(void *transport_data, void *buffer, unsigned int length)
+int aries_ipc_write(void *data, void *buffer, unsigned int length)
{
- struct aries_ipc_transport_data *data;
+ struct aries_ipc_transport_data *transport_data;
int spn_size;
int fd;
int rc;
- if (transport_data == NULL || buffer == NULL || length == 0)
+ if (data == NULL || buffer == NULL || length == 0)
return -1;
- data = (struct aries_ipc_transport_data *) transport_data;
+ transport_data = (struct aries_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
spn_size = sizeof(struct sockaddr_pn);
- rc = sendto(fd, buffer, length, 0, (const struct sockaddr *) &data->spn, spn_size);
+ rc = sendto(fd, buffer, length, 0, (const struct sockaddr *) &transport_data->spn, spn_size);
if (rc < 0)
return -1;
return 0;
}
-int aries_ipc_poll(void *transport_data, struct timeval *timeout)
+int aries_ipc_poll(void *data, struct timeval *timeout)
{
- struct aries_ipc_transport_data *data;
+ struct aries_ipc_transport_data *transport_data;
fd_set fds;
int fd;
int rc;
- if (transport_data == NULL)
+ if (data == NULL)
return -1;
- data = (struct aries_ipc_transport_data *) transport_data;
+ transport_data = (struct aries_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
@@ -540,13 +541,13 @@ int aries_ipc_poll(void *transport_data, struct timeval *timeout)
return rc;
}
-int aries_ipc_power_on(void *power_data)
+int aries_ipc_power_on(void *data)
{
char buffer[] = "on\n";
int value;
int rc;
- value = sysfs_value_read(MODEMCTL_STATUS_SYSFS);
+ value = sysfs_value_read(ARIES_MODEMCTL_STATUS_SYSFS);
if (value < 0)
return -1;
@@ -554,20 +555,20 @@ int aries_ipc_power_on(void *power_data)
if (value == 1)
return 0;
- rc = sysfs_string_write(MODEMCTL_CONTROL_SYSFS, (char *) &buffer, strlen(buffer));
+ rc = sysfs_string_write(ARIES_MODEMCTL_CONTROL_SYSFS, (char *) &buffer, strlen(buffer));
if (rc < 0)
return -1;
return 0;
}
-int aries_ipc_power_off(void *power_data)
+int aries_ipc_power_off(void *data)
{
char buffer[] = "off\n";
int value;
int rc;
- value = sysfs_value_read(MODEMCTL_STATUS_SYSFS);
+ value = sysfs_value_read(ARIES_MODEMCTL_STATUS_SYSFS);
if (value < 0)
return -1;
@@ -575,7 +576,7 @@ int aries_ipc_power_off(void *power_data)
if (value == 0)
return 0;
- rc = sysfs_string_write(MODEMCTL_CONTROL_SYSFS, (char *) &buffer, strlen(buffer));
+ rc = sysfs_string_write(ARIES_MODEMCTL_CONTROL_SYSFS, (char *) &buffer, strlen(buffer));
if (rc < 0)
return -1;
@@ -603,22 +604,22 @@ int aries_ipc_data_destroy(void *transport_data, void *power_data, void *gprs_da
return 0;
}
-int aries_ipc_gprs_activate(void *gprs_data, int cid)
+int aries_ipc_gprs_activate(void *data, int cid)
{
int rc;
- rc = sysfs_value_write(MODEM_PDP_ACTIVATE_SYSFS, cid);
+ rc = sysfs_value_write(ARIES_MODEM_PDP_ACTIVATE_SYSFS, cid);
if (rc < 0)
return -1;
return 0;
}
-int aries_ipc_gprs_deactivate(void *gprs_data, int cid)
+int aries_ipc_gprs_deactivate(void *data, int cid)
{
int rc;
- rc = sysfs_value_write(MODEM_PDP_DEACTIVATE_SYSFS, cid);
+ rc = sysfs_value_write(ARIES_MODEM_PDP_DEACTIVATE_SYSFS, cid);
if (rc < 0)
return -1;
@@ -639,13 +640,13 @@ char *aries_ipc_gprs_get_iface(int cid)
if (fd < 0)
return NULL;
- for(i = (GPRS_IFACE_COUNT - 1); i >= 0; i--) {
- sprintf(ifr.ifr_name, "%s%d", GPRS_IFACE_PREFIX, i);
+ for(i = (ARIES_GPRS_IFACE_COUNT - 1); i >= 0; i--) {
+ sprintf(ifr.ifr_name, "%s%d", ARIES_GPRS_IFACE_PREFIX, i);
rc = ioctl(fd, SIOCGIFFLAGS, &ifr);
if(rc < 0 || ifr.ifr_flags & IFF_UP) {
continue;
} else {
- asprintf(&iface, "%s%d", GPRS_IFACE_PREFIX, i);
+ asprintf(&iface, "%s%d", ARIES_GPRS_IFACE_PREFIX, i);
return iface;
}
}
@@ -659,7 +660,7 @@ int aries_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabil
return -1;
capabilities->port_list = 1;
- capabilities->cid_max = GPRS_IFACE_COUNT;
+ capabilities->cid_max = ARIES_GPRS_IFACE_COUNT;
return 0;
}
diff --git a/samsung-ipc/device/aries/aries_ipc.h b/samsung-ipc/device/aries/aries_ipc.h
index 3e6aedc..11a1c4d 100644
--- a/samsung-ipc/device/aries/aries_ipc.h
+++ b/samsung-ipc/device/aries/aries_ipc.h
@@ -24,30 +24,30 @@
#ifndef __ARIES_IPC_H__
#define __ARIES_IPC_H__
-#define MODEM_IMAGE_SIZE 0xA00000
-#define NV_DATA_OFFSET 0xD80000
-#define ONEDRAM_MEMORY_SIZE 0xFFF000
-#define ONEDRAM_INIT 0x12341234
-#define ONEDRAM_MAGIC 0x45674567
-#define ONEDRAM_DEINIT 0xABCDABCD
-#define MODEM_DATA_SIZE 0x50000
-#define MODEM_SOCKET_RFS_MAGIC 0x80000
+#define ARIES_MODEM_IMAGE_SIZE 0xA00000
+#define ARIES_NV_DATA_OFFSET 0xD80000
+#define ARIES_ONEDRAM_MEMORY_SIZE 0xFFF000
+#define ARIES_ONEDRAM_INIT 0x12341234
+#define ARIES_ONEDRAM_MAGIC 0x45674567
+#define ARIES_ONEDRAM_DEINIT 0xABCDABCD
+#define ARIES_DATA_SIZE 0x50000
+#define ARIES_SOCKET_RFS_MAGIC 0x80000
#define SO_IPC_RFS 0x21
-#define MODEM_FMT_SPN_RESSOURCE 0x01
-#define MODEM_RFS_SPN_RESSOURCE 0x41
-
-#define MODEM_IMAGE_DEVICE "/dev/block/bml12"
-#define MODEM_SERIAL_DEVICE "/dev/s3c2410_serial3"
-#define ONEDRAM_DEVICE "/dev/onedram"
-#define MODEMCTL_STATUS_SYSFS "/sys/class/modemctl/xmm/status"
-#define MODEMCTL_CONTROL_SYSFS "/sys/class/modemctl/xmm/control"
-#define MODEM_NETWORK_IFACE "svnet0"
-#define MODEM_PDP_ACTIVATE_SYSFS "/sys/class/net/svnet0/pdp/activate"
-#define MODEM_PDP_DEACTIVATE_SYSFS "/sys/class/net/svnet0/pdp/deactivate"
-
-#define GPRS_IFACE_PREFIX "pdp"
-#define GPRS_IFACE_COUNT 3
+#define ARIES_MODEM_FMT_SPN 0x01
+#define ARIES_MODEM_RFS_SPN 0x41
+
+#define ARIES_MODEM_IMAGE_DEVICE "/dev/block/bml12"
+#define ARIES_MODEM_SERIAL_DEVICE "/dev/s3c2410_serial3"
+#define ARIES_ONEDRAM_DEVICE "/dev/onedram"
+#define ARIES_MODEMCTL_STATUS_SYSFS "/sys/class/modemctl/xmm/status"
+#define ARIES_MODEMCTL_CONTROL_SYSFS "/sys/class/modemctl/xmm/control"
+#define ARIES_MODEM_IFACE "svnet0"
+#define ARIES_MODEM_PDP_ACTIVATE_SYSFS "/sys/class/net/svnet0/pdp/activate"
+#define ARIES_MODEM_PDP_DEACTIVATE_SYSFS "/sys/class/net/svnet0/pdp/deactivate"
+
+#define ARIES_GPRS_IFACE_PREFIX "pdp"
+#define ARIES_GPRS_IFACE_COUNT 3
struct aries_ipc_transport_data {
struct sockaddr_pn spn;
diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c
index 790b09c..06ae3be 100644
--- a/samsung-ipc/device/crespo/crespo_ipc.c
+++ b/samsung-ipc/device/crespo/crespo_ipc.c
@@ -51,14 +51,14 @@ int crespo_ipc_bootstrap(struct ipc_client *client)
ipc_client_log(client, "Starting crespo modem bootstrap");
- modem_image_data = file_data_read(MODEM_IMAGE_DEVICE, MODEM_IMAGE_SIZE, 0x1000);
+ modem_image_data = file_data_read(CRESPO_MODEM_IMAGE_DEVICE, CRESPO_MODEM_IMAGE_SIZE, 0x1000);
if (modem_image_data == NULL) {
ipc_client_log(client, "Reading modem image data failed");
goto error;
}
ipc_client_log(client, "Read modem image data");
- modem_ctl_fd = open(MODEM_CTL_DEVICE, O_RDWR | O_NDELAY);
+ modem_ctl_fd = open(CRESPO_MODEM_CTL_DEVICE, O_RDWR | O_NDELAY);
if (modem_ctl_fd < 0) {
ipc_client_log(client, "Opening modem ctl failed");
goto error;
@@ -72,7 +72,7 @@ int crespo_ipc_bootstrap(struct ipc_client *client)
}
ipc_client_log(client, "Reset modem");
- serial_fd = open(MODEM_SERIAL_DEVICE, O_RDWR | O_NDELAY);
+ serial_fd = open(CRESPO_MODEM_SERIAL_DEVICE, O_RDWR | O_NDELAY);
if (serial_fd < 0) {
ipc_client_log(client, "Opening serial failed");
goto error;
@@ -81,21 +81,21 @@ int crespo_ipc_bootstrap(struct ipc_client *client)
usleep(100000);
- rc = xmm6160_psi_send(client, serial_fd, modem_image_data, MODEM_IMAGE_SIZE);
+ rc = xmm6160_psi_send(client, serial_fd, modem_image_data, CRESPO_MODEM_IMAGE_SIZE);
if (rc < 0) {
ipc_client_log(client, "Sending XMM6160 PSI failed");
goto error;
}
ipc_client_log(client, "Sent XMM6160 PSI");
- rc = xmm6160_modem_image_send(client, modem_ctl_fd, NULL, modem_image_data, MODEM_IMAGE_SIZE, 0);
+ rc = xmm6160_modem_image_send(client, modem_ctl_fd, NULL, modem_image_data, CRESPO_MODEM_IMAGE_SIZE, 0);
if (rc < 0) {
ipc_client_log(client, "Sending XMM6160 modem image failed");
goto error;
}
ipc_client_log(client, "Sent XMM6160 modem image");
- rc = xmm6160_nv_data_send(client, modem_ctl_fd, NULL, NV_DATA_OFFSET);
+ rc = xmm6160_nv_data_send(client, modem_ctl_fd, NULL, CRESPO_NV_DATA_OFFSET);
if (rc < 0) {
ipc_client_log(client, "Sending XMM6160 nv_data failed");
goto error;
@@ -158,7 +158,7 @@ int crespo_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *resp
return -1;
memset(&mio, 0, sizeof(struct modem_io));
- mio.size = MODEM_DATA_SIZE;
+ mio.size = CRESPO_DATA_SIZE;
mio.data = malloc(mio.size);
rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
@@ -226,7 +226,7 @@ int crespo_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *resp
return -1;
memset(&mio, 0, sizeof(struct modem_io));
- mio.size = MODEM_DATA_SIZE;
+ mio.size = CRESPO_DATA_SIZE;
mio.data = malloc(mio.size);
rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
@@ -260,23 +260,23 @@ complete:
return rc;
}
-int crespo_ipc_open(void *transport_data, int type)
+int crespo_ipc_open(void *data, int type)
{
- struct crespo_ipc_transport_data *data;
+ struct crespo_ipc_transport_data *transport_data;
int fd;
- if (transport_data == NULL)
+ if (data == NULL)
return -1;
- data = (struct crespo_ipc_transport_data *) transport_data;
+ transport_data = (struct crespo_ipc_transport_data *) data;
switch(type)
{
case IPC_CLIENT_TYPE_FMT:
- fd = open(MODEM_FMT_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
+ fd = open(CRESPO_MODEM_FMT_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
break;
case IPC_CLIENT_TYPE_RFS:
- fd = open(MODEM_RFS_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
+ fd = open(CRESPO_MODEM_RFS_DEVICE, O_RDWR | O_NOCTTY | O_NONBLOCK);
break;
default:
return -1;
@@ -285,43 +285,43 @@ int crespo_ipc_open(void *transport_data, int type)
if(fd < 0)
return -1;
- data->fd = fd;
+ transport_data->fd = fd;
return 0;
}
-int crespo_ipc_close(void *transport_data)
+int crespo_ipc_close(void *data)
{
- struct crespo_ipc_transport_data *data;
+ struct crespo_ipc_transport_data *transport_data;
int fd;
- if (transport_data == NULL)
+ if (data == NULL)
return -1;
- data = (struct crespo_ipc_transport_data *) transport_data;
+ transport_data = (struct crespo_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
- data->fd = -1;
+ transport_data->fd = -1;
close(fd);
return 0;
}
-int crespo_ipc_read(void *transport_data, void *buffer, unsigned int length)
+int crespo_ipc_read(void *data, void *buffer, unsigned int length)
{
- struct crespo_ipc_transport_data *data;
+ struct crespo_ipc_transport_data *transport_data;
int fd;
int rc;
- if (transport_data == NULL || buffer == NULL || length == 0)
+ if (data == NULL || buffer == NULL || length == 0)
return -1;
- data = (struct crespo_ipc_transport_data *) transport_data;
+ transport_data = (struct crespo_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
@@ -332,18 +332,18 @@ int crespo_ipc_read(void *transport_data, void *buffer, unsigned int length)
return 0;
}
-int crespo_ipc_write(void *transport_data, void *buffer, unsigned int length)
+int crespo_ipc_write(void *data, void *buffer, unsigned int length)
{
- struct crespo_ipc_transport_data *data;
+ struct crespo_ipc_transport_data *transport_data;
int fd;
int rc;
- if (transport_data == NULL || buffer == NULL || length == 0)
+ if (data == NULL || buffer == NULL || length == 0)
return -1;
- data = (struct crespo_ipc_transport_data *) transport_data;
+ transport_data = (struct crespo_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
@@ -354,19 +354,19 @@ int crespo_ipc_write(void *transport_data, void *buffer, unsigned int length)
return 0;
}
-int crespo_ipc_poll(void *transport_data, struct timeval *timeout)
+int crespo_ipc_poll(void *data, struct timeval *timeout)
{
- struct crespo_ipc_transport_data *data;
+ struct crespo_ipc_transport_data *transport_data;
fd_set fds;
int fd;
int rc;
- if (transport_data == NULL)
+ if (data == NULL)
return -1;
- data = (struct crespo_ipc_transport_data *) transport_data;
+ transport_data = (struct crespo_ipc_transport_data *) data;
- fd = data->fd;
+ fd = transport_data->fd;
if (fd < 0)
return -1;
@@ -377,12 +377,12 @@ int crespo_ipc_poll(void *transport_data, struct timeval *timeout)
return rc;
}
-int crespo_ipc_power_on(void *power_data)
+int crespo_ipc_power_on(void *data)
{
int fd;
int rc;
- fd = open(MODEM_CTL_DEVICE, O_RDWR);
+ fd = open(CRESPO_MODEM_CTL_DEVICE, O_RDWR);
if (fd < 0)
return -1;
@@ -396,12 +396,12 @@ int crespo_ipc_power_on(void *power_data)
return 0;
}
-int crespo_ipc_power_off(void *power_data)
+int crespo_ipc_power_off(void *data)
{
int fd;
int rc;
- fd = open(MODEM_CTL_DEVICE, O_RDWR);
+ fd = open(CRESPO_MODEM_CTL_DEVICE, O_RDWR);
if (fd < 0)
return -1;
@@ -440,7 +440,7 @@ char *crespo_ipc_gprs_get_iface_single(int cid)
{
char *iface = NULL;
- asprintf(&iface, "%s%d", GPRS_IFACE_PREFIX, 0);
+ asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0);
return iface;
}
@@ -460,10 +460,10 @@ char *crespo_ipc_gprs_get_iface(int cid)
{
char *iface = NULL;
- if (cid > GPRS_IFACE_COUNT)
+ if (cid > CRESPO_GPRS_IFACE_COUNT)
return NULL;
- asprintf(&iface, "%s%d", GPRS_IFACE_PREFIX, cid - 1);
+ asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, cid - 1);
return iface;
}
@@ -474,7 +474,7 @@ int crespo_ipc_gprs_get_capabilities(struct ipc_client_gprs_capabilities *capabi
return -1;
capabilities->port_list = 0;
- capabilities->cid_max = GPRS_IFACE_COUNT;
+ capabilities->cid_max = CRESPO_GPRS_IFACE_COUNT;
return 0;
}
diff --git a/samsung-ipc/device/crespo/crespo_ipc.h b/samsung-ipc/device/crespo/crespo_ipc.h
index 1750d97..d1bc785 100644
--- a/samsung-ipc/device/crespo/crespo_ipc.h
+++ b/samsung-ipc/device/crespo/crespo_ipc.h
@@ -21,18 +21,18 @@
#ifndef __CRESPO_IPC_H__
#define __CRESPO_IPC_H__
-#define MODEM_IMAGE_SIZE 0xD80000
-#define NV_DATA_OFFSET 0xD80000
-#define MODEM_DATA_SIZE 0x50000
+#define CRESPO_MODEM_IMAGE_SIZE 0xD80000
+#define CRESPO_NV_DATA_OFFSET 0xD80000
+#define CRESPO_DATA_SIZE 0x50000
-#define MODEM_IMAGE_DEVICE "/dev/mtd/mtd5ro"
-#define MODEM_SERIAL_DEVICE "/dev/s3c2410_serial3"
-#define MODEM_CTL_DEVICE "/dev/modem_ctl"
-#define MODEM_FMT_DEVICE "/dev/modem_fmt"
-#define MODEM_RFS_DEVICE "/dev/modem_rfs"
+#define CRESPO_MODEM_IMAGE_DEVICE "/dev/mtd/mtd5ro"
+#define CRESPO_MODEM_SERIAL_DEVICE "/dev/s3c2410_serial3"
+#define CRESPO_MODEM_CTL_DEVICE "/dev/modem_ctl"
+#define CRESPO_MODEM_FMT_DEVICE "/dev/modem_fmt"
+#define CRESPO_MODEM_RFS_DEVICE "/dev/modem_rfs"
-#define GPRS_IFACE_PREFIX "rmnet"
-#define GPRS_IFACE_COUNT 3
+#define CRESPO_GPRS_IFACE_PREFIX "rmnet"
+#define CRESPO_GPRS_IFACE_COUNT 3
struct crespo_ipc_transport_data {
int fd;
diff --git a/samsung-ipc/device/xmm6160/xmm6160.c b/samsung-ipc/device/xmm6160/xmm6160.c
index 11e3ec5..22bc050 100644
--- a/samsung-ipc/device/xmm6160/xmm6160.c
+++ b/samsung-ipc/device/xmm6160/xmm6160.c
@@ -33,7 +33,7 @@
int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
void *modem_image_data, int modem_image_size)
{
- char modem_at[] = MODEM_AT;
+ char at[] = XMM6160_AT;
unsigned char version;
unsigned char info;
unsigned char psi_magic;
@@ -50,7 +50,7 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
int rc;
int i;
- if (client == NULL || serial_fd < 0 || modem_image_data == NULL || modem_image_size < MODEM_PSI_SIZE)
+ if (client == NULL || serial_fd < 0 || modem_image_data == NULL || modem_image_size < XMM6160_PSI_SIZE)
return -1;
tcgetattr(serial_fd, &termios);
@@ -61,9 +61,9 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
tcsetattr(serial_fd, TCSANOW, &termios);
- length = strlen(modem_at);
- for (i=0; i < MODEM_AT_COUNT; i++) {
- rc = write(serial_fd, modem_at, length);
+ length = strlen(at);
+ for (i=0; i < XMM6160_AT_COUNT; i++) {
+ rc = write(serial_fd, at, length);
if (rc < length) {
ipc_client_log(client, "Writing AT in ASCII failed");
goto error;
@@ -83,7 +83,7 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
goto error;
}
- if (version != MODEM_BOOTCORE_VERSION) {
+ if (version != XMM6160_BOOTCORE_VERSION) {
ipc_client_log(client, "Read wrong bootcore version (0x%x)", version);
goto error;
}
@@ -97,7 +97,7 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
}
ipc_client_log(client, "Read info size (0x%x)", info);
- psi_magic = MODEM_PSI_MAGIC;
+ psi_magic = XMM6160_PSI_MAGIC;
rc = write(serial_fd, &psi_magic, sizeof(psi_magic));
if (rc < (int) sizeof(psi_magic)) {
@@ -106,7 +106,7 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
}
ipc_client_log(client, "Wrote PSI magic (0x%x)", psi_magic);
- psi_size = MODEM_PSI_SIZE;
+ psi_size = XMM6160_PSI_SIZE;
rc = write(serial_fd, &psi_size, sizeof(psi_size));
if (rc < (int) sizeof(psi_size)) {
@@ -124,7 +124,7 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
p = (unsigned char *) modem_image_data;
psi_crc = 0;
- for (i=0; i < MODEM_PSI_SIZE; i++) {
+ for (i=0; i < XMM6160_PSI_SIZE; i++) {
rc = select(serial_fd + 1, NULL, &fds, NULL, &timeout);
if (rc <= 0) {
ipc_client_log(client, "Writing PSI failed");
@@ -175,7 +175,7 @@ int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
ipc_client_log(client, "Reading PSI ACK failed");
goto error;
}
- } while (psi_ack != MODEM_PSI_ACK);
+ } while (psi_ack != XMM6160_PSI_ACK);
ipc_client_log(client, "Read PSI ACK (0x%x)", psi_ack);
rc = 0;
@@ -198,11 +198,11 @@ int xmm6160_modem_image_send(struct ipc_client *client, int device_fd,
int rc;
int i;
- if (client == NULL || (device_fd < 0 && device_address == NULL) || modem_image_data == NULL || modem_image_size <= MODEM_PSI_SIZE)
+ if (client == NULL || (device_fd < 0 && device_address == NULL) || modem_image_data == NULL || modem_image_size <= XMM6160_PSI_SIZE)
return -1;
- p = (unsigned char *) modem_image_data + MODEM_PSI_SIZE;
- length = modem_image_size - MODEM_PSI_SIZE;
+ p = (unsigned char *) modem_image_data + XMM6160_PSI_SIZE;
+ length = modem_image_size - XMM6160_PSI_SIZE;
if (device_address != NULL) {
memcpy((void *) ((unsigned char *) device_address + modem_image_offset), p, length);
diff --git a/samsung-ipc/device/xmm6160/xmm6160.h b/samsung-ipc/device/xmm6160/xmm6160.h
index e48323d..6bd1b2c 100644
--- a/samsung-ipc/device/xmm6160/xmm6160.h
+++ b/samsung-ipc/device/xmm6160/xmm6160.h
@@ -23,12 +23,12 @@
#ifndef __XMM6160_H__
#define __XMM6160_H__
-#define MODEM_AT "AT"
-#define MODEM_AT_COUNT 20
-#define MODEM_PSI_SIZE 0x5000
-#define MODEM_PSI_MAGIC 0x30
-#define MODEM_PSI_ACK 0x01
-#define MODEM_BOOTCORE_VERSION 0xF0
+#define XMM6160_AT "AT"
+#define XMM6160_AT_COUNT 20
+#define XMM6160_PSI_SIZE 0x5000
+#define XMM6160_PSI_MAGIC 0x30
+#define XMM6160_PSI_ACK 0x01
+#define XMM6160_BOOTCORE_VERSION 0xF0
int xmm6160_psi_send(struct ipc_client *client, int serial_fd,
void *modem_image_data, int modem_image_size);