The patch contains following changes - 1. Addition of tcore_server_unload_modem_plugi...
authorSuresh Kumar Narasimhaiah <suresh.n@samsung.com>
Wed, 20 Mar 2013 19:28:33 +0000 (00:58 +0530)
committerwootak.jung <wootak.jung@samsung.com>
Sun, 24 Mar 2013 09:03:16 +0000 (18:03 +0900)
include/core_object.h
include/mux.h
include/server.h
src/core_object.c
src/mux.c
src/server.c

index 530be6f..c57bab1 100644 (file)
@@ -132,6 +132,7 @@ TReturn tcore_object_emit_callback(CoreObject *co, const char *event, const void
 
 void *tcore_object_add_mapping_tbl_entry(void *mapping_tbl,
                                                unsigned int object_type, TcoreHal *hal);
+void tcore_object_remove_mapping_tbl(void *mapping_tbl);
 void *tcore_object_remove_mapping_tbl_entry(void *mapping_tbl, TcoreHal *hal);
 void tcore_object_remove_mapping_tbl_entry_by_type(void *mapping_tbl,
                                                        unsigned int co_type);
index 6fb0daa..a17f127 100644 (file)
@@ -35,13 +35,16 @@ typedef struct cmux_channel tcore_cmux_channel;
 /* Global MUX Object */
 typedef struct cmux_obj tcore_cmux_object;
 
-/* Internal CMUX setup complete callback prototype */
+/* CMUX setup complete callback prototype */
 typedef void (*cmux_setup_complete_cb_func) (gpointer user_data);
 
 /* CMUX setup callback prototype */
 typedef void (*cmux_setup_cb_func) (int channel_id, TcoreHal *hal,
                                                                        gpointer user_data);
 
+/* CMUX Channel close callback prototype */
+typedef void (*cmux_channel_close_cb_func) (TcoreHal *hal, gpointer user_data);
+
 /* CMUX initialization - Internal and Kernel */
 TReturn tcore_cmux_init(TcoreHal *phy_hal, unsigned int frame_size,
                                        TcorePendingResponseCallback resp_cb, void *resp_cb_data);
@@ -53,7 +56,8 @@ TReturn tcore_cmux_setup_internal_mux(tcore_cmux_mode mode,
        cmux_setup_complete_cb_func setup_complete_cb, gpointer setup_complete_user_data);
 
 /* Close CMUX */
-void tcore_cmux_close(TcoreHal *phy_hal);
+void tcore_cmux_close(TcoreHal *phy_hal,
+       cmux_channel_close_cb_func channel_close_cb, gpointer channel_close_user_data);
 
 /* HAL Receive for Internal CMUX */
 void tcore_cmux_rcv_from_hal(TcoreHal *hal, unsigned char *data, size_t length);
index b01a446..230c02a 100644 (file)
@@ -79,6 +79,7 @@ const char *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin);
 
 gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
                                        unsigned int co_type, TcoreHal *hal);
+void tcore_server_remove_cp_mapping_tbl(TcorePlugin *modem_iface_plugin);
 void tcore_server_remove_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
                                        TcoreHal *hal);
 void *tcore_server_get_cp_mapping_tbl(TcorePlugin *modem_plugin);
index 7df2279..385eecc 100644 (file)
@@ -121,6 +121,25 @@ static void _util_print_mapping_tbl_entry(object_mapping_table_t *tbl_entry)
        }
 }
 
