Lines Matching refs:d
32 static void p2G4_handle_next_request(uint d);
34 static void f_wait_done(uint d){ in f_wait_done() argument
35 bs_trace_raw_time(8,"Device %u - Wait done\n", d); in f_wait_done()
36 p2G4_phy_resp_wait(d); in f_wait_done()
37 p2G4_handle_next_request(d); in f_wait_done()
40 static void f_tx_end(uint d){ in f_tx_end() argument
45 tx_el = &tx_l_c.tx_list[d]; in f_tx_end()
47 bs_trace_raw_time(8,"Device %u - Tx done (Tx aborted)\n", d); in f_tx_end()
49 bs_trace_raw_time(8,"Device %u - Tx done (Tx ended)\n", d); in f_tx_end()
52 dump_tx(tx_el, d); in f_tx_end()
54 txl_clear(d); in f_tx_end()
57 p2G4_phy_resp_tx(d, &tx_done_s); in f_tx_end()
58 p2G4_handle_next_request(d); in f_tx_end()
62 static int pick_abort_tail(uint d, p2G4_abort_t *ab, const char* type) { in pick_abort_tail() argument
64 …bs_trace_error_time_line("Device %u requested %s abort in %"PRItime" which has passed\n", d, type,… in pick_abort_tail()
67 …ne("Device %u requested %s abort recheck in %"PRItime" which has passed\n", d, type, ab->recheck_t… in pick_abort_tail()
70 …me(4,"Device %u - Note: Abort reevaluation in same time (possible infinite loop in device?)\n", d); in pick_abort_tail()
76 d, type, ab->abort_time, ab->recheck_time); in pick_abort_tail()
84 static int pick_and_validate_abort(uint d, p2G4_abort_t *ab, const char* type) { in pick_and_validate_abort() argument
87 bs_trace_raw_time(8,"Device %u - Reevaluating %s abort\n", d, type); in pick_and_validate_abort()
89 p2G4_phy_get_new_abort_request(d); in pick_and_validate_abort()
91 ret = p2G4_phy_get_new_abort_receive(d, ab); in pick_and_validate_abort()
93 …bs_trace_raw_time(4,"Device %u terminated the simulation (there was %i left)\n", d, nbr_active_dev… in pick_and_validate_abort()
97 bs_trace_raw_time(4,"Device %u requested an immediate RSSI measurement\n", d); in pick_and_validate_abort()
101 p2G4_phy_get(d, &rssi_req, sizeof(rssi_req)); in pick_and_validate_abort()
102 … chm_RSSImeas(&tx_l_c, rssi_req.antenna_gain, &rssi_req.radio_params, &rssi_resp, d, current_time); in pick_and_validate_abort()
103 p2G4_phy_resp_IMRSSI(d, &rssi_resp); in pick_and_validate_abort()
107 return pick_abort_tail(d, ab, type); in pick_and_validate_abort()
114 static int pick_and_validate_abort_Rxcont(uint d, p2G4_abort_t *ab) { in pick_and_validate_abort_Rxcont() argument
116 bs_trace_raw_time(8,"Device %u - Picking abort during header eval\n", d); in pick_and_validate_abort_Rxcont()
118 p2G4_phy_get_abort_struct(d, ab); in pick_and_validate_abort_Rxcont()
120 return pick_abort_tail(d, ab, "Rx header"); in pick_and_validate_abort_Rxcont()
169 static void tx_start_packet_common(p2G4_txv2_t* tx_s, uint d){ in tx_start_packet_common() argument
170 txl_start_packet(d); in tx_start_packet_common()
171 bs_trace_raw_time(8,"Device %u - Tx packet start\n", d); in tx_start_packet_common()
172 find_and_activate_rx(tx_s, d); in tx_start_packet_common()
175 static void tx_schedule_next_event(p2G4_txv2_t* tx_s, uint d){ in tx_schedule_next_event() argument
180 if ( (tx_l_c.used[d] & TXS_PACKET_ONGOING) == 0){ in tx_schedule_next_event()
186 if (tx_l_c.used[d] & TXS_PACKET_ENDED){ in tx_schedule_next_event()
198 fq_add(tx_s->abort.recheck_time, Tx_Abort_Reeval, d); in tx_schedule_next_event()
200 fq_add(TxEndt, Tx_Packet_Start, d); in tx_schedule_next_event()
203 fq_add(TxEndt, Tx_End, d); in tx_schedule_next_event()
205 fq_add(TxEndt, Tx_Packet_End, d); in tx_schedule_next_event()
209 static void f_tx_start(uint d) { in f_tx_start() argument
211 tx_s = &tx_l_c.tx_list[d].tx_s; in f_tx_start()
213 txl_start_tx(d); in f_tx_start()
214 bs_trace_raw_time(8,"Device %u - Tx start\n", d); in f_tx_start()
217 tx_start_packet_common(tx_s, d); in f_tx_start()
222 tx_schedule_next_event(tx_s, d); in f_tx_start()
225 static void f_tx_abort_reeval(uint d){ in f_tx_abort_reeval() argument
228 tx_s = &tx_l_c.tx_list[d].tx_s; in f_tx_abort_reeval()
230 if (pick_and_validate_abort(d, &(tx_s->abort), "Tx")) in f_tx_abort_reeval()
233 tx_schedule_next_event(tx_s, d); in f_tx_abort_reeval()
236 static void f_tx_packet_start(uint d){ in f_tx_packet_start() argument
238 tx_s = &tx_l_c.tx_list[d].tx_s; in f_tx_packet_start()
240 tx_start_packet_common(tx_s, d); in f_tx_packet_start()
241 tx_schedule_next_event(tx_s, d); in f_tx_packet_start()
244 static void f_tx_packet_end(uint d){ in f_tx_packet_end() argument
246 tx_s = &tx_l_c.tx_list[d].tx_s; in f_tx_packet_end()
248 bs_trace_raw_time(8,"Device %u - Tx packet end\n", d); in f_tx_packet_end()
249 txl_end_packet(d); in f_tx_packet_end()
250 tx_schedule_next_event(tx_s, d); in f_tx_packet_end()
254 static void f_RSSI_meas(uint d) { in f_RSSI_meas() argument
257 …chm_RSSImeas(&tx_l_c, RSSI_a[d].antenna_gain, &RSSI_a[d].radio_params, &RSSI_meas, d, current_time… in f_RSSI_meas()
259 dump_RSSImeas(&RSSI_a[d], &RSSI_meas, d); in f_RSSI_meas()
261 bs_trace_raw_time(8,"RSSIDone for device %u\n", d); in f_RSSI_meas()
263 p2G4_phy_resp_RSSI(d, &RSSI_meas); in f_RSSI_meas()
264 p2G4_handle_next_request(d); in f_RSSI_meas()
267 static void rx_do_RSSI(uint d) { in rx_do_RSSI() argument
268 …chm_RSSImeas(&tx_l_c, rx_a[d].rx_s.antenna_gain, &rx_a[d].rx_s.radio_params, &rx_a[d].rx_done_s.rs… in rx_do_RSSI()
275 static inline void rx_enqueue_search_reeval(uint d){ in rx_enqueue_search_reeval() argument
276 rx_status_t *rx_status = &rx_a[d]; in rx_enqueue_search_reeval()
280 fq_add(end_time, Rx_Search_reeval, d); in rx_enqueue_search_reeval()
302 static void f_rx_found(uint d);
304 static void rx_possible_abort_recheck(uint d, rx_status_t *rx_st, bool scanning){ in rx_possible_abort_recheck() argument
306 if ( pick_and_validate_abort(d, &(rx_a[d].rx_s.abort), "Rx") != 0 ){ in rx_possible_abort_recheck()
316 static int prelock_check(uint d, rx_status_t *rx_status) { in prelock_check() argument
319 … "but there was no previous reception lock, attempting new search\n", d); in prelock_check()
327 … "but the transmitter is not active anymore, attempting new search\n", d); in prelock_check()
334 "acceptable_pre_truncation=%u)\n", d, in prelock_check()
345 static void f_rx_search_start(uint d) { in f_rx_search_start() argument
348 rx_status = &rx_a[d]; in f_rx_search_start()
350 rx_possible_abort_recheck(d, rx_status, true); in f_rx_search_start()
352 bs_trace_raw_time(8,"Device %u - Starting Rx\n", d); in f_rx_search_start()
355 tx_d = prelock_check(d, rx_status); in f_rx_search_start()
365 f_rx_found(d); in f_rx_search_start()
370 rx_enqueue_search_reeval(d); in f_rx_search_start()
374 static void rx_respond_done(uint d, rx_status_t *rx_status) { in rx_respond_done() argument
378 p2G4_phy_resp_rx(d, &rx_done_v1); in rx_respond_done()
380 p2G4_phy_resp_rxv2(d, &rx_status->rx_done_s); in rx_respond_done()
384 static void rx_resp_addr_found(uint d, rx_status_t *rx_status, uint8_t *packet) { in rx_resp_addr_found() argument
388 p2G4_phy_resp_rx_addr_found(d, &rx_done_v1, packet); in rx_resp_addr_found()
390 p2G4_phy_resp_rxv2_addr_found(d, &rx_status->rx_done_s, packet); in rx_resp_addr_found()
394 static void rx_scan_ended(uint d, rx_status_t *rx_status, const char * const state){ in rx_scan_ended() argument
399 rx_do_RSSI(d); in rx_scan_ended()
402 bs_trace_raw_time(8,"Device %u - RxDone (NoSync during %s)\n", d, state); in rx_scan_ended()
407 rx_respond_done(d, rx_status); in rx_scan_ended()
408 dump_rx(&rx_a[d],NULL,d); in rx_scan_ended()
409 p2G4_handle_next_request(d); in rx_scan_ended()
412 static void f_rx_search_reeval(uint d) { in f_rx_search_reeval() argument
414 rx_status = &rx_a[d]; in f_rx_search_reeval()
416 rx_possible_abort_recheck(d, rx_status, true); in f_rx_search_reeval()
419 rx_scan_ended(d, rx_status, "Rx Search"); in f_rx_search_reeval()
424 rx_enqueue_search_reeval(d); in f_rx_search_reeval()
428 static void f_rx_found(uint d){ in f_rx_found() argument
429 rx_status_t *rx_status = &rx_a[d]; in f_rx_found()
443 || (chm_is_packet_synched( &tx_l_c, tx_d, d, rx_status, current_time ) )) in f_rx_found()
454 bs_trace_raw_time(8,"Device %u - Matched Tx %u\n", d, tx_d); in f_rx_found()
458 fq_add(next_time, Rx_Sync, d); in f_rx_found()
462 rx_enqueue_search_reeval(d); in f_rx_found()
467 static int rx_bit_error_calc(uint d, uint tx_nbr, rx_status_t *rx_st) { in rx_bit_error_calc() argument
479 biterrors = chm_bit_errors(&tx_l_c, tx_nbr, d, rx_st, current_time, st->errorspercalc); in rx_bit_error_calc()
486 static void f_rx_sync(uint d){ in f_rx_sync() argument
488 rx_possible_abort_recheck(d, &rx_a[d], true); in f_rx_sync()
490 if ( current_time > rx_a[d].scan_end ) { in f_rx_sync()
491 rx_scan_ended(d, &rx_a[d], "Rx sync"); in f_rx_sync()
495 if ( current_time < rx_a[d].sync_start ) { in f_rx_sync()
498 bs_time_t next_time = BS_MIN(rx_a[d].sync_start,rx_a[d].rx_s.abort.recheck_time); in f_rx_sync()
499 next_time = BS_MIN(next_time, rx_a[d].scan_end + 1); in f_rx_sync()
500 fq_add(next_time, Rx_Sync, d); in f_rx_sync()
504 if ( ( tx_l_c.used[rx_a[d].tx_nbr] & TXS_PACKET_ONGOING ) == 0 ) { //if the Tx aborted in f_rx_sync()
506 bs_trace_raw_time(8,"Device %u - Sync lost (Tx disappeared)\n", d); in f_rx_sync()
507 …fq_add(current_time + 1, Rx_Search_start, d); //Note that we go to start, to search again in betwe… in f_rx_sync()
510 rx_a[d].biterrors += rx_bit_error_calc(d, rx_a[d].tx_nbr, &rx_a[d]); in f_rx_sync()
513 if ( rx_a[d].biterrors > rx_a[d].rx_s.sync_threshold ) { in f_rx_sync()
514 bs_trace_raw_time(8,"Device %u - Sync lost (errors)\n", d); in f_rx_sync()
515 …fq_add(current_time + 1, Rx_Search_start, d); //Note that we go to start, to search again in betwe… in f_rx_sync()
519 if ( current_time >= rx_a[d].sync_end ) { in f_rx_sync()
521 rx_do_RSSI(d); in f_rx_sync()
522 rx_a[d].biterrors = 0; in f_rx_sync()
526 rx_a[d].rx_done_s.rx_time_stamp = rx_a[d].sync_end; in f_rx_sync()
527 rx_a[d].rx_done_s.end_time = current_time; in f_rx_sync()
528 rx_a[d].rx_done_s.packet_size = tx_l_c.tx_list[rx_a[d].tx_nbr].tx_s.packet_size; in f_rx_sync()
529 rx_a[d].rx_done_s.status = P2G4_RXSTATUS_INPROGRESS; in f_rx_sync()
531 bs_trace_raw_time(8,"Device %u - Sync done\n", d); in f_rx_sync()
532 rx_resp_addr_found(d, &rx_a[d], tx_l_c.tx_list[rx_a[d].tx_nbr].packet); in f_rx_sync()
535 header = p2G4_get_next_request(d); in f_rx_sync()
539 …e(5,"Device %u disconnected during Rx (minor protocol violation) (%i left)\n", d, nbr_active_devs); in f_rx_sync()
541 fq_remove(d); in f_rx_sync()
545 …bs_trace_raw_time(4,"Device %u terminated the simulation (there was %i left)\n", d, nbr_active_dev… in f_rx_sync()
554 if (pick_and_validate_abort_Rxcont(d, &(rx_a[d].rx_s.abort)) != 0 ){ in f_rx_sync()
562 …bs_trace_error_line("Device %u has violated the protocol during an Rx (%u) => Terminate\n",d, head… in f_rx_sync()
568 if ( rx_a[d].rx_s.pream_and_addr_duration == 0 ) { in f_rx_sync()
573 if ( rx_a[d].rx_s.header_duration == 0 ) { in f_rx_sync()
574 fq_add(current_time + delta, Rx_Payload, d); in f_rx_sync()
576 fq_add(current_time + delta, Rx_Header, d); in f_rx_sync()
579 dump_rx(&rx_a[d], tx_l_c.tx_list[rx_a[d].tx_nbr].packet, d); in f_rx_sync()
580 p2G4_handle_next_request(d); in f_rx_sync()
584 fq_add(current_time + 1, Rx_Sync, d); in f_rx_sync()
589 static void f_rx_header(uint d){ in f_rx_header() argument
591 rx_possible_abort_recheck(d, &rx_a[d], false); in f_rx_header()
593 rx_a[d].biterrors += rx_bit_error_calc(d, rx_a[d].tx_nbr, &rx_a[d]); in f_rx_header()
596 if ( ( ( current_time >= rx_a[d].header_end ) in f_rx_header()
597 && ( rx_a[d].biterrors > rx_a[d].rx_s.header_threshold ) ) in f_rx_header()
599 ( current_time >= rx_a[d].rx_s.abort.abort_time ) ) { in f_rx_header()
600 rx_a[d].rx_done_s.packet_size = 0; in f_rx_header()
601 rx_a[d].rx_done_s.status = P2G4_RXSTATUS_HEADER_ERROR; in f_rx_header()
602 bs_trace_raw_time(8,"Device %u - RxDone (Header error)\n", d); in f_rx_header()
603 rx_a[d].rx_done_s.end_time = current_time; in f_rx_header()
605 rx_respond_done(d, &rx_a[d]); in f_rx_header()
606 dump_rx(&rx_a[d],NULL,d); in f_rx_header()
607 p2G4_handle_next_request(d); in f_rx_header()
609 } else if ( current_time >= rx_a[d].header_end ) { in f_rx_header()
610 bs_trace_raw_time(8,"Device %u - Header done\n", d); in f_rx_header()
611 fq_add(current_time + 1, Rx_Payload, d); in f_rx_header()
614 fq_add(current_time + 1, Rx_Header, d); in f_rx_header()
619 static void f_rx_payload(uint d){ in f_rx_payload() argument
621 rx_possible_abort_recheck(d, &rx_a[d], false); in f_rx_payload()
623 rx_a[d].biterrors += rx_bit_error_calc(d, rx_a[d].tx_nbr, &rx_a[d]); in f_rx_payload()
625 if (((current_time >= rx_a[d].payload_end) && (rx_a[d].biterrors > 0)) in f_rx_payload()
626 || (current_time >= rx_a[d].rx_s.abort.abort_time)) { in f_rx_payload()
628 rx_a[d].rx_done_s.packet_size = 0; in f_rx_payload()
630 rx_a[d].rx_done_s.status = P2G4_RXSTATUS_PACKET_CONTENT_ERROR; in f_rx_payload()
631 bs_trace_raw_time(8,"Device %u - RxDone (CRC error)\n", d); in f_rx_payload()
632 rx_a[d].rx_done_s.end_time = current_time; in f_rx_payload()
633 rx_respond_done(d, &rx_a[d]); in f_rx_payload()
634 dump_rx(&rx_a[d],NULL,d); in f_rx_payload()
635 p2G4_handle_next_request(d); in f_rx_payload()
637 } else if ( current_time >= rx_a[d].payload_end ) { in f_rx_payload()
638 rx_a[d].rx_done_s.status = P2G4_RXSTATUS_OK; in f_rx_payload()
639 bs_trace_raw_time(8,"Device %u - RxDone (CRC ok)\n", d); in f_rx_payload()
640 rx_a[d].rx_done_s.end_time = current_time; in f_rx_payload()
641 rx_respond_done(d, &rx_a[d]); in f_rx_payload()
642 dump_rx(&rx_a[d],tx_l_c.tx_list[rx_a[d].tx_nbr].packet,d); in f_rx_payload()
643 p2G4_handle_next_request(d); in f_rx_payload()
646 fq_add(current_time + 1, Rx_Payload, d); in f_rx_payload()
681 static void f_cca_meas(uint d) { in f_cca_meas() argument
682 cca_status_t *cca_s = &cca_a[d]; in f_cca_meas()
683 p2G4_cca_t *req = &cca_a[d].req; in f_cca_meas()
684 p2G4_cca_done_t *resp = &cca_a[d].resp; in f_cca_meas()
688 if ( pick_and_validate_abort(d, &(req->abort), "CCA") != 0 ) { in f_cca_meas()
698 chm_RSSImeas(&tx_l_c, req->antenna_gain, &req->radio_params, &RSSI_meas, d, current_time); in f_cca_meas()
708 bs_trace_raw_time(8,"Device %u - RSSI over threshold \n", d); in f_cca_meas()
723 bs_trace_raw_time(8,"Device %u - Modulated signal over threshold \n", d); in f_cca_meas()
736 bs_trace_raw_time(8,"Device %u - CCA completed\n", d); in f_cca_meas()
741 p2G4_phy_resp_cca(d, resp); in f_cca_meas()
742 dump_cca(cca_s, d); in f_cca_meas()
743 p2G4_handle_next_request(d); in f_cca_meas()
750 fq_add(next_time, Rx_CCA_meas, d); in f_cca_meas()
755 #define PAST_CHECK(start, d, type) \ argument
759 d, type, start); \
762 static void prepare_wait(uint d){ in prepare_wait() argument
765 p2G4_phy_get(d, &wait, sizeof(wait)); in prepare_wait()
768 d, wait.end); in prepare_wait()
770 fq_add(wait.end, Wait_Done, d); in prepare_wait()
775 d, wait.end); in prepare_wait()
779 static void check_valid_abort(p2G4_abort_t *abort, bs_time_t start_time, const char* type, uint d){ in check_valid_abort() argument
782 d, type, abort->abort_time); in check_valid_abort()
786 d, type, abort->recheck_time); in check_valid_abort()
791 d, type, type, start_time, abort->abort_time); in check_valid_abort()
795 d, type, type, start_time, abort->recheck_time); in check_valid_abort()
799 static void prepare_tx_common(uint d, p2G4_txv2_t *tx_s){ in prepare_tx_common() argument
804 p2G4_phy_get(d, data, tx_s->packet_size); in prepare_tx_common()
807 PAST_CHECK(tx_s->start_tx_time, d, "Tx"); in prepare_tx_common()
810 …evice %u wants a tx end time <= tx start time (%"PRItime" <= %"PRItime")\n",d, tx_s->end_tx_time, … in prepare_tx_common()
813 …u wants a tx end time <= tx packet start time (%"PRItime" <= %"PRItime")\n",d, tx_s->end_tx_time, … in prepare_tx_common()
816 …nts a packet end time <= tx packet start time (%"PRItime" <= %"PRItime")\n",d, tx_s->end_packet_ti… in prepare_tx_common()
819 check_valid_abort(&tx_s->abort, tx_s->start_tx_time , "Tx", d); in prepare_tx_common()
825 d, tx_s->start_tx_time, tx_s->end_tx_time, in prepare_tx_common()
829 txl_register(d, tx_s, data); in prepare_tx_common()
831 fq_add(tx_s->start_tx_time, Tx_Start, d); in prepare_tx_common()
836 static void prepare_txv2(uint d){ in prepare_txv2() argument
839 p2G4_phy_get(d, &tx_s, sizeof(tx_s)); in prepare_txv2()
841 prepare_tx_common(d, &tx_s); in prepare_txv2()
844 static void prepare_txv1(uint d){ in prepare_txv1() argument
848 p2G4_phy_get(d, &tx_s, sizeof(tx_s)); in prepare_txv1()
851 prepare_tx_common(d, &tx_v2_s); in prepare_txv1()
854 static void prepare_RSSI(uint d){ in prepare_RSSI() argument
857 p2G4_phy_get(d, &RSSI_s, sizeof(RSSI_s)); in prepare_RSSI()
859 PAST_CHECK(RSSI_s.meas_time, d, "RSSI measurement"); in prepare_RSSI()
862 d, RSSI_s.meas_time); \ in prepare_RSSI()
864 memcpy(&RSSI_a[d],&RSSI_s, sizeof(p2G4_rssi_t)); in prepare_RSSI()
866 fq_add(RSSI_s.meas_time, RSSI_Meas, d); in prepare_RSSI()
869 static void prepare_rx_common(uint d, p2G4_rxv2_t *rxv2_s){ in prepare_rx_common() argument
870 PAST_CHECK(rxv2_s->start_time, d, "Rx"); in prepare_rx_common()
872 check_valid_abort(&rxv2_s->abort, rxv2_s->start_time , "Rx", d); in prepare_rx_common()
875 d, rxv2_s->start_time, rxv2_s->abort.abort_time, rxv2_s->abort.recheck_time); in prepare_rx_common()
877 rx_status_t *rx_status = &rx_a[d]; in prepare_rx_common()
915 d, rxv2_s->error_calc_rate); in prepare_rx_common()
920 fq_add(rxv2_s->start_time, Rx_Search_start, d); in prepare_rx_common()
923 static void prepare_rxv1(uint d){ in prepare_rxv1() argument
927 p2G4_phy_get(d, &rxv1_s, sizeof(p2G4_rx_t)); in prepare_rxv1()
929 rx_a[d].phy_address[0] = rxv1_s.phy_address; in prepare_rxv1()
930 rx_a[d].v1_request = true; in prepare_rxv1()
932 prepare_rx_common(d, &rxv2_s); in prepare_rxv1()
935 static void prepare_rxv2(uint d){ in prepare_rxv2() argument
938 p2G4_phy_get(d, &rxv2_s, sizeof(p2G4_rxv2_t)); in prepare_rxv2()
942 "%i > %i\n",d, rxv2_s.n_addr, P2G4_RXV2_MAX_ADDRESSES); in prepare_rxv2()
947 d, rxv2_s.resp_type); in prepare_rxv2()
953 d, rxv2_s.acceptable_pre_truncation, rxv2_s.pream_and_addr_duration); in prepare_rxv2()
957 d, rxv2_s.acceptable_pre_truncation, rxv2_s.pream_and_addr_duration); in prepare_rxv2()
960 p2G4_phy_get(d, rx_a[d].phy_address, rxv2_s.n_addr*sizeof(p2G4_address_t)); in prepare_rxv2()
961 rx_a[d].v1_request = false; in prepare_rxv2()
963 prepare_rx_common(d, &rxv2_s); in prepare_rxv2()
966 static void prepare_CCA(uint d){ in prepare_CCA() argument
967 p2G4_cca_t *cca_req = &cca_a[d].req; in prepare_CCA()
970 memset(&cca_a[d], 0, sizeof(cca_status_t)); in prepare_CCA()
972 p2G4_phy_get(d, cca_req, sizeof(p2G4_cca_t)); in prepare_CCA()
974 PAST_CHECK(cca_req->start_time, d, "CCA"); in prepare_CCA()
976 check_valid_abort(&cca_req->abort, cca_req->start_time , "CCA", d); in prepare_CCA()
979 bs_trace_error_time_line("Device %u: scan period must be bigger than 0\n", d); in prepare_CCA()
984 d, cca_req->stop_when_found); in prepare_CCA()
987 cca_a[d].scan_end = cca_req->start_time + cca_req->scan_duration -1; in prepare_CCA()
988 cca_a[d].next_meas = cca_req->start_time; in prepare_CCA()
989 cca_a[d].RSSI_acc = 0; in prepare_CCA()
990 cca_a[d].resp.RSSI_max = P2G4_RSSI_POWER_MIN; in prepare_CCA()
991 cca_a[d].resp.mod_rx_power = P2G4_RSSI_POWER_MIN; in prepare_CCA()
994 …d, cca_req->start_time, cca_req->scan_period, cca_req->scan_duration, cca_req->abort.abort_time, c… in prepare_CCA()
996 fq_add(cca_req->start_time, Rx_CCA_meas, d); in prepare_CCA()
999 static void p2G4_handle_next_request(uint d) { in p2G4_handle_next_request() argument
1001 header = p2G4_get_next_request(d); in p2G4_handle_next_request()
1006 bs_trace_raw_time(3,"Device %u disconnected (%i left)\n", d, nbr_active_devs); in p2G4_handle_next_request()
1007 fq_remove(d); in p2G4_handle_next_request()
1010 …bs_trace_raw_time(4,"Device %u terminated the simulation (there was %i left)\n", d, nbr_active_dev… in p2G4_handle_next_request()
1014 prepare_wait(d); in p2G4_handle_next_request()
1017 prepare_txv1(d); in p2G4_handle_next_request()
1020 prepare_txv2(d); in p2G4_handle_next_request()
1023 prepare_RSSI(d); in p2G4_handle_next_request()
1026 prepare_rxv1(d); in p2G4_handle_next_request()
1029 prepare_rxv2(d); in p2G4_handle_next_request()
1032 prepare_CCA(d); in p2G4_handle_next_request()
1035 bs_trace_error_time_line("The device %u has violated the protocol (%u)\n",d, header); in p2G4_handle_next_request()
1104 for (uint d = 0; d < args.n_devs && nbr_active_devs > 0; d ++) { in main() local
1105 p2G4_handle_next_request(d); in main()