summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/hci_lib.h29
1 files changed, 29 insertions, 0 deletions
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
}