From ee07816f176f68aeac4d7671f95074370354dbaa Mon Sep 17 00:00:00 2001 From: Pranav Mahesh Phansalkar Date: Sun, 7 Dec 2025 19:54:46 +0530 Subject: [PATCH] qmi-framework: Unify API naming and error handling conventions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Standardize the QMI Common Client Interface (CCI) and QMI Common Service Interface (CSI) APIs to follow consistent naming patterns and error handling approaches. This change improves code readability, maintainability, and developer experience by: 1. Renaming files to follow consistent naming patterns: - qmi_client.h → qmi_cci.h - qcsi.h → qmi_csi.h 2. Standardizing API function names with consistent prefixes: - Client APIs use qmi_cci_* prefix (e.g., qmi_cci_init, qmi_cci_send_msg) - Service APIs use qmi_csi_* prefix (e.g., qmi_csi_register, qmi_csi_send_resp) 3. Converting error code definitions from preprocessor macros to enums in the client interface for improved type safety and debugging, matching the approach already used in the service interface. Signed-off-by: Pranav Mahesh Phansalkar --- Makefile.am | 4 +- include/{qmi_client.h => qmi_cci.h} | 147 ++++++++++++------------ include/{qcsi.h => qmi_csi.h} | 92 +++++++-------- qcci/Makefile.am | 2 +- qcci/{qcci.c => qcci_common.c} | 134 ++++++++++----------- qcci/{qcci_internal.h => qcci_common.h} | 8 +- qcci/qcci_os.c | 4 +- qcci/qcci_xport_qrtr.c | 6 +- qcsi/qcsi_common.c | 88 +++++++------- qcsi/qcsi_common.h | 16 +-- qcsi/qcsi_xport_qrtr.c | 16 +-- tests/qcci_test.c | 50 ++++---- tests/qcsi_test.c | 6 +- tests/qcsi_test_ping.c | 32 +++--- 14 files changed, 303 insertions(+), 302 deletions(-) rename include/{qmi_client.h => qmi_cci.h} (92%) rename include/{qcsi.h => qmi_csi.h} (92%) rename qcci/{qcci.c => qcci_common.c} (95%) rename qcci/{qcci_internal.h => qcci_common.h} (98%) diff --git a/Makefile.am b/Makefile.am index b8fb5ab..266cdb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,10 +6,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include ACLOCAL_AMFLAGS = -I m4 pkginclude_HEADERS = \ include/common_v01.h \ - include/qcsi.h \ + include/qmi_csi.h \ include/qcsi_target_ext.h \ include/qmi_cci_target_ext.h \ - include/qmi_client.h \ + include/qmi_cci.h \ include/qmi_idl_lib.h \ include/qmi_idl_lib_internal.h SUBDIRS = common qencdec qcci qcsi tests diff --git a/include/qmi_client.h b/include/qmi_cci.h similarity index 92% rename from include/qmi_client.h rename to include/qmi_cci.h index c880bb5..4247b5e 100644 --- a/include/qmi_client.h +++ b/include/qmi_cci.h @@ -23,24 +23,25 @@ extern "C" { #endif -#define QMI_NO_ERR 0 -#define QMI_INTERNAL_ERR (-1) -#define QMI_SERVICE_ERR (-2) -#define QMI_TIMEOUT_ERR (-3) -#define QMI_EXTENDED_ERR (-4) -#define QMI_PORT_NOT_OPEN_ERR (-5) -#define QMI_MEMCOPY_ERROR (-13) -#define QMI_INVALID_TXN (-14) -#define QMI_CLIENT_ALLOC_FAILURE (-15) -#define QMI_CLIENT_TRANSPORT_ERR (-16) -#define QMI_CLIENT_PARAM_ERR (-17) -#define QMI_CLIENT_INVALID_CLNT (-18) -#define QMI_CLIENT_FW_NOT_UP (-19) -#define QMI_CLIENT_INVALID_SIG (-20) -#define QMI_XPORT_BUSY_ERR (-21) +typedef enum { + QMI_NO_ERR = 0, + QMI_INTERNAL_ERR = -1, + QMI_SERVICE_ERR = -2, + QMI_TIMEOUT_ERR = -3, + QMI_EXTENDED_ERR = -4, + QMI_PORT_NOT_OPEN_ERR = -5, + QMI_MEMCOPY_ERROR = -13, + QMI_INVALID_TXN = -14, + QMI_CLIENT_ALLOC_FAILURE = -15, + QMI_CLIENT_TRANSPORT_ERR = -16, + QMI_CLIENT_PARAM_ERR = -17, + QMI_CLIENT_INVALID_CLNT = -18, + QMI_CLIENT_FW_NOT_UP = -19, + QMI_CLIENT_INVALID_SIG = -20, + QMI_XPORT_BUSY_ERR = -21 +} qmi_cci_error_type; typedef struct qmi_client_struct *qmi_client_type; -typedef int qmi_client_error_type; typedef void *qmi_txn_handle; /** Magic instance ID for .. to indicate that no preference on instance ID */ @@ -102,7 +103,7 @@ typedef void (*qmi_client_log_cb) unsigned int txn_id, const void *raw_msg, unsigned int raw_msg_len, - qmi_client_error_type status, + qmi_cci_error_type status, void *cookie ); @@ -173,7 +174,7 @@ typedef void (*qmi_client_recv_raw_msg_async_cb) void *resp_buf, unsigned int resp_buf_len, void *resp_cb_data, - qmi_client_error_type transp_err + qmi_cci_error_type transp_err ); /*============================================================================= @@ -202,7 +203,7 @@ typedef void (*qmi_client_recv_msg_async_cb) void *resp_c_struct, unsigned int resp_c_struct_len, void *resp_cb_data, - qmi_client_error_type transp_err + qmi_cci_error_type transp_err ); /*============================================================================= @@ -249,12 +250,12 @@ typedef void (*qmi_client_ind_cb) typedef void (*qmi_client_error_cb) ( qmi_client_type user_handle, - qmi_client_error_type error, + qmi_cci_error_type error, void *err_cb_data ); /*=========================================================================== - FUNCTION qmi_client_notifier_init + FUNCTION qmi_cci_notifier_init ===========================================================================*/ /*! @brief @@ -283,8 +284,8 @@ typedef void (*qmi_client_error_cb) registered */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_notifier_init +extern qmi_cci_error_type +qmi_cci_notifier_init ( qmi_idl_service_object_type service_obj, qmi_client_os_params *os_params, @@ -292,7 +293,7 @@ qmi_client_notifier_init ); /*=========================================================================== - FUNCTION qmi_client_init + FUNCTION qmi_cci_init ===========================================================================*/ /*! @brief @@ -322,8 +323,8 @@ qmi_client_notifier_init - QMI connection is opened with the service */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_init +extern qmi_cci_error_type +qmi_cci_init ( qmi_service_info *service_info, qmi_idl_service_object_type service_obj, @@ -336,7 +337,7 @@ qmi_client_init /*=========================================================================== - FUNCTION qmi_client_send_raw_msg_async + FUNCTION qmi_cci_send_raw_msg_async ===========================================================================*/ /*! @brief @@ -366,8 +367,8 @@ qmi_client_init - Side Effects */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_send_raw_msg_async +extern qmi_cci_error_type +qmi_cci_send_raw_msg_async ( qmi_client_type user_handle, unsigned int msg_id, @@ -382,7 +383,7 @@ qmi_client_send_raw_msg_async /*=========================================================================== - FUNCTION qmi_client_send_msg_async + FUNCTION qmi_cci_send_msg_async ===========================================================================*/ /*! @brief @@ -415,8 +416,8 @@ qmi_client_send_raw_msg_async */ /*=========================================================================*/ -qmi_client_error_type -qmi_client_send_msg_async +qmi_cci_error_type +qmi_cci_send_msg_async ( qmi_client_type user_handle, unsigned int msg_id, @@ -431,7 +432,7 @@ qmi_client_send_msg_async /*=========================================================================== - FUNCTION qmi_client_delete_async_txn + FUNCTION qmi_cci_delete_async_txn ===========================================================================*/ /*! @brief @@ -456,8 +457,8 @@ qmi_client_send_msg_async by the "users_rsp_cb" callback up until this routine returns. */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_delete_async_txn +extern qmi_cci_error_type +qmi_cci_delete_async_txn ( qmi_client_type user_handle, qmi_txn_handle async_txn_handle @@ -465,7 +466,7 @@ qmi_client_delete_async_txn /*=========================================================================== - FUNCTION qmi_client_send_raw_msg_sync + FUNCTION qmi_cci_send_raw_msg_sync ===========================================================================*/ /*! @brief @@ -495,8 +496,8 @@ qmi_client_delete_async_txn - None */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_send_raw_msg_sync +extern qmi_cci_error_type +qmi_cci_send_raw_msg_sync ( qmi_client_type user_handle, unsigned int msg_id, @@ -510,7 +511,7 @@ qmi_client_send_raw_msg_sync /*=========================================================================== - FUNCTION qmi_client_send_msg_sync + FUNCTION qmi_cci_send_msg_sync ===========================================================================*/ /*! @brief @@ -539,8 +540,8 @@ qmi_client_send_raw_msg_sync - None */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_send_msg_sync +extern qmi_cci_error_type +qmi_cci_send_msg_sync ( qmi_client_type user_handle, unsigned int msg_id, @@ -552,7 +553,7 @@ qmi_client_send_msg_sync ); /*=========================================================================== - FUNCTION qmi_client_release_async + FUNCTION qmi_cci_release_async ===========================================================================*/ /*! @brief @@ -577,8 +578,8 @@ qmi_client_send_msg_sync - None */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_release_async +extern qmi_cci_error_type +qmi_cci_release_async ( qmi_client_type user_handle, qmi_client_release_cb release_cb, @@ -586,7 +587,7 @@ qmi_client_release_async ); /*=========================================================================== - FUNCTION qmi_client_release + FUNCTION qmi_cci_release ===========================================================================*/ /*! @brief @@ -606,8 +607,8 @@ qmi_client_release_async - None */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_release +extern qmi_cci_error_type +qmi_cci_release ( qmi_client_type user_handle ); @@ -615,7 +616,7 @@ qmi_client_release /*=========================================================================== - FUNCTION qmi_client_message_encode + FUNCTION qmi_cci_message_encode ===========================================================================*/ /*! @brief @@ -636,8 +637,8 @@ qmi_client_release @retval QMI_NO_ERR Success @retval QMI_IDL_... Error, see error codes defined in qmi.h*/ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_message_encode +extern qmi_cci_error_type +qmi_cci_message_encode ( qmi_client_type user_handle, qmi_idl_type_of_message_type req_resp_ind, @@ -650,7 +651,7 @@ qmi_client_message_encode ); /*=========================================================================== - FUNCTION qmi_client_message_decode + FUNCTION qmi_cci_message_decode ===========================================================================*/ /*! @brief @@ -670,8 +671,8 @@ qmi_client_message_encode @retval QMI_IDL_... Error, see error codes defined in qmi.h */ /*=========================================================================*/ -extern qmi_client_error_type -qmi_client_message_decode +extern qmi_cci_error_type +qmi_cci_message_decode ( qmi_client_type user_handle, qmi_idl_type_of_message_type req_resp_ind, @@ -683,7 +684,7 @@ qmi_client_message_decode ); /*=========================================================================== - FUNCTION qmi_client_get_service_list + FUNCTION qmi_cci_get_service_list ===========================================================================*/ /*! @brief @@ -708,8 +709,8 @@ qmi_client_message_decode */ /*=========================================================================*/ -qmi_client_error_type -qmi_client_get_service_list +qmi_cci_error_type +qmi_cci_get_service_list ( qmi_idl_service_object_type service_obj, qmi_service_info *service_info_array, @@ -718,7 +719,7 @@ qmi_client_get_service_list ); /*=========================================================================== - FUNCTION qmi_client_get_any_service + FUNCTION qmi_cci_get_any_service ===========================================================================*/ /*! @brief @@ -739,15 +740,15 @@ qmi_client_get_service_list - service_info may be written */ /*=========================================================================*/ -qmi_client_error_type -qmi_client_get_any_service +qmi_cci_error_type +qmi_cci_get_any_service ( qmi_idl_service_object_type service_obj, qmi_service_info *service_info ); /*=========================================================================== - FUNCTION qmi_client_get_service_instance + FUNCTION qmi_cci_get_service_instance ===========================================================================*/ /*! @brief @@ -770,8 +771,8 @@ qmi_client_get_any_service - service_info may be written */ /*=========================================================================*/ -qmi_client_error_type -qmi_client_get_service_instance +qmi_cci_error_type +qmi_cci_get_service_instance ( qmi_idl_service_object_type service_obj, qmi_service_instance instance_id, @@ -779,7 +780,7 @@ qmi_client_get_service_instance ); /*=========================================================================== - FUNCTION qmi_client_get_instance_id + FUNCTION qmi_cci_get_instance_id ===========================================================================*/ /*! @brief @@ -794,15 +795,15 @@ qmi_client_get_service_instance error code if not successful */ /*=========================================================================*/ -qmi_client_error_type -qmi_client_get_instance_id +qmi_cci_error_type +qmi_cci_get_instance_id ( qmi_service_info *service_info, qmi_service_instance *instance_id ); /*=========================================================================== - FUNCTION qmi_client_register_error_cb + FUNCTION qmi_cci_register_error_cb ===========================================================================*/ /*! @brief @@ -819,7 +820,7 @@ qmi_client_get_instance_id QMI_INTERNAL_ERR Invalid input parameters */ /*=========================================================================*/ -qmi_client_error_type qmi_client_register_error_cb +qmi_cci_error_type qmi_cci_register_error_cb ( qmi_client_type user_handle, qmi_client_error_cb err_cb, @@ -827,7 +828,7 @@ qmi_client_error_type qmi_client_register_error_cb ); /*=========================================================================== - FUNCTION qmi_client_register_notify_cb + FUNCTION qmi_cci_register_notify_cb ===========================================================================*/ /*! @brief @@ -844,7 +845,7 @@ qmi_client_error_type qmi_client_register_error_cb QMI_INTERNAL_ERR Invalid input parameters */ /*=========================================================================*/ -qmi_client_error_type qmi_client_register_notify_cb +qmi_cci_error_type qmi_cci_register_notify_cb ( qmi_client_type user_handle, qmi_client_notify_cb notify_cb, @@ -852,7 +853,7 @@ qmi_client_error_type qmi_client_register_notify_cb ); /*=========================================================================== - FUNCTION qmi_client_register_log_cb + FUNCTION qmi_cci_register_log_cb ===========================================================================*/ /*! @brief @@ -869,7 +870,7 @@ qmi_client_error_type qmi_client_register_notify_cb QMI_INTERNAL_ERR Invalid input parameters */ /*=========================================================================*/ -qmi_client_error_type qmi_client_register_log_cb +qmi_cci_error_type qmi_cci_register_log_cb ( qmi_client_type user_handle, qmi_client_log_cb notify_cb, @@ -877,7 +878,7 @@ qmi_client_error_type qmi_client_register_log_cb ); /*=========================================================================== - FUNCTION qmi_client_init_instance + FUNCTION qmi_cci_init_instance ===========================================================================*/ /*! @brief @@ -916,7 +917,7 @@ qmi_client_error_type qmi_client_register_log_cb */ /*=========================================================================*/ -qmi_client_error_type qmi_client_init_instance +qmi_cci_error_type qmi_cci_init_instance ( qmi_idl_service_object_type service_obj, qmi_service_instance instance_id, diff --git a/include/qcsi.h b/include/qmi_csi.h similarity index 92% rename from include/qcsi.h rename to include/qmi_csi.h index 4fa9a9d..92872c9 100755 --- a/include/qcsi.h +++ b/include/qmi_csi.h @@ -29,7 +29,7 @@ typedef enum { QCSI_DECODE_ERR, QCSI_NO_MEM, QCSI_INTERNAL_ERR -} qcsi_error; +} qmi_csi_error_type; typedef enum { QCSI_CB_NO_ERR = 0, @@ -213,13 +213,13 @@ typedef struct qcsi_options_struct qcsi_options; identify different services. @param[in] service_cookie Service specific data. Service cookie is registered with the infrastructure during - service registration(qcsi_register). + service registration(qmi_csi_register). @param[out] connection_handle Services return this handle as a token to represent this client connection to the service. @retval QCSI_CB_NO_ERR Success -@retval QCSI_CB..... Look into the enumeration qcsi_error for +@retval QCSI_CB..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ @@ -243,9 +243,9 @@ typedef qcsi_cb_error (*qcsi_connect) disconnecting. @param[in] service_cookie Service specific data.Service cookie is registered with the infrastructure during - service registration(qcsi_register). + service registration(qmi_csi_register). @retval QCSI_CB_NO_ERR Success -@retval QCSI_CB..... Look into the enumeration qcsi_error for +@retval QCSI_CB..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ @@ -275,11 +275,11 @@ typedef void (*qcsi_disconnect) @param[in] req_c_struct_len Length of the c struct. @param[in] service_cookie Service specific data.Service cookie is registered with the infrastructure during - service registration(qcsi_register). + service registration(qmi_csi_register). @retval QCSI_CB_NO_ERR Success -@retval QCSI_CB..... Look into the enumeration qcsi_error for +@retval QCSI_CB..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ @@ -308,7 +308,7 @@ typedef qcsi_cb_error (*qcsi_process_req) qcsi_connect. @param[in] service_cookie Service specific data. Service cookie is registered with the infrastructure during - service registration(qcsi_register). + service registration(qmi_csi_register). represent this client connection to the service. @@ -358,7 +358,7 @@ typedef void (*qcsi_log_msg) /*============================================================================= - FUNCTION qcsi_register + FUNCTION qmi_csi_register =============================================================================*/ /*! @brief @@ -375,13 +375,13 @@ typedef void (*qcsi_log_msg) @param[out] service_provider Handle that infra provides to represent this service connection. @retval QCSI_NO_ERR Success -@retval qcsi_..... Look into the enumeration qcsi_error for +@retval qcsi_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_register +qmi_csi_error_type +qmi_csi_register ( qmi_idl_service_object_type service_obj, qcsi_connect service_connect, @@ -394,7 +394,7 @@ qcsi_register /*============================================================================= - FUNCTION qcsi_register_with_options + FUNCTION qmi_csi_register_with_options =============================================================================*/ /*! @brief @@ -412,13 +412,13 @@ qcsi_register @param[out] service_provider Handle that infra provides to represent this service connection. @retval QCSI_NO_ERR Success -@retval QCSI_..... Look into the enumeration qcsi_error for +@retval QCSI_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_register_with_options +qmi_csi_error_type +qmi_csi_register_with_options ( qmi_idl_service_object_type service_obj, qcsi_connect service_connect, @@ -436,7 +436,7 @@ qcsi_register_with_options /*! @brief Handle event after the server thread receives an event notification. - Callbacks from qcsi_register may be invoked in the server's context. + Callbacks from qmi_csi_register may be invoked in the server's context. @param[in] service_provider Opaque handle that defines the service. @param[in] os_params OS-defined parameters such as file handle. @@ -446,15 +446,15 @@ qcsi_register_with_options */ /*=========================================================================*/ -qcsi_error -qcsi_handle_event +qmi_csi_error_type +qmi_csi_handle_event ( qcsi_service_handle service_provider, qcsi_os_params *os_params ); /*============================================================================= - FUNCTION qcsi_send_resp + FUNCTION qmi_csi_send_resp =============================================================================*/ /*! @brief @@ -468,12 +468,12 @@ qcsi_handle_event @param[in] resp_c_struct_len Size of the response c struct. @retval QCSI_NO_ERR Success. -@retval qcsi_..... Look into the enumeration qcsi_error for +@retval qcsi_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_send_resp +qmi_csi_error_type +qmi_csi_send_resp ( qmi_req_handle req_handle, unsigned int msg_id, @@ -482,7 +482,7 @@ qcsi_send_resp ); /*============================================================================= - FUNCTION qcsi_send_resp_raw + FUNCTION qmi_csi_send_resp_raw =============================================================================*/ /*! @brief @@ -496,12 +496,12 @@ qcsi_send_resp @param[in] resp_buf_len Size of the response buffer @retval QCSI_NO_ERR Success. -@retval QCSI_..... Look into the enumeration qcsi_error for +@retval QCSI_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_send_resp_raw +qmi_csi_error_type +qmi_csi_send_resp_raw ( qmi_req_handle req_handle, unsigned int msg_id, @@ -510,7 +510,7 @@ qcsi_send_resp_raw ); /*============================================================================= - FUNCTION qcsi_send_ind + FUNCTION qmi_csi_send_ind =============================================================================*/ /*! @brief @@ -523,12 +523,12 @@ qcsi_send_resp_raw @param[in] ind_c_struct_len Size of the indication c struct @retval QCSI_NO_ERR Success. -@retval QCSI_..... Look into the enumeration qcsi_error for +@retval QCSI_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_send_ind +qmi_csi_error_type +qmi_csi_send_ind ( qmi_client_handle client_handle, unsigned int msg_id, @@ -537,7 +537,7 @@ qcsi_send_ind ); /*============================================================================= - FUNCTION qcsi_send_ind_raw + FUNCTION qmi_csi_send_ind_raw =============================================================================*/ /*! @brief @@ -550,12 +550,12 @@ qcsi_send_ind @param[in] ind_buf_len Size of the indication buffer. @retval QCSI_NO_ERR Success. -@retval QCSI_..... Look into the enumeration qcsi_error for +@retval QCSI_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_send_ind_raw +qmi_csi_error_type +qmi_csi_send_ind_raw ( qmi_client_handle client_handle, unsigned int msg_id, @@ -564,7 +564,7 @@ qcsi_send_ind_raw ); /*============================================================================= - FUNCTION qcsi_send_broadcast_ind + FUNCTION qmi_csi_send_broadcast_ind =============================================================================*/ /*! @brief @@ -579,13 +579,13 @@ qcsi_send_ind_raw @param[in] ind_c_struct_len Size of the broadcast indication @retval QCSI_NO_ERR Success -@retval QCSI_..... Look into the enumeration qcsi_error for +@retval QCSI_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_send_broadcast_ind +qmi_csi_error_type +qmi_csi_send_broadcast_ind ( qcsi_service_handle service_provider, unsigned int msg_id, @@ -608,13 +608,13 @@ qcsi_send_broadcast_ind @param[in] ind_buf_len Size of the broadcast indication @retval qcsi_NO_ERR Success -@retval QCSI_..... Look into the enumeration qcsi_error for +@retval QCSI_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_send_broadcast_ind_raw +qmi_csi_error_type +qmi_csi_send_broadcast_ind_raw ( qcsi_service_handle service_provider, unsigned int msg_id, @@ -629,15 +629,15 @@ qcsi_send_broadcast_ind_raw @brief Unregisters a server. -@param[in] service_provider Handle given in the qcsi_register by +@param[in] service_provider Handle given in the qmi_csi_register by the service. @retval QCSI_NO_ERR Success -@retval QCSI_..... Look into the enumeration qcsi_error for +@retval QCSI_..... Look into the enumeration qmi_csi_error_type for the error values. */ /*=========================================================================*/ -qcsi_error -qcsi_unregister +qmi_csi_error_type +qmi_csi_unregister ( qcsi_service_handle service_provider ); diff --git a/qcci/Makefile.am b/qcci/Makefile.am index 820cd91..8133d40 100644 --- a/qcci/Makefile.am +++ b/qcci/Makefile.am @@ -38,7 +38,7 @@ endif library_includedir = $(pkgincludedir) noinst_HEADERS = $(h_sources) -c_sources = qcci.c \ +c_sources = qcci_common.c \ qcci_os.c \ qcci_xport_qrtr.c diff --git a/qcci/qcci.c b/qcci/qcci_common.c similarity index 95% rename from qcci/qcci.c rename to qcci/qcci_common.c index 73697e6..1f73370 100644 --- a/qcci/qcci.c +++ b/qcci/qcci_common.c @@ -10,15 +10,15 @@ * indications. * * @note - * qmi_client_init() needs to be called before sending or receiving any + * qmi_cci_init() needs to be called before sending or receiving any * service-specific messages. */ #include -#include "qmi_client.h" +#include "qmi_cci.h" #include "qmi_idl_lib.h" #include "qmi_idl_lib_internal.h" #include "qcci_os.h" -#include "qcci_internal.h" +#include "qcci_common.h" /** * @brief Macro for copying OS parameters. @@ -199,13 +199,13 @@ static void qcci_log_rx( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -static qmi_client_error_type qcci_service_info_get( +static qmi_cci_error_type qcci_service_info_get( qmi_idl_service_object_type service_obj, uint32_t *service_id, uint32_t *idl_version, uint32_t *max_msg_len) { - qmi_client_error_type rc; + qmi_cci_error_type rc; if (!service_obj) return QMI_CLIENT_PARAM_ERR; @@ -246,17 +246,17 @@ static qmi_client_error_type qcci_service_info_get( * @retval QMI_SERVICE_ERR Service error. * @retval QMI_CLIENT_ALLOC_FAILURE Allocation failure. */ -static qmi_client_error_type qcci_service_lookup( +static qmi_cci_error_type qcci_service_lookup( qcci_client_type *clnt, qcci_service_info *svc) { qmi_service_info *service_array = NULL; unsigned int num_entries = 0, num_services = 0, i; - qmi_client_error_type rc; + qmi_cci_error_type rc; /* redo lookup to make sure the server actually exits */ while (1) { - rc = qmi_client_get_service_list(clnt->service_obj, + rc = qmi_cci_get_service_list(clnt->service_obj, service_array, &num_entries, &num_services); if (rc != QMI_NO_ERR) { if (service_array) { @@ -392,7 +392,7 @@ static void qcci_client_unlink(qcci_client_type *clnt) * @note The client handle will be inserted into the client list. * The pointer MUST be freed using qcci_client_free() only. */ -static qmi_client_error_type qcci_client_alloc( +static qmi_cci_error_type qcci_client_alloc( qmi_idl_service_object_type service_obj, qcci_client_category_type category, qmi_client_os_params *os_params, @@ -593,7 +593,7 @@ static void qcci_client_put_ref(qcci_client_type *clnt) * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_TRANSPORT_ERR Transport error. */ -static qmi_client_error_type qcci_client_xport_open( +static qmi_cci_error_type qcci_client_xport_open( qcci_client_type *clnt, uint32_t service_id, uint32_t idl_version, @@ -716,7 +716,7 @@ static void qcci_txn_put_ref( * * @note The transaction is added to the client's outstanding transaction list. */ -static qmi_client_error_type qcci_get_txn( +static qmi_cci_error_type qcci_get_txn( qcci_client_type *clnt, qcci_txn_enum_type type, unsigned int msg_id, @@ -780,12 +780,12 @@ static qmi_client_error_type qcci_get_txn( * * @note Caller must have a reference to the client structure. */ -static qmi_client_error_type qcci_remove_txn( +static qmi_cci_error_type qcci_remove_txn( qcci_client_type *clnt, qcci_txn_type *txn) { qcci_txn_type *i; - qmi_client_error_type rc = QMI_INTERNAL_ERR; + qmi_cci_error_type rc = QMI_INTERNAL_ERR; if (!clnt || !txn) return rc; @@ -853,7 +853,7 @@ static void qcci_txn_handle_error( */ static void qcci_client_txns_cleanup( qcci_client_type *clnt, - qmi_client_error_type error) + qmi_cci_error_type error) { qcci_txn_type *txn; @@ -902,7 +902,7 @@ static void qcci_client_txns_cleanup( * @retval QMI_NO_ERR Success. * @retval QMI_INTERNAL_ERR Internal error. */ -static qmi_client_error_type qcci_txn_rx_process_resp( +static qmi_cci_error_type qcci_txn_rx_process_resp( qcci_client_type *clnt, uint16_t txn_id, uint16_t msg_id, @@ -976,7 +976,7 @@ static qmi_client_error_type qcci_txn_rx_process_resp( * * @retval QMI_NO_ERR Success. */ -static qmi_client_error_type qcci_txn_rx_process_ind( +static qmi_cci_error_type qcci_txn_rx_process_ind( qcci_client_type *clnt, uint16_t msg_id, uint8_t *buf, @@ -1087,7 +1087,7 @@ static void qcci_flush_tx_q(qcci_client_type *clnt) * The caller should free the buffer only if this function returns error. * The caller should provide buffers which are allocated on the heap only. */ -static qmi_client_error_type qcci_msg_send( +static qmi_cci_error_type qcci_msg_send( qcci_client_type *clnt, qcci_txn_type *txn, void *msg, @@ -1152,7 +1152,7 @@ static qmi_client_error_type qcci_msg_send( * @retval QMI_CLIENT_ALLOC_FAILURE Allocation failure. * @retval QMI_IDL_LIB_NO_ERR IDL library error. */ -static qmi_client_error_type qcci_msg_encode_and_send( +static qmi_cci_error_type qcci_msg_encode_and_send( qcci_client_type *clnt, qcci_txn_type *txn, void *c_struct, @@ -1229,11 +1229,11 @@ static qmi_client_error_type qcci_msg_encode_and_send( * * @note The caller is required to hold a reference to the client structure. */ -static qmi_client_error_type qcci_response_wait_loop( +static qmi_cci_error_type qcci_response_wait_loop( qcci_txn_type *txn, unsigned int timeout_msecs) { - qmi_client_error_type ret = QMI_NO_ERR; + qmi_cci_error_type ret = QMI_NO_ERR; do { QMI_CCI_OS_SIGNAL_WAIT(&txn->signal, timeout_msecs); @@ -1274,7 +1274,7 @@ static qmi_client_error_type qcci_response_wait_loop( * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -static qmi_client_error_type qcci_send_msg_async( +static qmi_cci_error_type qcci_send_msg_async( qmi_client_type user_handle, unsigned int msg_id, void *req, @@ -1288,7 +1288,7 @@ static qmi_client_error_type qcci_send_msg_async( { qcci_client_type *clnt; qcci_txn_type *txn = NULL; - qmi_client_error_type rc; + qmi_cci_error_type rc; if (!resp) return QMI_CLIENT_PARAM_ERR; @@ -1383,7 +1383,7 @@ static qmi_client_error_type qcci_send_msg_async( * * @note The caller must have obtained a reference to the client handle. */ -static qmi_client_error_type qcci_send_msg_sync( +static qmi_cci_error_type qcci_send_msg_sync( qmi_client_type user_handle, unsigned int msg_id, void *req, @@ -1396,7 +1396,7 @@ static qmi_client_error_type qcci_send_msg_sync( { qcci_client_type *clnt; qcci_txn_type *txn; - qmi_client_error_type rc; + qmi_cci_error_type rc; clnt = qcci_client_get_ref(user_handle, 0); if(!clnt) @@ -1414,7 +1414,7 @@ static qmi_client_error_type qcci_send_msg_sync( *resp_recv_len = txn->reply_len; } - qmi_client_delete_async_txn(user_handle, txn); + qmi_cci_delete_async_txn(user_handle, txn); qcci_txn_put_ref(clnt, txn); clnt_put_ref_bail: @@ -1423,9 +1423,9 @@ static qmi_client_error_type qcci_send_msg_sync( } /** - * @brief Internal callback function used by qmi_client_release(). + * @brief Internal callback function used by qmi_cci_release(). * - * This function is an internal callback used by qmi_client_release() to unblock + * This function is an internal callback used by qmi_cci_release() to unblock * the release process. * * @param[in] cb_data Pointer to callback data. @@ -1456,7 +1456,7 @@ static void qcci_client_release_cb_internal(void *cb_data) * * @note The caller must have obtained a reference to the client handle. */ -qmi_client_error_type qcci_client_cmn_init( +qmi_cci_error_type qcci_client_cmn_init( qmi_service_info *service_info, qmi_idl_service_object_type service_obj, qmi_client_ind_cb ind_cb, @@ -1468,7 +1468,7 @@ qmi_client_error_type qcci_client_cmn_init( qcci_service_info *svc = (qcci_service_info *)service_info; qcci_client_type *clnt; uint32_t service_id, idl_version, max_msg_len; - qmi_client_error_type rc; + qmi_cci_error_type rc; if (!user_handle) return QMI_CLIENT_PARAM_ERR; @@ -1631,7 +1631,7 @@ void qcci_xport_resume(qcci_client_type *clnt) * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_INTERNAL_ERR Internal error. */ -qmi_client_error_type qcci_xport_recv( +qmi_cci_error_type qcci_xport_recv( qcci_client_type *clnt, void *addr, uint8_t *buf, @@ -1758,7 +1758,7 @@ void qcci_xport_event_server_error( * @note This function is NOT re-enterable or thread safe. The only safe place * to call this is during initialization. */ -qmi_client_error_type qcci_init( +qmi_cci_error_type qcci_init( qcci_xport_ops_type *xport_ops, void *xport_data) { @@ -1791,7 +1791,7 @@ qmi_client_error_type qcci_init( * @note This function is NOT re-enterable or thread safe. The only safe place * to call this is during library de-initialization. */ -qmi_client_error_type qcci_deinit(void) +qmi_cci_error_type qcci_deinit(void) { if (qcci_fw_inited) { qcci_fw_inited = 0; @@ -1815,7 +1815,7 @@ qmi_client_error_type qcci_deinit(void) * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -qmi_client_error_type qmi_client_notifier_init( +qmi_cci_error_type qmi_cci_notifier_init( qmi_idl_service_object_type service_obj, qmi_client_os_params *os_params, qmi_client_type *user_handle) @@ -1839,7 +1839,7 @@ qmi_client_error_type qmi_client_notifier_init( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -qmi_client_error_type qmi_client_init( +qmi_cci_error_type qmi_cci_init( qmi_service_info *service_info, qmi_idl_service_object_type service_obj, qmi_client_ind_cb ind_cb, @@ -1870,7 +1870,7 @@ qmi_client_error_type qmi_client_init( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -qmi_client_error_type qmi_client_send_raw_msg_async( +qmi_cci_error_type qmi_cci_send_raw_msg_async( qmi_client_type user_handle, unsigned int msg_id, void *req_buf, @@ -1906,7 +1906,7 @@ qmi_client_error_type qmi_client_send_raw_msg_async( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -qmi_client_error_type qmi_client_send_msg_async( +qmi_cci_error_type qmi_cci_send_msg_async( qmi_client_type user_handle, unsigned int msg_id, void *req_c_struct, @@ -1937,7 +1937,7 @@ qmi_client_error_type qmi_client_send_msg_async( * @retval QMI_CLIENT_INVALID_CLNT Invalid client. * @retval QMI_INVALID_TXN Invalid transaction. */ -qmi_client_error_type qmi_client_delete_async_txn( +qmi_cci_error_type qmi_cci_delete_async_txn( qmi_client_type user_handle, qmi_txn_handle async_txn_handle) { @@ -2005,7 +2005,7 @@ qmi_client_error_type qmi_client_delete_async_txn( * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_send_raw_msg_sync( +qmi_cci_error_type qmi_client_send_raw_msg_sync( qmi_client_type user_handle, unsigned int msg_id, void *req_buf, @@ -2038,7 +2038,7 @@ qmi_client_error_type qmi_client_send_raw_msg_sync( * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_send_msg_sync( +qmi_cci_error_type qmi_cci_send_msg_sync( qmi_client_type user_handle, unsigned int msg_id, void *req_c_struct, @@ -2065,7 +2065,7 @@ qmi_client_error_type qmi_client_send_msg_sync( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_release_async( +qmi_cci_error_type qmi_cci_release_async( qmi_client_type user_handle, qmi_client_release_cb release_cb, void *release_cb_data) @@ -2107,10 +2107,10 @@ qmi_client_error_type qmi_client_release_async( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_release(qmi_client_type user_handle) +qmi_cci_error_type qmi_cci_release(qmi_client_type user_handle) { qcci_client_type *clnt; - qmi_client_error_type rc; + qmi_cci_error_type rc; QMI_CCI_OS_SIGNAL signal; clnt = qcci_client_get_ref(user_handle, 0); @@ -2123,7 +2123,7 @@ qmi_client_error_type qmi_client_release(qmi_client_type user_handle) /* Release this call's reference */ qcci_client_put_ref(clnt); - rc = qmi_client_release_async(user_handle, qcci_client_release_cb_internal, + rc = qmi_cci_release_async(user_handle, qcci_client_release_cb_internal, (void *)&signal); if (rc == QMI_NO_ERR) @@ -2150,7 +2150,7 @@ qmi_client_error_type qmi_client_release(qmi_client_type user_handle) * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_message_encode( +qmi_cci_error_type qmi_cci_message_encode( qmi_client_type user_handle, qmi_idl_type_of_message_type req_resp_ind, unsigned int message_id, @@ -2197,7 +2197,7 @@ qmi_client_error_type qmi_client_message_encode( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_message_decode( +qmi_cci_error_type qmi_cci_message_decode( qmi_client_type user_handle, qmi_idl_type_of_message_type req_resp_ind, unsigned int message_id, @@ -2239,7 +2239,7 @@ qmi_client_error_type qmi_client_message_decode( * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_SERVICE_ERR Service error. */ -qmi_client_error_type qmi_client_get_service_list( +qmi_cci_error_type qmi_cci_get_service_list( qmi_idl_service_object_type service_obj, qmi_service_info *service_info_array, unsigned int *num_entries, @@ -2300,11 +2300,11 @@ qmi_client_error_type qmi_client_get_service_list( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -qmi_client_error_type qmi_client_get_any_service( +qmi_cci_error_type qmi_cci_get_any_service( qmi_idl_service_object_type service_obj, qmi_service_info *service_info) { - return qmi_client_get_service_instance(service_obj, + return qmi_cci_get_service_instance(service_obj, QMI_CLIENT_INSTANCE_ANY, service_info); } #endif @@ -2321,24 +2321,24 @@ qmi_client_error_type qmi_client_get_any_service( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -qmi_client_error_type qmi_client_get_service_instance( +qmi_cci_error_type qmi_cci_get_service_instance( qmi_idl_service_object_type service_obj, qmi_service_instance instance_id, qmi_service_info *service_info) { unsigned int num_entries = 1, num_services, i; - qmi_client_error_type rc; + qmi_cci_error_type rc; qmi_service_info *service_array; if (!service_info) return QMI_CLIENT_PARAM_ERR; if (instance_id == QMI_CLIENT_INSTANCE_ANY) { - return qmi_client_get_service_list(service_obj, service_info, + return qmi_cci_get_service_list(service_obj, service_info, &num_entries, &num_services); } - rc = qmi_client_get_service_list(service_obj, NULL, + rc = qmi_cci_get_service_list(service_obj, NULL, NULL, &num_services); if (rc != QMI_NO_ERR) return rc; @@ -2348,7 +2348,7 @@ qmi_client_error_type qmi_client_get_service_instance( return QMI_CLIENT_ALLOC_FAILURE; num_entries = num_services; - rc = qmi_client_get_service_list(service_obj, service_array, + rc = qmi_cci_get_service_list(service_obj, service_array, &num_entries, &num_services); if (rc != QMI_NO_ERR) goto free_bail; @@ -2380,7 +2380,7 @@ qmi_client_error_type qmi_client_get_service_instance( * @retval QMI_NO_ERR Success. * @retval QMI_CLIENT_PARAM_ERR Parameter error. */ -qmi_client_error_type qmi_client_get_instance_id( +qmi_cci_error_type qmi_cci_get_instance_id( qmi_service_info *service_info, qmi_service_instance *instance_id) { @@ -2406,7 +2406,7 @@ qmi_client_error_type qmi_client_get_instance_id( * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_register_log_cb( +qmi_cci_error_type qmi_cci_register_log_cb( qmi_client_type user_handle, qmi_client_log_cb log_cb, void *log_cb_data) @@ -2446,7 +2446,7 @@ qmi_client_error_type qmi_client_register_log_cb( * @retval QMI_CLIENT_INVALID_CLNT Invalid client. * @retval QMI_SERVICE_ERR Service error. */ -qmi_client_error_type qmi_client_register_error_cb( +qmi_cci_error_type qmi_cci_register_error_cb( qmi_client_type user_handle, qmi_client_error_cb err_cb, void *err_cb_data) @@ -2497,7 +2497,7 @@ qmi_client_error_type qmi_client_register_error_cb( * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_register_notify_cb +qmi_cci_error_type qmi_cci_register_notify_cb ( qmi_client_type user_handle, qmi_client_notify_cb notify_cb, @@ -2548,7 +2548,7 @@ qmi_client_error_type qmi_client_register_notify_cb * @retval QMI_CLIENT_PARAM_ERR Parameter error. * @retval QMI_CLIENT_INVALID_CLNT Invalid client. */ -qmi_client_error_type qmi_client_get_async_txn_id( +qmi_cci_error_type qmi_client_get_async_txn_id( qmi_client_type user_handle, qmi_txn_handle async_txn_handle, uint32_t *txn_id) @@ -2556,7 +2556,7 @@ qmi_client_error_type qmi_client_get_async_txn_id( qcci_txn_type *i; qcci_client_type *clnt; qcci_txn_type *txn = (qcci_txn_type *)async_txn_handle; - qmi_client_error_type rc = QMI_INVALID_TXN; + qmi_cci_error_type rc = QMI_INVALID_TXN; if (!txn_id || !txn) return QMI_CLIENT_PARAM_ERR; @@ -2607,7 +2607,7 @@ qmi_client_error_type qmi_client_get_async_txn_id( * @retval QMI_SERVICE_ERR Service error. * @retval QMI_TIMEOUT_ERR Timeout error. */ -qmi_client_error_type qmi_client_init_instance( +qmi_cci_error_type qmi_cci_init_instance( qmi_idl_service_object_type service_obj, qmi_service_instance instance_id, qmi_client_ind_cb ind_cb, @@ -2616,7 +2616,7 @@ qmi_client_error_type qmi_client_init_instance( uint32_t timeout, qmi_client_type *user_handle) { - qmi_client_error_type rc; + qmi_cci_error_type rc; qmi_client_type notifier; qmi_service_info info; qmi_client_os_params notifier_os_params; @@ -2626,9 +2626,9 @@ qmi_client_error_type qmi_client_init_instance( /* The common case when we do not have to wait for the service, * avoid creation of the notifier */ - rc = qmi_client_get_service_instance(service_obj, instance_id, &info); + rc = qmi_cci_get_service_instance(service_obj, instance_id, &info); if (rc == QMI_NO_ERR) { - rc = qmi_client_init(&info, service_obj, ind_cb, + rc = qmi_cci_init(&info, service_obj, ind_cb, ind_cb_data, os_params, user_handle); if (rc == QMI_NO_ERR || rc != QMI_SERVICE_ERR) return rc; @@ -2637,17 +2637,17 @@ qmi_client_error_type qmi_client_init_instance( memset(¬ifier_os_params, 0, sizeof(notifier_os_params)); QMI_CCI_COPY_OS_PARAMS(¬ifier_os_params, os_params); - rc = qmi_client_notifier_init(service_obj, ¬ifier_os_params, + rc = qmi_cci_notifier_init(service_obj, ¬ifier_os_params, ¬ifier); if (rc != QMI_NO_ERR) return rc; while (1) { QMI_CCI_OS_SIGNAL_CLEAR(¬ifier_os_params); - rc = qmi_client_get_service_instance(service_obj, + rc = qmi_cci_get_service_instance(service_obj, instance_id, &info); if (rc == QMI_NO_ERR) { - rc = qmi_client_init(&info, service_obj, + rc = qmi_cci_init(&info, service_obj, ind_cb, ind_cb_data, os_params, user_handle); /* Success or a generic error occured */ @@ -2660,6 +2660,6 @@ qmi_client_error_type qmi_client_init_instance( break; } } - qmi_client_release(notifier); + qmi_cci_release(notifier); return rc; } diff --git a/qcci/qcci_internal.h b/qcci/qcci_common.h similarity index 98% rename from qcci/qcci_internal.h rename to qcci/qcci_common.h index 04fbacf..7323200 100644 --- a/qcci/qcci_internal.h +++ b/qcci/qcci_common.h @@ -179,7 +179,7 @@ typedef void *(*qcci_open_fn_type) * * @retval QMI_NO_ERR Success */ -typedef qmi_client_error_type (*qcci_send_fn_type) +typedef qmi_cci_error_type (*qcci_send_fn_type) ( void *handle, void *addr, @@ -319,7 +319,7 @@ void qcci_xport_resume * * @retval QMI_CSI_NO_ERR Success */ -qmi_client_error_type qcci_xport_recv +qmi_cci_error_type qcci_xport_recv ( qcci_client_type *clnt, void *addr, @@ -401,7 +401,7 @@ void qcci_xport_event_server_error * @note This function is NOT re-enterable or thread safe. The only safe place * to call this is during initialization. */ -qmi_client_error_type qcci_init( +qmi_cci_error_type qcci_init( qcci_xport_ops_type *xport_ops, void *xport_data); @@ -415,6 +415,6 @@ qmi_client_error_type qcci_init( * @note This function is NOT re-enterable or thread safe. The only safe place * to call this is during library de-initialization. */ -qmi_client_error_type qcci_deinit(void); +qmi_cci_error_type qcci_deinit(void); #endif diff --git a/qcci/qcci_os.c b/qcci/qcci_os.c index b7af84c..3eb0f7b 100644 --- a/qcci/qcci_os.c +++ b/qcci/qcci_os.c @@ -7,9 +7,9 @@ #include #include #include -#include "qmi_client.h" +#include "qmi_cci.h" #include "qcci_os.h" -#include "qcci_internal.h" +#include "qcci_common.h" #include "config.h" #ifdef QMI_FW_SYSLOG diff --git a/qcci/qcci_xport_qrtr.c b/qcci/qcci_xport_qrtr.c index 7378483..63df751 100644 --- a/qcci/qcci_xport_qrtr.c +++ b/qcci/qcci_xport_qrtr.c @@ -16,9 +16,9 @@ #include #include #include -#include "qmi_client.h" +#include "qmi_cci.h" #include "qcci_os.h" -#include "qcci_internal.h" +#include "qcci_common.h" #define ALIGN_SIZE(x) ((4 - ((x) & 3)) & 3) @@ -658,7 +658,7 @@ static void *xport_open * * @return QMI_NO_ERR on success, error code otherwise. */ -static qmi_client_error_type xport_send +static qmi_cci_error_type xport_send ( void *handle, void *addr, diff --git a/qcsi/qcsi_common.c b/qcsi/qcsi_common.c index affaf21..8864a50 100644 --- a/qcsi/qcsi_common.c +++ b/qcsi/qcsi_common.c @@ -10,7 +10,7 @@ */ #include #include "qmi_idl_lib.h" -#include "qcsi.h" +#include "qmi_csi.h" #include "qcsi_os.h" #include "qcsi_common.h" #include "common_v01.h" @@ -419,7 +419,7 @@ static qcsi_client_type *create_client * @retval QCSI_ENCODE_ERR Encoding error. * @retval QCSI_TRANSPORT_ERR Transport error. */ -static qcsi_error internal_send +static qmi_csi_error_type internal_send ( qcsi_service_type *svc, qcsi_client_type *clnt, @@ -433,7 +433,7 @@ static qcsi_error internal_send { qcsi_xport_type *xport; uint32_t max_msg_len = 0, out_len; - qcsi_error rc; + qmi_csi_error_type rc; int32_t encdec_rc; unsigned char *msg; uint8_t cntl_flag; @@ -558,7 +558,7 @@ static qcsi_error internal_send * @retval QCSI_NO_MEM No memory. * @retval QCSI_ENCODE_ERR Encoding error. */ -static qcsi_error encode_and_send_resp +static qmi_csi_error_type encode_and_send_resp ( qcsi_xport_type *xport, void *addr, @@ -569,7 +569,7 @@ static qcsi_error encode_and_send_resp ) { uint32_t resp_msg_len; - qcsi_error rc; + qmi_csi_error_type rc; unsigned char *msg; resp_msg_len = qmi_idl_get_std_resp_tlv_len(); @@ -616,7 +616,7 @@ static qcsi_error encode_and_send_resp * @retval QCSI_CONN_REFUSED Connection refused. * @retval QCSI_INTERNAL_ERR Internal error. */ -qcsi_error qcsi_xport_connect +qmi_csi_error_type qcsi_xport_connect ( qcsi_xport_type *xport, void *addr @@ -628,7 +628,7 @@ qcsi_error qcsi_xport_connect uint32_t client_handle = 0xffffffff; void *service_cookie = NULL; void *connection_handle = NULL; - qcsi_error rc = QCSI_INTERNAL_ERR; + qmi_csi_error_type rc = QCSI_INTERNAL_ERR; qcsi_cb_error cb_rc; if(!xport || !xport->service || !addr) @@ -703,7 +703,7 @@ qcsi_error qcsi_xport_connect * @retval QCSI_NO_ERR Success. * @retval QMI_ERR_INTERNAL_V01 Internal error. */ -qcsi_error qcsi_xport_recv +qmi_csi_error_type qcsi_xport_recv ( qcsi_xport_type *xport, void *addr, @@ -942,7 +942,7 @@ void qcsi_xport_resume_client * @retval QCSI_NO_ERR Success. * @retval QCSI_INTERNAL_ERR Internal error. */ -qcsi_error qcsi_xport_disconnect +qmi_csi_error_type qcsi_xport_disconnect ( qcsi_xport_type *xport, void *addr @@ -1037,8 +1037,8 @@ void qcsi_xport_closed * @retval QCSI_INTERNAL_ERR Internal error. * @retval QCSI_NO_MEM No memory. */ -qcsi_error -qcsi_register_with_options +qmi_csi_error_type +qmi_csi_register_with_options ( qmi_idl_service_object_type service_obj, qcsi_connect service_connect, @@ -1193,7 +1193,7 @@ qcsi_register_with_options * @retval QCSI_NO_ERR Success. * @retval QCSI_INTERNAL_ERR Internal error. */ -qcsi_error qcsi_register ( +qmi_csi_error_type qmi_csi_register ( qmi_idl_service_object_type service_obj, qcsi_connect service_connect, qcsi_disconnect service_disconnect, @@ -1202,7 +1202,7 @@ qcsi_error qcsi_register ( qcsi_os_params *os_params, qcsi_service_handle *service_provider) { - return qcsi_register_with_options( + return qmi_csi_register_with_options( service_obj, service_connect, service_disconnect, @@ -1224,7 +1224,7 @@ qcsi_error qcsi_register ( * @retval QCSI_NO_ERR Success. * @retval QCSI_INVALID_HANDLE Invalid handle. */ -qcsi_error qcsi_handle_event( +qmi_csi_error_type qmi_csi_handle_event( qcsi_service_handle service_provider, qcsi_os_params *os_params) { @@ -1265,7 +1265,7 @@ qcsi_error qcsi_handle_event( * @retval QCSI_INVALID_ARGS Invalid arguments. * @retval QCSI_INVALID_HANDLE Invalid handle. */ -qcsi_error qcsi_send_resp_internal( +qmi_csi_error_type qcsi_send_resp_internal( qmi_req_handle req_handle, unsigned int msg_id, void *c_struct, @@ -1274,7 +1274,7 @@ qcsi_error qcsi_send_resp_internal( { qcsi_txn_type *txn; qcsi_client_type *clnt; - qcsi_error rc; + qmi_csi_error_type rc; if(c_struct_len <= 0) return QCSI_INVALID_ARGS; @@ -1325,7 +1325,7 @@ qcsi_error qcsi_send_resp_internal( * @retval QCSI_INVALID_ARGS Invalid arguments. * @retval QCSI_INVALID_HANDLE Invalid handle. */ -qcsi_error qcsi_send_resp( +qmi_csi_error_type qmi_csi_send_resp( qmi_req_handle req_handle, unsigned int msg_id, void *c_struct, @@ -1349,7 +1349,7 @@ qcsi_error qcsi_send_resp( * @retval QCSI_INVALID_ARGS Invalid arguments. * @retval QCSI_INVALID_HANDLE Invalid handle. */ -qcsi_error qcsi_send_resp_raw( +qmi_csi_error_type qmi_csi_send_resp_raw( qmi_req_handle req_handle, unsigned int msg_id, void *c_struct, @@ -1369,9 +1369,9 @@ qcsi_error qcsi_send_resp_raw( * @param c_struct_len Length of the structure. * @param encode Flag indicating whether to encode the message. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error +qmi_csi_error_type qcsi_send_ind_internal ( qmi_client_handle client_handle, @@ -1382,7 +1382,7 @@ qcsi_send_ind_internal ) { qcsi_client_type *clnt; - qcsi_error rc; + qmi_csi_error_type rc; LOCK(&client_list_lock); clnt = find_client((uint32_t)(uintptr_t)client_handle); @@ -1419,10 +1419,10 @@ qcsi_send_ind_internal * @param c_struct Pointer to the structure containing the message data. * @param c_struct_len Length of the structure. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error -qcsi_send_ind +qmi_csi_error_type +qmi_csi_send_ind ( qmi_client_handle client_handle, unsigned int msg_id, @@ -1444,10 +1444,10 @@ qcsi_send_ind * @param buf Pointer to the buffer containing the message data. * @param buf_len Length of the buffer. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error -qcsi_send_ind_raw +qmi_csi_error_type +qmi_csi_send_ind_raw ( qmi_client_handle client_handle, unsigned int msg_id, @@ -1469,9 +1469,9 @@ qcsi_send_ind_raw * @param c_struct_len Length of the structure. * @param encode Flag indicating whether to encode the message. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error +qmi_csi_error_type qcsi_send_broadcast_ind_internal ( qcsi_service_handle service_provider, @@ -1482,7 +1482,7 @@ qcsi_send_broadcast_ind_internal ) { qcsi_service_type *svc; - qcsi_error rc; + qmi_csi_error_type rc; /* lock client list first so if we find the service, the client list is * not going to be changed @@ -1516,10 +1516,10 @@ qcsi_send_broadcast_ind_internal * @param c_struct Pointer to the structure containing the message data. * @param c_struct_len Length of the structure. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error -qcsi_send_broadcast_ind +qmi_csi_error_type +qmi_csi_send_broadcast_ind ( qcsi_service_handle service_provider, unsigned int msg_id, @@ -1541,10 +1541,10 @@ qcsi_send_broadcast_ind * @param buf Pointer to the buffer containing the message data. * @param buf_len Length of the buffer. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error -qcsi_send_broadcast_ind_raw +qmi_csi_error_type +qmi_csi_send_broadcast_ind_raw ( qcsi_service_handle service_provider, unsigned int msg_id, @@ -1564,10 +1564,10 @@ qcsi_send_broadcast_ind_raw * * @param service_provider Handle to the service provider. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error -qcsi_unregister +qmi_csi_error_type +qmi_csi_unregister ( qcsi_service_handle service_provider ) @@ -1612,12 +1612,12 @@ qcsi_unregister * @note This function is NOT re-enterable or thread safe. The only safe place * to call this is during initialization. */ -qcsi_error qcsi_init( +qmi_csi_error_type qcsi_init( qcsi_xport_ops_type *xport_ops, void *xport_data) { if (!xport_ops) { - return QCSI_INVALID_HANDLE; //TODO: err code + return QCSI_INVALID_HANDLE; } if (qcsi_fw_inited == 0) { @@ -1645,7 +1645,7 @@ qcsi_error qcsi_init( * @note This function is NOT re-enterable or thread safe. The only safe place * to call this is during library de-initialization. */ -qcsi_error qcsi_deinit(void) +qmi_csi_error_type qcsi_deinit(void) { if (qcsi_fw_inited) { qcsi_fw_inited = 0; @@ -1664,9 +1664,9 @@ qcsi_error qcsi_deinit(void) * @param req_handle Handle to the request. * @param txn_id Pointer to store the transaction ID. * - * @return qcsi_error Error code indicating the result of the operation. + * @return qmi_csi_error_type Error code indicating the result of the operation. */ -qcsi_error +qmi_csi_error_type qcsi_get_txn_id ( qmi_req_handle req_handle, diff --git a/qcsi/qcsi_common.h b/qcsi/qcsi_common.h index d934472..7368fab 100644 --- a/qcsi/qcsi_common.h +++ b/qcsi/qcsi_common.h @@ -13,7 +13,7 @@ #include #include "qmi_common.h" -#include "qcsi.h" +#include "qmi_csi.h" /** * @brief The data structure looks as follows: @@ -236,7 +236,7 @@ typedef void *(*qcsi_open_fn_type) * * @retval QCSI_NO_ERR Success. */ -typedef qcsi_error (*qcsi_reg_fn_type) +typedef qmi_csi_error_type (*qcsi_reg_fn_type) ( void *handle, uint32_t service_id, @@ -261,7 +261,7 @@ typedef qcsi_error (*qcsi_reg_fn_type) * * @retval QCSI_NO_ERR Success. */ -typedef qcsi_error (*qcsi_send_fn_type) +typedef qmi_csi_error_type (*qcsi_send_fn_type) ( void *handle, void *addr, @@ -338,7 +338,7 @@ typedef struct qcsi_xport_ops_s { * param[in] xport_data Opaque data associated with the transport, * such as port ID or other parameters. */ -qcsi_error qcsi_init +qmi_csi_error_type qcsi_init ( qcsi_xport_ops_type *xport_ops, void *xport_data @@ -348,7 +348,7 @@ qcsi_error qcsi_init * @brief function is used to deregister a transport with the infrastructure. * */ -qcsi_error qcsi_deinit(void); +qmi_csi_error_type qcsi_deinit(void); /** * @brief Signal the infrastructure that a previously busy endpoint is now @@ -373,7 +373,7 @@ void qcsi_xport_resume_client * * @retval QCSI_NO_ERR Success. */ -qcsi_error qcsi_xport_connect +qmi_csi_error_type qcsi_xport_connect ( qcsi_xport_type *xport, void *addr @@ -391,7 +391,7 @@ qcsi_error qcsi_xport_connect * * @retval QCSI_NO_ERR Success. */ -qcsi_error qcsi_xport_recv +qmi_csi_error_type qcsi_xport_recv ( qcsi_xport_type *xport, void *addr, @@ -410,7 +410,7 @@ qcsi_error qcsi_xport_recv * * @retval QCSI_NO_ERR Success. */ -qcsi_error qcsi_xport_disconnect +qmi_csi_error_type qcsi_xport_disconnect ( qcsi_xport_type *xport, void *addr diff --git a/qcsi/qcsi_xport_qrtr.c b/qcsi/qcsi_xport_qrtr.c index 9d423e8..2d759f7 100644 --- a/qcsi/qcsi_xport_qrtr.c +++ b/qcsi/qcsi_xport_qrtr.c @@ -10,7 +10,7 @@ #include #include #include "qmi_idl_lib.h" -#include "qcsi.h" +#include "qmi_csi.h" #include "qcsi_common.h" #include "qcsi_os.h" #include @@ -162,7 +162,7 @@ static void purge_tx_q FREE(dest); } -static qcsi_error put_tx_q +static qmi_csi_error_type put_tx_q ( struct xport_handle *xp, struct xport_qrtr_addr *addr, @@ -173,7 +173,7 @@ static qcsi_error put_tx_q { struct dest_s *dest; struct buf_s *buf; - qcsi_error rc = QCSI_NO_ERR; + qmi_csi_error_type rc = QCSI_NO_ERR; dest = get_tx_q(xp, addr); if(!dest) { @@ -291,7 +291,7 @@ static void handle_resume_tx qcsi_xport_resume_client(xp->xport, addr); } -static qcsi_error init_socket +static qmi_csi_error_type init_socket ( struct xport_handle *xp, qcsi_os_params *os_params @@ -365,7 +365,7 @@ static void *xport_open return NULL; } -static qcsi_error xport_reg +static qmi_csi_error_type xport_reg ( void *handle, uint32_t service_id, @@ -417,7 +417,7 @@ static qcsi_error xport_reg return QCSI_NO_ERR; } -static qcsi_error xport_unreg +static qmi_csi_error_type xport_unreg ( void *handle, uint32_t service_id, @@ -430,7 +430,7 @@ static qcsi_error xport_unreg return QCSI_NO_ERR; } -static qcsi_error xport_send +static qmi_csi_error_type xport_send ( void *handle, void *addr, @@ -444,7 +444,7 @@ static qcsi_error xport_send struct sockaddr_qrtr sq; struct xport_qrtr_addr *s_addr = (struct xport_qrtr_addr *)addr; struct dest_s *dest; - qcsi_error rc; + qmi_csi_error_type rc; ssize_t sendto_rc; uint32_t max_q_len = 0; diff --git a/tests/qcci_test.c b/tests/qcci_test.c index 2fa43f7..ad863c1 100644 --- a/tests/qcci_test.c +++ b/tests/qcci_test.c @@ -1,7 +1,7 @@ // Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. // SPDX-License-Identifier: BSD-3-Clause -#include "qmi_client.h" +#include "qmi_cci.h" #include "qmi_idl_lib.h" #include "qmi_cci_target_ext.h" #include @@ -149,7 +149,7 @@ void test_service_rx_cb void *buf, unsigned int len, void *resp_cb_data, - qmi_client_error_type transp_err + qmi_cci_error_type transp_err ) { --pending_async; @@ -203,19 +203,19 @@ void test_service_basic_test printf("TEST: Basic Ping Test with %d ping messages.\n",num_msgs); for (i=0; i= num_services) service_connect = 0; printf("%d Test Services found: Choosing service %d(numbered starting at 0)\n", num_services, service_connect); - rc = qmi_client_init(&info[service_connect], test_service_object, + rc = qmi_cci_init(&info[service_connect], test_service_object, test_service_ind_cb, NULL, NULL, &clnt); - printf("TEST: qmi_client_init returned %d\n", rc); + printf("TEST: qmi_cci_init returned %d\n", rc); switch(select_test) { case TEST_SERVICE_BASIC_TEST: test_service_basic_test(&clnt,&txn, iterations); @@ -472,10 +472,10 @@ int main(int argc, char **argv) usage(argv[0]); } - rc = qmi_client_release(clnt); - printf("TEST: qmi_client_release of clnt returned %d\n", rc); + rc = qmi_cci_release(clnt); + printf("TEST: qmi_cci_release of clnt returned %d\n", rc); - rc = qmi_client_release(notifier); - printf("TEST: qmi_client_release of notifier returned %d\n", rc); + rc = qmi_cci_release(notifier); + printf("TEST: qmi_cci_release of notifier returned %d\n", rc); return 0; } diff --git a/tests/qcsi_test.c b/tests/qcsi_test.c index 22ff1da..54d8ba9 100644 --- a/tests/qcsi_test.c +++ b/tests/qcsi_test.c @@ -8,7 +8,7 @@ #include #include #include "qmi_idl_lib.h" -#include "qcsi.h" +#include "qmi_csi.h" #include "qcsi_common.h" extern void *qmi_test_service_register_service(qcsi_os_params *os_params, uint32_t serv_instce); @@ -83,9 +83,9 @@ void qmi_test_service_start_service(uint32_t serv_inst) } } os_params_in.fds = fds; - qcsi_handle_event(sp, &os_params_in); + qmi_csi_handle_event(sp, &os_params_in); } - qcsi_unregister(sp); + qmi_csi_unregister(sp); printf("Server Terminated....\n"); } diff --git a/tests/qcsi_test_ping.c b/tests/qcsi_test_ping.c index 1bea93d..4166f1d 100644 --- a/tests/qcsi_test_ping.c +++ b/tests/qcsi_test_ping.c @@ -5,7 +5,7 @@ #include #include #include -#include "qcsi.h" +#include "qmi_csi.h" #include "test_service_v01.h" #ifdef QMI_FW_ADB_LOG @@ -127,7 +127,7 @@ static void test_create_ind_pattern(test_data_ind_msg_v01 *IndMsg, int iIndSz) static void test_send_indications(ind_type *params) { int i; - qcsi_error resp_err; + qmi_csi_error_type resp_err; test_data_ind_reg_resp_msg_v01 resp; int num_inds,ind_size,ind_delay; /* Freed at the end of this function */ @@ -158,12 +158,12 @@ static void test_send_indications(ind_type *params) resp.resp.result = QMI_RESULT_SUCCESS_V01; /* QMI_RESULT_SUCCESS*/ resp.resp.error = QMI_ERR_NONE_V01; /* QMI_ERR_NONE */ - resp_err = qcsi_send_resp(params->req_handle, params->msg_id, + resp_err = qmi_csi_send_resp(params->req_handle, params->msg_id, &resp, sizeof(resp)); if(resp_err != QCSI_NO_ERR) { - QMI_FW_LOGE("qcsi_send_resp returned error: %d\n", resp_err); - printf("qcsi_send_resp returned error: %d\n", resp_err); + QMI_FW_LOGE("qmi_csi_send_resp returned error: %d\n", resp_err); + printf("qmi_csi_send_resp returned error: %d\n", resp_err); } ind->data_len = ind_size; @@ -176,12 +176,12 @@ static void test_send_indications(ind_type *params) // TODO: define something in the target header for sleep //usleep(ind_delay); //printf("sending indication %d of %d\n",i+1,num_inds); - resp_err = qcsi_send_ind(params->clnt->clnt, QMI_TEST_DATA_IND_V01, ind, + resp_err = qmi_csi_send_ind(params->clnt->clnt, QMI_TEST_DATA_IND_V01, ind, sizeof(test_data_ind_msg_v01)); if(resp_err != QCSI_NO_ERR) { - QMI_FW_LOGE("qcsi_send_ind returned error: %d\n",resp_err); - printf("qcsi_send_ind returned error: %d\n",resp_err); + QMI_FW_LOGE("qmi_csi_send_ind returned error: %d\n",resp_err); + printf("qmi_csi_send_ind returned error: %d\n",resp_err); } } printf("Indications Sent: %d\n", i); @@ -212,7 +212,7 @@ static qcsi_cb_error test_response(client_info_type *clnt_info, int req_c_struct_len, void *service_cookie) { qcsi_cb_error rc = QCSI_CB_INTERNAL_ERR; - qcsi_error resp_err; + qmi_csi_error_type resp_err; /* The response message is small, and can safely be declared on the stack. See test_ping_data_response for a message that is large and uses @@ -225,10 +225,10 @@ static qcsi_cb_error test_response(client_info_type *clnt_info, safe to send it within the callback context, and does not require dispatch to a new thread. See ping_data_ind_registration to see the dispatch of message handling */ - resp_err = qcsi_send_resp(req_handle, msg_id, &resp, sizeof(resp)); + resp_err = qmi_csi_send_resp(req_handle, msg_id, &resp, sizeof(resp)); if(resp_err != QCSI_NO_ERR) { - QMI_FW_LOGE("qcsi_send_resp returned error: %d\n",resp_err); + QMI_FW_LOGE("qmi_csi_send_resp returned error: %d\n",resp_err); } else { @@ -263,7 +263,7 @@ static qcsi_cb_error test_data_response(client_info_type *clnt_info, { uint32_t iCount = 0; qcsi_cb_error rc = QCSI_CB_INTERNAL_ERR; - qcsi_error resp_err; + qmi_csi_error_type resp_err; service_context_type *context = (service_context_type*)service_cookie; /*Request and response messages*/ @@ -297,11 +297,11 @@ static qcsi_cb_error test_data_response(client_info_type *clnt_info, resp->resp.result = QMI_RESULT_SUCCESS_V01; /* QMI_RESULT_SUCCESS */ resp->resp.error = QMI_ERR_NONE_V01; /* QMI_ERR_NONES */ - resp_err = qcsi_send_resp(req_handle, msg_id, resp, + resp_err = qmi_csi_send_resp(req_handle, msg_id, resp, sizeof(test_data_resp_msg_v01)); if(resp_err != QCSI_NO_ERR) { - QMI_FW_LOGE("qcsi_send_resp returned error: %d\n", resp_err); + QMI_FW_LOGE("qmi_csi_send_resp returned error: %d\n", resp_err); } else { @@ -493,9 +493,9 @@ void *qmi_test_service_register_service(qcsi_os_params *os_params, uSvcOptions.instance_id = serv_instce; // TEST_APT_INSTANCE_ID qmi_idl_service_object_type test_service_object = test_get_service_object_v01(); - qcsi_error rc = QCSI_INTERNAL_ERR; + qmi_csi_error_type rc = QCSI_INTERNAL_ERR; - rc = qcsi_register_with_options(test_service_object, test_connect_cb, + rc = qmi_csi_register_with_options(test_service_object, test_connect_cb, test_disconnect_cb, test_handle_req_cb, &service_cookie, os_params, &uSvcOptions, &service_cookie.service_handle);