From 16591cb20976879e8189d46d24ed1b41b0941a27 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Mon, 22 Apr 2002 20:12:15 +0000 Subject: Additional hci_filter_ functions --- include/hci_lib.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/hci_lib.h b/include/hci_lib.h index 5a49fd35..ecf180be 100644 --- a/include/hci_lib.h +++ b/include/hci_lib.h @@ -90,6 +90,11 @@ static inline void hci_set_bit(int nr, void *addr) *((uint32_t *) addr + (nr >> 5)) |= (1 << (nr & 31)); } +static inline void hci_clear_bit(int nr, void *addr) +{ + *((uint32_t *) addr + (nr >> 5)) &= ~(1 << (nr & 31)); +} + static inline int hci_test_bit(int nr, void *addr) { return *((uint32_t *) addr + (nr >> 5)) & (1 << (nr & 31)); @@ -104,6 +109,14 @@ static inline void hci_filter_set_ptype(int t, struct hci_filter *f) { hci_set_bit((t & HCI_FLT_TYPE_BITS), &f->type_mask); } +static inline void hci_filter_clear_ptype(int t, struct hci_filter *f) +{ + hci_clear_bit((t & HCI_FLT_TYPE_BITS), &f->type_mask); +} +static inline int hci_filter_test_ptype(int t, struct hci_filter *f) +{ + return hci_test_bit((t & HCI_FLT_TYPE_BITS), &f->type_mask); +} static inline void hci_filter_all_ptypes(struct hci_filter *f) { memset((void *)&f->type_mask, 0xff, sizeof(f->type_mask)); @@ -112,6 +125,14 @@ static inline void hci_filter_set_event(int e, struct hci_filter *f) { hci_set_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask); } +static inline void hci_filter_clear_event(int e, struct hci_filter *f) +{ + hci_clear_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask); +} +static inline int hci_filter_test_event(int e, struct hci_filter *f) +{ + return hci_test_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask); +} static inline void hci_filter_all_events(struct hci_filter *f) { memset((void *)f->event_mask, 0xff, sizeof(f->event_mask)); @@ -120,6 +141,14 @@ static inline void hci_filter_set_opcode(int opcode, struct hci_filter *f) { f->opcode = opcode; } +static inline void hci_filter_clear_opcode(int opcode, struct hci_filter *f) +{ + f->opcode = 0; +} +static inline int hci_filter_test_opcode(int opcode, struct hci_filter *f) +{ + return (f->opcode == opcode); +} #ifdef __cplusplus } -- cgit