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