Lines Matching refs:c
43 void hopping_init( hopping_t *c ) { in hopping_init() argument
44 assert( c != NULL ); in hopping_init()
46 memset( c, 0, sizeof(hopping_t) ); in hopping_init()
49 void hopping_set_channel_map( hopping_t *c, const uint8_t *chm ) { in hopping_set_channel_map() argument
50 assert( c != NULL ); in hopping_set_channel_map()
53 memcpy( c->chMap, chm, 5 ); in hopping_set_channel_map()
55 c->chCnt = 0; in hopping_set_channel_map()
58 LOG_DBG("%d(%d)\n", i, GET_BIT( c->chMap, i ) ); in hopping_set_channel_map()
59 if( 1 == GET_BIT( c->chMap, i ) ) { in hopping_set_channel_map()
60 c->chRemap[c->chCnt++] = i; in hopping_set_channel_map()
70 void hopping_csa1_set_hop_increment( hopping_t *c, uint8_t hopIncrement ){ in hopping_csa1_set_hop_increment() argument
71 assert( c != NULL ); in hopping_csa1_set_hop_increment()
73 c->hopIncrement = hopIncrement; in hopping_csa1_set_hop_increment()
76 uint8_t hopping_csa1_get_next_channel( hopping_t *c ) { in hopping_csa1_get_next_channel() argument
77 assert( c != NULL ); in hopping_csa1_get_next_channel()
79 c->currentCh = (c->currentCh + c->hopIncrement) % 37; in hopping_csa1_get_next_channel()
80 if( 1 == GET_BIT( c->chMap, c->currentCh ) ) { in hopping_csa1_get_next_channel()
81 return c->currentCh; in hopping_csa1_get_next_channel()
83 return c->chRemap[ c->currentCh % c->chCnt ]; in hopping_csa1_get_next_channel()
88 void hopping_csa2_set_access_address( hopping_t *c, uint32_t accessAddress ){ in hopping_csa2_set_access_address() argument
89 assert( c != NULL ); in hopping_csa2_set_access_address()
91 c->channelIdentifier = (accessAddress >> 16) ^ (accessAddress & 0xffff); in hopping_csa2_set_access_address()
106 static uint16_t hopping_csa2_prn_e(hopping_t *c, uint16_t counter){ in hopping_csa2_prn_e() argument
107 assert( c != NULL ); in hopping_csa2_prn_e()
110 uint16_t v = counter ^ c->channelIdentifier; in hopping_csa2_prn_e()
112 v = hopping_csa2_mam(v, c->channelIdentifier); in hopping_csa2_prn_e()
114 v = hopping_csa2_mam(v, c->channelIdentifier); in hopping_csa2_prn_e()
116 v = hopping_csa2_mam(v, c->channelIdentifier); in hopping_csa2_prn_e()
117 v = v ^ c->channelIdentifier; in hopping_csa2_prn_e()
121 uint8_t hopping_csa2_get_channel_for_counter( hopping_t *c, uint16_t counter ){ in hopping_csa2_get_channel_for_counter() argument
122 assert( c != NULL ); in hopping_csa2_get_channel_for_counter()
124 uint16_t prn_e = hopping_csa2_prn_e( c, counter); in hopping_csa2_get_channel_for_counter()
126 if ( 1 == GET_BIT( c->chMap, unmapped_channel)){ in hopping_csa2_get_channel_for_counter()
129 uint16_t remappingIndex = (((uint32_t) c->chCnt) * prn_e) >> 16; in hopping_csa2_get_channel_for_counter()
130 return c->chRemap[ remappingIndex ]; in hopping_csa2_get_channel_for_counter()