device: Buffer has length and tail is footer
authorPaul Kocialkowski <contact@paulk.fr>
Sun, 26 Jan 2014 09:54:45 +0000 (10:54 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Sun, 26 Jan 2014 09:54:45 +0000 (10:54 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
samsung-ipc/device/aries/aries_ipc.c
samsung-ipc/device/aries/aries_ipc.h
samsung-ipc/device/crespo/crespo_ipc.c
samsung-ipc/device/crespo/crespo_ipc.h
samsung-ipc/device/xmm6260/xmm6260_mipi.c
samsung-ipc/device/xmm6260/xmm6260_mipi.h

index 3db1d4d..97df116 100644 (file)
@@ -268,7 +268,7 @@ int aries_ipc_fmt_send(struct ipc_client *client, struct ipc_message_info *reque
     p = (unsigned char *) buffer;
 
     while (count < length) {
-        chunk = length - count < ARIES_DATA_SIZE ? length - count : ARIES_DATA_SIZE;
+        chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
 
         rc = client->handlers->write(client->handlers->transport_data, p, chunk);
         if (rc < 0) {
@@ -306,7 +306,7 @@ 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;
 
-    length = ARIES_DATA_SIZE;
+    length = ARIES_BUFFER_LENGTH;
     buffer = malloc(length);
 
     rc = client->handlers->read(client->handlers->transport_data, buffer, length);
@@ -334,7 +334,7 @@ int aries_ipc_fmt_recv(struct ipc_client *client, struct ipc_message_info *respo
     p = (unsigned char *) response->data + count;
 
     while (count < length) {
-        chunk = length - count < ARIES_DATA_SIZE ? length - count : ARIES_DATA_SIZE;
+        chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
 
         rc = client->handlers->read(client->handlers->transport_data, p, chunk);
         if (rc < 0) {
@@ -390,7 +390,7 @@ int aries_ipc_rfs_send(struct ipc_client *client, struct ipc_message_info *reque
     p = (unsigned char *) buffer;
 
     while (count < length) {
-        chunk = length - count < ARIES_DATA_SIZE ? length - count : ARIES_DATA_SIZE;
+        chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
 
         rc = client->handlers->write(client->handlers->transport_data, p, chunk);
         if (rc < 0) {
@@ -428,7 +428,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 = ARIES_DATA_SIZE;
+    length = ARIES_BUFFER_LENGTH;
     buffer = malloc(length);
 
     rc = client->handlers->read(client->handlers->transport_data, buffer, length);
@@ -456,7 +456,7 @@ int aries_ipc_rfs_recv(struct ipc_client *client, struct ipc_message_info *respo
     p = (unsigned char *) response->data + count;
 
     while (count < length) {
-        chunk = length - count < ARIES_DATA_SIZE ? length - count : ARIES_DATA_SIZE;
+        chunk = length - count < ARIES_BUFFER_LENGTH ? length - count : ARIES_BUFFER_LENGTH;
 
         rc = client->handlers->read(client->handlers->transport_data, p, chunk);
         if (rc < 0) {
index 93efda6..e410dd2 100644 (file)
@@ -31,7 +31,7 @@
 #define ARIES_ONEDRAM_MAGIC                                     0x45674567
 #define ARIES_ONEDRAM_DEINIT                                    0xABCDABCD
 #define ARIES_SOCKET_RFS_MAGIC                                  0x80000
-#define ARIES_DATA_SIZE                                         4032
+#define ARIES_BUFFER_LENGTH                                     4032
 
 #define SO_IPC_RFS                                              0x21
 #define ARIES_MODEM_FMT_SPN                                     0x01
index 1bbab53..457cd48 100644 (file)
@@ -179,7 +179,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 = CRESPO_DATA_SIZE;
+    mio.size = CRESPO_BUFFER_LENGTH;
     mio.data = malloc(mio.size);
 
     rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
@@ -263,7 +263,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 = CRESPO_DATA_SIZE;
+    mio.size = CRESPO_BUFFER_LENGTH;
     mio.data = malloc(mio.size);
 
     rc = client->handlers->read(client->handlers->transport_data, &mio, sizeof(struct modem_io) + mio.size);
index 3c40387..85bf21d 100644 (file)
@@ -23,7 +23,7 @@
 #define CRESPO_MODEM_IMAGE_SIZE                                 0xD80000
 #define CRESPO_PSI_SIZE                                         0x5000
 #define CRESPO_MODEM_CTL_NV_DATA_OFFSET                         0xD80000
-#define CRESPO_DATA_SIZE                                        0x50000
+#define CRESPO_BUFFER_LENGTH                                    0x50000
 
 #define CRESPO_MODEM_IMAGE_DEVICE               "/dev/mtd/mtd5ro"
 #define CRESPO_MODEM_SERIAL_DEVICE              "/dev/s3c2410_serial3"
index 0390656..df31755 100644 (file)
@@ -302,11 +302,11 @@ complete:
 }
 
 int xmm6260_mipi_command_send(int device_fd, unsigned short code,
-    void *data, int size, int ack, int short_tail)
+    void *data, int size, int ack, int short_footer)
 {
     struct xmm6260_mipi_command_header header;
-    struct xmm6260_mipi_command_tail tail;
-    int tail_size;
+    struct xmm6260_mipi_command_footer footer;
+    int footer_size;
     void *buffer = NULL;
     int length;
 
@@ -327,20 +327,20 @@ int xmm6260_mipi_command_send(int device_fd, unsigned short code,
     header.code = code;
     header.data_size = size;
 
-    tail.checksum = (size & 0xffff) + code;
-    tail.magic = XMM6260_MIPI_COMMAND_TAIL_MAGIC;
-    tail.unknown = XMM6260_MIPI_COMMAND_TAIL_UNKNOWN;
+    footer.checksum = (size & 0xffff) + code;
+    footer.magic = XMM6260_MIPI_COMMAND_FOOTER_MAGIC;
+    footer.unknown = XMM6260_MIPI_COMMAND_FOOTER_UNKNOWN;
 
     p = (unsigned char *) data;
 
     for (i = 0; i < size; i++)
-        tail.checksum += *p++;
+        footer.checksum += *p++;
 
-    tail_size = sizeof(tail);
-    if (short_tail)
-        tail_size -= sizeof(short);
+    footer_size = sizeof(footer);
+    if (short_footer)
+        footer_size -= sizeof(short);
 
-    length = sizeof(header) + size + tail_size;
+    length = sizeof(header) + size + footer_size;
     buffer = malloc(length);
 
     p = (unsigned char *) buffer;
@@ -348,7 +348,7 @@ int xmm6260_mipi_command_send(int device_fd, unsigned short code,
     p += sizeof(header);
     memcpy(p, data, size);
     p += size;
-    memcpy(p, &tail, tail_size);
+    memcpy(p, &footer, footer_size);
 
     rc = write(device_fd, buffer, length);
     if (rc < length)
index b492f0e..4c9d7d2 100644 (file)
@@ -30,8 +30,8 @@
 #define XMM6260_MIPI_EBL_CHUNK                                  0xDFC
 #define XMM6260_MIPI_MODEM_DATA_CHUNK                           0xDF2
 #define XMM6260_MIPI_COMMAND_HEADER_MAGIC                       0x02
-#define XMM6260_MIPI_COMMAND_TAIL_MAGIC                         0x03
-#define XMM6260_MIPI_COMMAND_TAIL_UNKNOWN                       0xEAEA
+#define XMM6260_MIPI_COMMAND_FOOTER_MAGIC                       0x03
+#define XMM6260_MIPI_COMMAND_FOOTER_UNKNOWN                     0xEAEA
 
 struct xmm6260_mipi_psi_header {
     unsigned char padding;
@@ -46,7 +46,7 @@ struct xmm6260_mipi_command_header {
     unsigned short data_size;
 } __attribute__((packed));
 
-struct xmm6260_mipi_command_tail {
+struct xmm6260_mipi_command_footer {
     unsigned short checksum;
     unsigned short magic;
     unsigned short unknown;