From 0fe05d96ffcffc2a18b5c80022aaf11cb91b2360 Mon Sep 17 00:00:00 2001 From: "wootak.jung" Date: Mon, 14 Jan 2013 13:58:13 +0900 Subject: [PATCH] hal: Implement network interface setup --- include/hal.h | 11 +++++++++++ src/hal.c | 11 +++++++++++ src/mux.c | 14 ++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/include/hal.h b/include/hal.h index d93795a..2db1d13 100644 --- a/include/hal.h +++ b/include/hal.h @@ -25,6 +25,7 @@ __BEGIN_DECLS typedef void (*TcoreHalReceiveCallback)(TcoreHal *hal, unsigned int data_len, const void *data, void *user_data); typedef enum tcore_hook_return (*TcoreHalSendHook)(TcoreHal *hal, unsigned int data_len, void *data, void *user_data); +typedef void (*TcoreHalSetupNetifCallback)(CoreObject *co, const char* devname, void *user_data); enum tcore_hal_recv_data_type { TCORE_HAL_RECV_INDICATION, @@ -43,6 +44,10 @@ enum tcore_hal_mode { struct tcore_hal_operations { TReturn (*power)(TcoreHal *hal, gboolean flag); TReturn (*send)(TcoreHal *hal, unsigned int data_len, void *data); + TReturn (*setup_netif)(CoreObject *co, + TcoreHalSetupNetifCallback func, + void *user_data, unsigned int cid, + gboolean enable); }; TcoreHal* tcore_hal_new(TcorePlugin *plugin, const char *name, @@ -86,6 +91,12 @@ gboolean tcore_hal_get_power_state(TcoreHal *hal); TcoreQueue* tcore_hal_ref_queue(TcoreHal *hal); TcorePlugin* tcore_hal_ref_plugin(TcoreHal *hal); +TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co, + TcoreHalSetupNetifCallback func, + void *user_data, unsigned int cid, + gboolean enable); + + __END_DECLS #endif diff --git a/src/hal.c b/src/hal.c index 5453b83..c5d901b 100644 --- a/src/hal.c +++ b/src/hal.c @@ -508,3 +508,14 @@ TReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag) return hal->ops->power(hal, flag); } + +TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co, + TcoreHalSetupNetifCallback func, + void *user_data, unsigned int cid, + gboolean enable) +{ + if (!hal || !hal->ops || !hal->ops->setup_netif) + return TCORE_RETURN_EINVAL; + + return hal->ops->setup_netif(co, func, user_data, cid, enable); +} diff --git a/src/mux.c b/src/mux.c index a1b1bca..5124ec9 100755 --- a/src/mux.c +++ b/src/mux.c @@ -283,10 +283,24 @@ static TReturn tcore_cmux_hal_send(TcoreHal *h, unsigned int data_len, void *dat return TCORE_RETURN_SUCCESS; } +static TReturn tcore_cmux_hal_setup_netif(CoreObject *co, + TcoreHalSetupNetifCallback func, + void *user_data, unsigned int cid, + gboolean enable) +{ + TcoreHal *hal = g_mux_obj_ptr->phy_hal; + + if (hal == NULL) + return TCORE_RETURN_EINVAL; + + return tcore_hal_setup_netif(hal, co, func, user_data, cid, enable); +} + /* CMUX supported HAL (Logical HAL) operations */ static struct tcore_hal_operations mux_hops = { .power = tcore_cmux_hal_power, .send = tcore_cmux_hal_send, + .setup_netif = tcore_cmux_hal_setup_netif, }; static TReturn tcore_cmux_send_data(int data_len, unsigned char *data) -- 2.7.4