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);
/* 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);
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);
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);
}
}
+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;
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;
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 */
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!!!");
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;
}
/* 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;
/* 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;
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)
{