Lines Matching refs:bit
14 #define BIT_INDEX(bit) ((3 - ((bit >> 3) & 0x3)) + 4*(bit >> 5)) argument
16 #define BIT_INDEX(bit) (bit >> 3) argument
18 #define BIT_VAL(bit) (1 << (bit & 0x7)) argument
41 unsigned int bit; in ZTEST()
46 for (bit = 0U; bit < 32; ++bit) { in ZTEST()
47 sys_set_bit((mem_addr_t)&b1, bit); in ZTEST()
49 zassert_equal(b1, (1 << bit), in ZTEST()
50 "sys_set_bit failed on bit %d\n", bit); in ZTEST()
52 zassert_true(sys_test_bit((mem_addr_t)&b1, bit), in ZTEST()
53 "sys_test_bit did not detect bit %d\n", bit); in ZTEST()
55 sys_clear_bit((mem_addr_t)&b1, bit); in ZTEST()
56 zassert_equal(b1, 0, "sys_clear_bit failed for bit %d\n", bit); in ZTEST()
58 zassert_false(sys_test_bit((mem_addr_t)&b1, bit), in ZTEST()
60 bit); in ZTEST()
62 zassert_false(sys_test_and_set_bit((mem_addr_t)&b1, bit), in ZTEST()
64 " detected bit %d\n", bit); in ZTEST()
65 zassert_equal(b1, (1 << bit), in ZTEST()
67 bit); in ZTEST()
68 zassert_true(sys_test_and_set_bit((mem_addr_t)&b1, bit), in ZTEST()
70 bit); in ZTEST()
71 zassert_equal(b1, (1 << bit), in ZTEST()
72 "sys_test_and_set_bit cleared bit %d\n", bit); in ZTEST()
74 zassert_true(sys_test_and_clear_bit((mem_addr_t)&b1, bit), in ZTEST()
76 bit); in ZTEST()
78 " bit %d\n", bit); in ZTEST()
79 zassert_false(sys_test_and_clear_bit((mem_addr_t)&b1, bit), in ZTEST()
81 " bit %d\n", bit); in ZTEST()
83 bit); in ZTEST()
86 for (bit = 0U; bit < BITFIELD_SIZE; ++bit) { in ZTEST()
87 sys_bitfield_set_bit((mem_addr_t)b2, bit); in ZTEST()
88 zassert_equal(b2[BIT_INDEX(bit)], BIT_VAL(bit), in ZTEST()
90 bit); in ZTEST()
91 zassert_true(sys_bitfield_test_bit((mem_addr_t)b2, bit), in ZTEST()
93 bit); in ZTEST()
95 sys_bitfield_clear_bit((mem_addr_t)b2, bit); in ZTEST()
96 zassert_equal(b2[BIT_INDEX(bit)], 0, in ZTEST()
98 bit); in ZTEST()
99 zassert_false(sys_bitfield_test_bit((mem_addr_t)b2, bit), in ZTEST()
101 " bit %d\n", bit); in ZTEST()
103 ret = sys_bitfield_test_and_set_bit((mem_addr_t)b2, bit); in ZTEST()
105 " detected bit %d\n", bit); in ZTEST()
107 zassert_equal(b2[BIT_INDEX(bit)], BIT_VAL(bit), in ZTEST()
109 " bit %d\n", bit); in ZTEST()
110 zassert_true(sys_bitfield_test_and_set_bit((mem_addr_t)b2, bit), in ZTEST()
112 " %d\n", bit); in ZTEST()
113 zassert_equal(b2[BIT_INDEX(bit)], BIT_VAL(bit), in ZTEST()
115 bit); in ZTEST()
118 bit), "sys_bitfield_test_and_clear_bit did not" in ZTEST()
119 " detect bit %d\n", bit); in ZTEST()
120 zassert_equal(b2[BIT_INDEX(bit)], 0, in ZTEST()
122 " clear bit %d\n", bit); in ZTEST()
124 bit), "sys_bitfield_test_and_clear_bit" in ZTEST()
125 " erroneously detected bit %d\n", bit); in ZTEST()
126 zassert_equal(b2[BIT_INDEX(bit)], 0, in ZTEST()
128 bit); in ZTEST()