Lines Matching defs:hal

31 #include "hal.h"
38 struct wtap_hal *hal = (struct wtap_hal *)arg;
45 hal = (struct wtap_hal *)arg;
47 p = medium_get_next_packet(hal->hal_md);
51 hal->plugin->work(hal->plugin, p);
62 init_hal(struct wtap_hal *hal)
66 mtx_init(&hal->hal_mtx, "wtap_hal mtx", NULL, MTX_DEF | MTX_RECURSE);
68 hal->hal_md = (struct wtap_medium *)malloc(sizeof(struct wtap_medium),
71 init_medium(hal->hal_md);
73 TASK_INIT(&hal->hal_md->tx_handler->proc, 0, hal_tx_proc, hal);
75 callout_init_mtx(&hal->hw.timer_intr, &hal->hal_mtx, 0);
76 hal->hw.timer_intr_intval = msecs_to_ticks(HAL_TIMER_INTVAL);
80 register_plugin(struct wtap_hal *hal, struct wtap_plugin *plugin)
84 hal->plugin = plugin;
88 deregister_plugin(struct wtap_hal *hal)
91 hal->plugin->deinit(hal->plugin);
92 hal->plugin = NULL; /* catch illegal usages */
96 deinit_hal(struct wtap_hal *hal)
100 deinit_medium(hal->hal_md);
101 free(hal->hal_md, M_WTAP);
102 mtx_destroy(&hal->hal_mtx);
106 new_wtap(struct wtap_hal *hal, int32_t id)
177 if(hal->hal_devs[id] != NULL){
182 hal->hal_devs[id] = (struct wtap_softc *)malloc(
184 hal->hal_devs[id]->sc_md = hal->hal_md;
185 hal->hal_devs[id]->id = id;
186 hal->hal_devs[id]->hal = hal;
187 snprintf(hal->hal_devs[id]->name, sizeof(hal->hal_devs[id]->name),
189 mtx_init(&hal->hal_devs[id]->sc_mtx, "wtap_softc mtx", NULL,
192 if(wtap_attach(hal->hal_devs[id], macaddr)){
201 free_wtap(struct wtap_hal *hal, int32_t id)
205 if(hal->hal_devs[id] == NULL){
210 if(wtap_detach(hal->hal_devs[id]))
212 mtx_destroy(&hal->hal_devs[id]->sc_mtx);
213 free(hal->hal_devs[id], M_WTAP);
214 hal->hal_devs[id] = NULL;
221 struct wtap_hal *hal = arg;
222 uint32_t intval = hal->hw.timer_intr_intval;
224 hal->hw.tsf += ticks_to_msecs(intval);
226 callout_schedule(&hal->hw.timer_intr, intval);
230 wtap_hal_reset_tsf(struct wtap_hal *hal)
232 mtx_lock(&hal->hal_mtx);
234 callout_stop(&hal->hw.timer_intr);
235 hal->hw.tsf = 0;
236 callout_reset(&hal->hw.timer_intr, hal->hw.timer_intr_intval,
237 wtap_hal_timer_intr, hal);
239 mtx_unlock(&hal->hal_mtx);
243 wtap_hal_get_tsf(struct wtap_hal *hal)
245 return (hal->hw.tsf);