aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/radio.h8
-rw-r--r--samsung-ipc/device/aries/aries_ipc.c4
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.c6
-rw-r--r--samsung-ipc/device/galaxys2/galaxys2_loader.c2
-rw-r--r--samsung-ipc/device/h1/h1_ipc.c4
-rw-r--r--samsung-ipc/device/maguro/maguro_loader.c2
-rw-r--r--samsung-ipc/ipc_util.c24
-rw-r--r--samsung-ipc/rfs.c16
8 files changed, 34 insertions, 32 deletions
diff --git a/include/radio.h b/include/radio.h
index 399cdf2..7a3ccf4 100644
--- a/include/radio.h
+++ b/include/radio.h
@@ -71,6 +71,7 @@ int ipc_client_set_handlers(struct ipc_client *client, struct ipc_handlers *hand
int ipc_client_set_io_handlers(struct ipc_client *client,
ipc_io_handler_cb read, void *read_data,
ipc_io_handler_cb write, void *write_data);
+
int ipc_client_set_handlers_common_data(struct ipc_client *client, void *data);
void *ipc_client_get_handlers_common_data(struct ipc_client *client);
int ipc_client_create_handlers_common_data(struct ipc_client *client);
@@ -105,9 +106,10 @@ void ipc_client_log_send(struct ipc_client *client,
const char *ipc_response_type_to_str(int type);
const char *ipc_request_type_to_str(int type);
const char *ipc_command_to_str(int command);
-void ipc_hex_dump(struct ipc_client *client, void *data, int size);
-void *ipc_mtd_read(struct ipc_client *client, char *mtd_name, int size, int block_size);
-void *ipc_file_read(struct ipc_client *client, char *file_name, int size, int block_size);
+
+void ipc_client_hex_dump(struct ipc_client *client, void *data, int size);
+void *ipc_client_mtd_read(struct ipc_client *client, char *mtd_name, int size, int block_size);
+void *ipc_client_file_read(struct ipc_client *client, char *file_name, int size, int block_size);
#endif
diff --git a/samsung-ipc/device/aries/aries_ipc.c b/samsung-ipc/device/aries/aries_ipc.c
index ee61c5f..64b85bd 100644
--- a/samsung-ipc/device/aries/aries_ipc.c
+++ b/samsung-ipc/device/aries/aries_ipc.c
@@ -137,7 +137,7 @@ int aries_modem_bootstrap(struct ipc_client *client)
/* Read the radio.img image. */
ipc_client_log(client, "aries_ipc_bootstrap: reading radio image");
- radio_img_p = ipc_mtd_read(client, "/dev/block/bml12", RADIO_IMG_READ_SIZE, RADIO_IMG_READ_SIZE);
+ radio_img_p = ipc_client_mtd_read(client, "/dev/block/bml12", RADIO_IMG_READ_SIZE, RADIO_IMG_READ_SIZE);
ipc_client_log(client, "aries_ipc_bootstrap: radio image read");
ipc_client_log(client, "aries_ipc_bootstrap: open onedram");
@@ -356,7 +356,7 @@ int aries_modem_bootstrap(struct ipc_client *client)
/* Write nv_data.bin to modem_ctl. */
ipc_client_log(client, "aries_ipc_bootstrap: write nv_data to onedram");
- nv_data_p = ipc_file_read(client, nv_data_path(client), nv_data_size(client), nv_data_chunk_size(client));
+ nv_data_p = ipc_client_file_read(client, nv_data_path(client), nv_data_size(client), nv_data_chunk_size(client));
if (nv_data_p == NULL)
goto error;
data_p = nv_data_p;
diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c
index aeac266..c79d71a 100644
--- a/samsung-ipc/device/crespo/crespo_ipc.c
+++ b/samsung-ipc/device/crespo/crespo_ipc.c
@@ -102,9 +102,9 @@ int crespo_modem_bootstrap(struct ipc_client *client)
/* Read the radio.img image. */
ipc_client_log(client, "crespo_ipc_bootstrap: reading radio image");
- radio_img_p = ipc_mtd_read(client, "/dev/mtd/mtd5ro", RADIO_IMG_SIZE, 0x1000);
+ radio_img_p = ipc_client_mtd_read(client, "/dev/mtd/mtd5ro", RADIO_IMG_SIZE, 0x1000);
if (radio_img_p == NULL) {
- radio_img_p = ipc_mtd_read(client, "/dev/mtd5ro", RADIO_IMG_SIZE, 0x1000);
+ radio_img_p = ipc_client_mtd_read(client, "/dev/mtd5ro", RADIO_IMG_SIZE, 0x1000);
if (radio_img_p == NULL)
goto error;
}
@@ -267,7 +267,7 @@ int crespo_modem_bootstrap(struct ipc_client *client)
/* Write nv_data.bin to modem_ctl. */
ipc_client_log(client, "crespo_ipc_bootstrap: write nv_data to modem_ctl");
- nv_data_p = ipc_file_read(client, nv_data_path(client), nv_data_size(client), nv_data_chunk_size(client));
+ nv_data_p = ipc_client_file_read(client, nv_data_path(client), nv_data_size(client), nv_data_chunk_size(client));
if (nv_data_p == NULL)
goto error;
data_p = nv_data_p;
diff --git a/samsung-ipc/device/galaxys2/galaxys2_loader.c b/samsung-ipc/device/galaxys2/galaxys2_loader.c
index cb44e0a..575a4db 100644
--- a/samsung-ipc/device/galaxys2/galaxys2_loader.c
+++ b/samsung-ipc/device/galaxys2/galaxys2_loader.c
@@ -438,7 +438,7 @@ static int galaxys2_send_secure_images(struct ipc_client *client,
nv_data_check(client);
nv_data_md5_check(client);
- nv_data = ipc_file_read(client, nv_data_path(client), 2 << 20, 1024);
+ nv_data = ipc_client_file_read(client, nv_data_path(client), 2 << 20, 1024);
if (nv_data == NULL) {
ipc_client_log(client, "Error: failed to read NVDATA image");
goto fail;
diff --git a/samsung-ipc/device/h1/h1_ipc.c b/samsung-ipc/device/h1/h1_ipc.c
index 8e20dd2..ca7fd6a 100644
--- a/samsung-ipc/device/h1/h1_ipc.c
+++ b/samsung-ipc/device/h1/h1_ipc.c
@@ -129,7 +129,7 @@ int h1_ipc_send(struct ipc_client *client, struct ipc_message_info *request)
ipc_command_to_str(IPC_COMMAND(request)),
ipc_response_type_to_str(request->type));
- ipc_hex_dump(client, frame, frame_length);
+ ipc_client_hex_dump(client, frame, frame_length);
client->handlers->write(frame, frame_length, client->handlers->write_data);
@@ -172,7 +172,7 @@ int h1_ipc_recv(struct ipc_client *client, struct ipc_message_info *response)
ipc_command_to_str(IPC_COMMAND(response)),
ipc_response_type_to_str(response->type));
- ipc_hex_dump(client, data, num_read-1);
+ ipc_client_hex_dump(client, data, num_read-1);
return 0;
}
diff --git a/samsung-ipc/device/maguro/maguro_loader.c b/samsung-ipc/device/maguro/maguro_loader.c
index 4d15e04..717c949 100644
--- a/samsung-ipc/device/maguro/maguro_loader.c
+++ b/samsung-ipc/device/maguro/maguro_loader.c
@@ -538,7 +538,7 @@ static int maguro_send_image_addrs(struct ipc_client *client,
nv_data_check(client);
nv_data_md5_check(client);
- nv_data = ipc_file_read(client, nv_data_path(client), 2 << 20, 1024);
+ nv_data = ipc_client_file_read(client, nv_data_path(client), 2 << 20, 1024);
if (nv_data == NULL) {
ipc_client_log(client, "Error: failed to read NVDATA image");
goto fail;
diff --git a/samsung-ipc/ipc_util.c b/samsung-ipc/ipc_util.c
index 500f4a1..e4740bf 100644
--- a/samsung-ipc/ipc_util.c
+++ b/samsung-ipc/ipc_util.c
@@ -45,7 +45,7 @@ void ipc_client_log_recv(struct ipc_client *client,
#ifdef DEBUG
if (response->length > 0) {
ipc_client_log(client, "==== FMT DATA DUMP ====");
- ipc_hex_dump(client, (void *) response->data,
+ ipc_client_hex_dump(client, (void *) response->data,
response->length > 0x100 ? 0x100 : response->length);
}
#endif
@@ -57,7 +57,7 @@ void ipc_client_log_recv(struct ipc_client *client,
#ifdef DEBUG
if (response->length > 0) {
ipc_client_log(client, "==== RFS DATA DUMP ====");
- ipc_hex_dump(client, (void *) response->data,
+ ipc_client_hex_dump(client, (void *) response->data,
response->length > 0x100 ? 0x100 : response->length);
}
#endif
@@ -78,7 +78,7 @@ void ipc_client_log_send(struct ipc_client *client,
#ifdef DEBUG
if (request->length > 0) {
ipc_client_log(client, "==== FMT DATA DUMP ====");
- ipc_hex_dump(client, (void *) request->data,
+ ipc_client_hex_dump(client, (void *) request->data,
request->length > 0x100 ? 0x100 : request->length);
}
#endif
@@ -90,7 +90,7 @@ void ipc_client_log_send(struct ipc_client *client,
#ifdef DEBUG
if (request->length > 0) {
ipc_client_log(client, "==== RFS DATA DUMP ====");
- ipc_hex_dump(client, (void *) request->data,
+ ipc_client_hex_dump(client, (void *) request->data,
request->length > 0x100 ? 0x100 : request->length);
}
#endif
@@ -253,7 +253,7 @@ const char *ipc_command_to_str(int command) {
}
}
-void ipc_hex_dump(struct ipc_client *client, void *data, int size)
+void ipc_client_hex_dump(struct ipc_client *client, void *data, int size)
{
/* dumps size bytes of *data to stdout. Looks like:
* [0000] 75 6E 6B 6E 6F 77 6E 20
@@ -307,7 +307,7 @@ void ipc_hex_dump(struct ipc_client *client, void *data, int size)
}
}
-void *ipc_mtd_read(struct ipc_client *client, char *mtd_name, int size, int block_size)
+void *ipc_client_mtd_read(struct ipc_client *client, char *mtd_name, int size, int block_size)
{
void *mtd_p=NULL;
uint8_t *data_p=NULL;
@@ -319,7 +319,7 @@ void *ipc_mtd_read(struct ipc_client *client, char *mtd_name, int size, int bloc
if (mtd_name == NULL || size <= 0 || block_size <= 0)
goto error;
- ipc_client_log(client, "ipc_mtd_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, mtd_name, block_size);
+ ipc_client_log(client, "ipc_client_mtd_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, mtd_name, block_size);
fd=open(mtd_name, O_RDONLY);
if (fd < 0)
@@ -338,7 +338,7 @@ void *ipc_mtd_read(struct ipc_client *client, char *mtd_name, int size, int bloc
offs = i * block_size;
if (ioctl(fd, MEMGETBADBLOCK, &offs) == 1)
{
- ipc_client_log(client, "ipc_mtd_read: warning: bad block at offset %lld\n", (long long int) offs);
+ ipc_client_log(client, "ipc_client_mtd_read: warning: bad block at offset %lld\n", (long long int) offs);
data_p+=block_size;
continue;
}
@@ -352,11 +352,11 @@ void *ipc_mtd_read(struct ipc_client *client, char *mtd_name, int size, int bloc
return mtd_p;
error:
- ipc_client_log(client, "ipc_mtd_read: something went wrong\n");
+ ipc_client_log(client, "ipc_client_mtd_read: something went wrong\n");
return NULL;
}
-void *ipc_file_read(struct ipc_client *client, char *file_name, int size, int block_size)
+void *ipc_client_file_read(struct ipc_client *client, char *file_name, int size, int block_size)
{
void *file_p=NULL;
uint8_t *data_p=NULL;
@@ -367,7 +367,7 @@ void *ipc_file_read(struct ipc_client *client, char *file_name, int size, int bl
if (file_name == NULL || size <= 0 || block_size <= 0)
goto error;
- ipc_client_log(client, "ipc_file_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, file_name, block_size);
+ ipc_client_log(client, "ipc_client_file_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, file_name, block_size);
fd=open(file_name, O_RDONLY);
if (fd < 0)
@@ -392,7 +392,7 @@ void *ipc_file_read(struct ipc_client *client, char *file_name, int size, int bl
return file_p;
error:
- ipc_client_log(client, "ipc_file_read: something went wrong\n");
+ ipc_client_log(client, "ipc_client_file_read: something went wrong\n");
return NULL;
}
diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c
index d6483cb..edf2fb3 100644
--- a/samsung-ipc/rfs.c
+++ b/samsung-ipc/rfs.c
@@ -158,7 +158,7 @@ void nv_data_md5_generate(struct ipc_client *client)
ipc_client_log(client, "nv_data_md5_generate: enter\n");
ipc_client_log(client, "nv_data_md5_generate: generating MD5 hash\n");
- nv_data_p=ipc_file_read(client, nv_data_path(client),
+ nv_data_p=ipc_client_file_read(client, nv_data_path(client),
nv_data_size(client), nv_data_chunk_size(client));
nv_data_md5_compute(nv_data_p, nv_data_size(client), nv_data_secret(client), nv_data_md5_hash);
free(nv_data_p);
@@ -236,7 +236,7 @@ void nv_data_backup_create(struct ipc_client *client)
memset(nv_data_md5_hash_string, 0, MD5_STRING_SIZE);
/* Read the content of the backup file. */
- nv_data_p=ipc_file_read(client, nv_data_path(client),
+ nv_data_p=ipc_client_file_read(client, nv_data_path(client),
nv_data_size(client), nv_data_chunk_size(client));
/* Compute the backup file MD5 hash. */
@@ -308,7 +308,7 @@ nv_data_backup_create_write:
}
/* Read the newly-written .nv_data.bak. */
- nv_data_bak_p=ipc_file_read(client, nv_data_bak_path(client),
+ nv_data_bak_p=ipc_client_file_read(client, nv_data_bak_path(client),
nv_data_size(client), nv_data_chunk_size(client));
/* Compute the MD5 hash for nv_data.bin. */
@@ -398,7 +398,7 @@ void nv_data_backup_restore(struct ipc_client *client)
memset(nv_data_md5_hash_string, 0, MD5_STRING_SIZE);
/* Read the content of the backup file. */
- nv_data_bak_p=ipc_file_read(client, nv_data_bak_path(client),
+ nv_data_bak_p=ipc_client_file_read(client, nv_data_bak_path(client),
nv_data_size(client), nv_data_chunk_size(client));
/* Compute the backup file MD5 hash. */
@@ -471,7 +471,7 @@ nv_data_backup_restore_write:
}
/* Read the newly-written nv_data.bin. */
- nv_data_p=ipc_file_read(client, nv_data_path(client),
+ nv_data_p=ipc_client_file_read(client, nv_data_path(client),
nv_data_size(client), nv_data_chunk_size(client));
/* Compute the MD5 hash for nv_data.bin. */
@@ -585,7 +585,7 @@ void nv_data_md5_check(struct ipc_client *client)
memset(nv_data_md5_hash_read, 0, MD5_STRING_SIZE);
memset(nv_data_md5_hash_string, 0, MD5_STRING_SIZE);
- nv_data_p=ipc_file_read(client, nv_data_path(client),
+ nv_data_p=ipc_client_file_read(client, nv_data_path(client),
nv_data_size(client), nv_data_chunk_size(client));
data_p=nv_data_p;
@@ -726,7 +726,7 @@ void ipc_rfs_send_io_confirm_for_nv_read_item(struct ipc_client *client, struct
#ifdef DEBUG
ipc_client_log(client, "Read rfs_data dump:");
- ipc_hex_dump(client, rfs_data, rfs_io->length);
+ ipc_client_hex_dump(client, rfs_data, rfs_io->length);
#endif
ipc_client_log(client, "Preparing RFS IO Confirm message (rc is %d)", rc);
@@ -755,7 +755,7 @@ void ipc_rfs_send_io_confirm_for_nv_write_item(struct ipc_client *client, struct
#ifdef DEBUG
ipc_client_log(client, "Write rfs_data dump:");
- ipc_hex_dump(client, rfs_data, rfs_io->length);
+ ipc_client_hex_dump(client, rfs_data, rfs_io->length);
#endif
ipc_client_log(client, "Asked to write 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);