aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSimon Busch <morphis@gravedo.de>2011-10-09 18:43:28 +0200
committerSimon Busch <morphis@gravedo.de>2011-10-10 08:23:23 +0200
commit743ede5407a6e8b8baeb9c5b10cfc80d428ae847 (patch)
tree3d7d5eb9b849528c3db1f8969c775c74199287d6 /include
parent1cec835e06ddbf9d5229ff0a080e0e36106d64f3 (diff)
downloadexternal_libsamsung-ipc-743ede5407a6e8b8baeb9c5b10cfc80d428ae847.zip
external_libsamsung-ipc-743ede5407a6e8b8baeb9c5b10cfc80d428ae847.tar.gz
external_libsamsung-ipc-743ede5407a6e8b8baeb9c5b10cfc80d428ae847.tar.bz2
Rework API of this library to integrate better with other environments than Android
* send/recv is now done outside this library; the user has to provide callbacks for send and recv * it's now possible to create more than one ipc client as every ipc API method needs an object of type ipc_client (which is the context it operates in) * there are now two different client types for the crespo machine: RFS and FMT * disabled h1 client for now * removed power on/off functionality; should be done by another userland component with handling the correct sysfs nodes rather than dealing with ioctls for this. * updated vala interface description file to reflect API changes * various source code cleanups Signed-off-by: Simon Busch <morphis@gravedo.de>
Diffstat (limited to 'include')
-rw-r--r--include/radio.h38
-rw-r--r--include/util.h7
2 files changed, 28 insertions, 17 deletions
diff --git a/include/radio.h b/include/radio.h
index 209a1ef..af266b4 100644
--- a/include/radio.h
+++ b/include/radio.h
@@ -21,31 +21,31 @@
#ifndef __RADIO_H__
#define __RADIO_H__
+#include <stdint.h>
+
#include "types.h"
#include "util.h"
-#define IPC_CLIENT_TYPE_CRESPO 1
-#define IPC_CLIENT_TYPE_H1 2
+#define IPC_CLIENT_TYPE_CRESPO_FMT 1
+#define IPC_CLIENT_TYPE_CRESPO_RFS 2
+#define IPC_CLIENT_TYPE_H1 3
#define IPC_COMMAND(f) ((f->group << 8) | f->index)
#define IPC_GROUP(m) (m >> 8)
#define IPC_INDEX(m) (m & 0xff)
-/* IPC header for use by device specific code*/
struct ipc_header {
unsigned short length;
unsigned char mseq, aseq;
unsigned char group, index, type;
} __attribute__((__packed__));
-/* Request struct passed as parameter to ipc_send() */
struct ipc_request {
unsigned char mseq, aseq, group, index, type;
unsigned int length;
unsigned char *data;
};
-/* Response struct returned by ipc_recv() */
struct ipc_response {
unsigned char mseq, aseq;
unsigned short command;
@@ -54,22 +54,26 @@ struct ipc_response {
unsigned char *data;
};
-int ipc_init(int client_type);
-int ipc_boostrap(void);
-int ipc_open(void);
-int ipc_close(void);
-int ipc_fd_get(void);
+struct ipc_client;
+
+typedef int (*ipc_client_transport_cb)(uint8_t *data, unsigned int size, void *user_data);
+
+struct ipc_client *ipc_client_new(int client_type);
+int ipc_client_set_delegates(struct ipc_client *client, ipc_client_transport_cb write, void *write_data,
+ ipc_client_transport_cb read, void *read_data);
+int ipc_client_free(struct ipc_client *client);
-void ipc_power_on(void);
-void ipc_power_off(void);
+int ipc_client_bootstrap_modem(struct ipc_client *client);
+int ipc_client_open(struct ipc_client *client);
+int ipc_client_close(struct ipc_client *client);
-void ipc_send(struct ipc_request *request);
-int ipc_recv(struct ipc_response *response);
+int ipc_client_recv(struct ipc_client *client, struct ipc_response *response);
/* Convenience functions for ipc_send */
-void ipc_msg_send(const int command, const int type, unsigned char *data, const int length, unsigned char mseq);
-void ipc_msg_send_get(const int command, unsigned char aseq);
-void ipc_msg_send_exec(const int command, unsigned char aseq);
+void ipc_client_send(struct ipc_client *client, const int command, const int type, unsigned char *data,
+ const int length, unsigned char mseq);
+void ipc_client_send_get(struct ipc_client *client, const int command, unsigned char aseq);
+void ipc_client_send_exec(struct ipc_client *client, const int command, unsigned char aseq);
/* Utility functions */
const char *ipc_str(struct ipc_response *frame);
diff --git a/include/util.h b/include/util.h
index 68426ab..da9872b 100644
--- a/include/util.h
+++ b/include/util.h
@@ -18,7 +18,14 @@
*
*/
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
void hex_dump(void *data, int size);
const char *plmn_lookup(const char *plmn);
char *plmn_string(const char *plmn);
+void *mtd_read(char *mtd_name, int size, int block_size);
+void *file_read(char *file_name, int size, int block_size);
+
+#endif