+static void _free_tbl_entry(gpointer data)
+{
+       object_mapping_table_t *tbl_entry;
+
+       if (data == NULL)
+               return;
+
+       tbl_entry = data;
+
+       dbg("Removing Mapping Table Entry - HAL: [0x%x]", tbl_entry->hal);
+       _util_print_mapping_tbl_entry(tbl_entry);
+
+       /* Free Core Object types list */
+       g_slist_free(tbl_entry->object_type);
+
+       /* Free Table entry */
+       g_free(tbl_entry);
+}
+
 static CoreObject *_object_new(TcorePlugin *plugin, unsigned int type)
 {
        CoreObject *co;
@@ -820,6 +839,19 @@ void *tcore_object_add_mapping_tbl_entry(void *mapping_tbl,
        return mapping_tbl_list;
 }
 
+void tcore_object_remove_mapping_tbl(void *mapping_tbl)
+{
+       GSList *mapping_tbl_list = mapping_tbl;
+
+       if (mapping_tbl_list == NULL) {
+               err("Mapping Table is NULL");
+               return;
+       }
+
+       /* Freeing Mapping Table */
+       g_slist_free_full(mapping_tbl_list, _free_tbl_entry);
+}
+
 void *tcore_object_remove_mapping_tbl_entry(void *mapping_tbl, TcoreHal *hal)
 {
        GSList *mapping_tbl_list = mapping_tbl;
index 16f9480..b803299 100644 (file)
--- a/src/mux.c
+++ b/src/mux.c
@@ -451,7 +451,9 @@ static void _cmux_control_channel_handle(tcore_cmux_object *cmux_obj)
                                        dbg("Multiplexer close down");
 
                                        cmux_obj->cmux_state = CMUX_CLOSED;
-                                       tcore_cmux_close(cmux_obj->phy_hal);
+
+                                       /* TODO - Need to notify regarding CMUX closure */
+                                       tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
                                        break;
                                default:
                                        /* We will be supporting these commands in Phase 2 */
@@ -541,7 +543,9 @@ static void _cmux_process_channel_data(tcore_cmux_object *cmux_obj,
 
                                if (channel_id == CMUX_CHANNEL_0) {
                                        cmux_obj->cmux_state = CMUX_CLOSED;
-                                       tcore_cmux_close(cmux_obj->phy_hal);
+
+                                       /* TODO - Need to notify regarding CMUX closure */
+                                       tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
                                }
                        } else
                                err("Received UA in wrong state!!!");
@@ -615,7 +619,8 @@ static void _cmux_process_channel_data(tcore_cmux_object *cmux_obj,
                                        cmux_obj->cmux_state = CMUX_CLOSED;
 
                                        /* Close CMUX */
-                                       tcore_cmux_close(cmux_obj->phy_hal);
+                                       /* TODO - Need to notify regarding CMUX closure */
+                                       tcore_cmux_close(cmux_obj->phy_hal, NULL, NULL);
                                }
                        }
                        break;
@@ -1417,7 +1422,8 @@ ERROR:
 }
 
 /* Close CMUX */
-void tcore_cmux_close(TcoreHal *phy_hal)
+void tcore_cmux_close(TcoreHal *phy_hal,
+       cmux_channel_close_cb_func channel_close_cb, gpointer channel_close_user_data)
 {
        tcore_cmux_object *cmux_obj;
        int channel_id;
@@ -1442,6 +1448,11 @@ void tcore_cmux_close(TcoreHal *phy_hal)
                /* Close Channel - Send DSC command */
                _cmux_close_channel(cmux_obj, channel_id);
 
+               /* Invoke callback */
+               if (channel_close_cb != NULL)
+                       channel_close_cb(cmux_obj->internal_mux.channel_info[channel_id]->hal,
+                                               channel_close_user_data);
+
                /* Free Logical HAL for Channel */
                tcore_hal_free(cmux_obj->internal_mux.channel_info[channel_id]->hal);
                cmux_obj->internal_mux.channel_info[channel_id]->hal = NULL;
index 425d772..6c38233 100644 (file)
@@ -836,6 +836,33 @@ gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
        return TRUE;
 }
 
+void tcore_server_remove_cp_mapping_tbl(TcorePlugin *modem_iface_plugin)
+{
+       Server *s;
+       TcoreModem *modem;
+
+       if (modem_iface_plugin == NULL) {
+               err("Modem Interface is NULL");
+               return;
+       }
+
+       s = tcore_plugin_ref_server(modem_iface_plugin);
+       if (s == NULL) {
+               err("server is NULL");
+               return;
+       }
+
+       modem = _server_find_modem(s, modem_iface_plugin, NULL);
+       if (modem == NULL) {
+               err("Failed to find 'modem' for Modem Interface Plug-in: [%s]",
+                                       tcore_plugin_ref_plugin_name(modem_iface_plugin));
+               return;
+       }
+
+       /* Removing the Mapping Table from the Modems list */
+       tcore_object_remove_mapping_tbl(modem->mapping_tbl);
+}
+
 void tcore_server_remove_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
                                        TcoreHal *hal)
 {