Lines Matching full:ctx

56 static void cc_ntf_established(struct ll_conn *conn, struct proc_ctx *ctx)  in cc_ntf_established()  argument
63 ntf = ctx->node_ref.rx; in cc_ntf_established()
65 ctx->node_ref.rx = NULL; in cc_ntf_established()
71 ntf->rx_ftr.param = ll_conn_iso_stream_get(ctx->data.cis_create.cis_handle); in cc_ntf_established()
75 pdu->cis_handle = ctx->data.cis_create.cis_handle; in cc_ntf_established()
76 pdu->status = ctx->data.cis_create.error; in cc_ntf_established()
129 static void rp_cc_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt,
136 static void llcp_rp_cc_tx_rsp(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_tx_rsp() argument
144 tx = llcp_tx_alloc(conn, ctx); in llcp_rp_cc_tx_rsp()
148 conn_event_count = ctx->data.cis_create.conn_event_count; in llcp_rp_cc_tx_rsp()
155 ctx->data.cis_create.conn_event_count = MAX(ctx->data.cis_create.conn_event_count, in llcp_rp_cc_tx_rsp()
158 delay_conn_events = ctx->data.cis_create.conn_event_count - conn_event_count; in llcp_rp_cc_tx_rsp()
173 uint32_t iso_interval_us = ctx->data.cis_create.iso_interval * ISO_INT_UNIT_US; in llcp_rp_cc_tx_rsp()
182 ctx->data.cis_create.cis_offset_min += offset_us; in llcp_rp_cc_tx_rsp()
183 ctx->data.cis_create.cis_offset_max += offset_us; in llcp_rp_cc_tx_rsp()
186 llcp_pdu_encode_cis_rsp(ctx, pdu); in llcp_rp_cc_tx_rsp()
187 ctx->tx_opcode = pdu->llctrl.opcode; in llcp_rp_cc_tx_rsp()
193 static void llcp_rp_cc_tx_reject(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) in llcp_rp_cc_tx_reject() argument
199 tx = ctx->node_ref.tx; in llcp_rp_cc_tx_reject()
201 ctx->node_ref.tx = NULL; in llcp_rp_cc_tx_reject()
206 llcp_pdu_encode_reject_ext_ind(pdu, opcode, ctx->data.cis_create.error); in llcp_rp_cc_tx_reject()
207 ctx->tx_opcode = pdu->llctrl.opcode; in llcp_rp_cc_tx_reject()
213 static void rp_cc_ntf_create(struct ll_conn *conn, struct proc_ctx *ctx) in rp_cc_ntf_create() argument
218 ntf = ctx->node_ref.rx; in rp_cc_ntf_create()
219 ctx->node_ref.rx = NULL; in rp_cc_ntf_create()
226 pdu->cig_id = ctx->data.cis_create.cig_id; in rp_cc_ntf_create()
227 pdu->cis_id = ctx->data.cis_create.cis_id; in rp_cc_ntf_create()
228 pdu->cis_handle = ctx->data.cis_create.cis_handle; in rp_cc_ntf_create()
230 ctx->data.cis_create.host_request_to = 0U; in rp_cc_ntf_create()
233 static void rp_cc_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_cc_complete() argument
235 cc_ntf_established(conn, ctx); in rp_cc_complete()
237 ctx->state = RP_CC_STATE_IDLE; in rp_cc_complete()
240 static void rp_cc_send_cis_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_send_cis_rsp() argument
243 if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in rp_cc_send_cis_rsp()
244 ctx->state = RP_CC_STATE_WAIT_TX_CIS_RSP; in rp_cc_send_cis_rsp()
246 llcp_rp_cc_tx_rsp(conn, ctx); in rp_cc_send_cis_rsp()
249 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_CIS_IND; in rp_cc_send_cis_rsp()
250 ctx->state = RP_CC_STATE_WAIT_RX_CIS_IND; in rp_cc_send_cis_rsp()
254 static void rp_cc_send_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_send_reject_ind() argument
257 if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in rp_cc_send_reject_ind()
258 ctx->state = RP_CC_STATE_WAIT_TX_REJECT_IND; in rp_cc_send_reject_ind()
261 ctx->node_ref.tx = llcp_tx_alloc(conn, ctx); in rp_cc_send_reject_ind()
262 if (ctx->data.cis_create.error == BT_HCI_ERR_CONN_ACCEPT_TIMEOUT) { in rp_cc_send_reject_ind()
267 ctx->state = RP_CC_STATE_WAIT_NTF_AVAIL; in rp_cc_send_reject_ind()
270 ctx->node_ref.rx = llcp_ntf_alloc(); in rp_cc_send_reject_ind()
273 ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RETAIN; in rp_cc_send_reject_ind()
276 llcp_rp_cc_tx_reject(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in rp_cc_send_reject_ind()
278 if (ctx->data.cis_create.error == BT_HCI_ERR_CONN_ACCEPT_TIMEOUT) { in rp_cc_send_reject_ind()
280 rp_cc_complete(conn, ctx, evt, param); in rp_cc_send_reject_ind()
284 ctx->state = RP_CC_STATE_IDLE; in rp_cc_send_reject_ind()
289 static void rp_cc_state_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_idle() argument
294 ctx->state = RP_CC_STATE_WAIT_RX_CIS_REQ; in rp_cc_state_idle()
302 static uint8_t rp_cc_check_phy(struct ll_conn *conn, struct proc_ctx *ctx, in rp_cc_check_phy() argument
324 static void rp_cc_state_wait_rx_cis_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_rx_cis_req() argument
332 llcp_pdu_decode_cis_req(ctx, pdu); in rp_cc_state_wait_rx_cis_req()
335 ctx->data.cis_create.error = rp_cc_check_phy(conn, ctx, pdu); in rp_cc_state_wait_rx_cis_req()
337 if (ctx->data.cis_create.error == BT_HCI_ERR_SUCCESS) { in rp_cc_state_wait_rx_cis_req()
338 ctx->data.cis_create.error = in rp_cc_state_wait_rx_cis_req()
340 &ctx->data.cis_create.cis_handle); in rp_cc_state_wait_rx_cis_req()
343 if (ctx->data.cis_create.error == BT_HCI_ERR_SUCCESS) { in rp_cc_state_wait_rx_cis_req()
345 rp_cc_ntf_create(conn, ctx); in rp_cc_state_wait_rx_cis_req()
346 ctx->state = RP_CC_STATE_WAIT_REPLY; in rp_cc_state_wait_rx_cis_req()
349 rp_cc_send_reject_ind(conn, ctx, evt, param); in rp_cc_state_wait_rx_cis_req()
358 static void rp_cc_state_wait_tx_cis_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_tx_cis_rsp() argument
363 rp_cc_send_cis_rsp(conn, ctx, evt, param); in rp_cc_state_wait_tx_cis_rsp()
371 static void rp_cc_state_wait_tx_reject_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_tx_reject_ind() argument
376 rp_cc_send_reject_ind(conn, ctx, evt, param); in rp_cc_state_wait_tx_reject_ind()
384 static void rp_cc_state_wait_rx_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_rx_cis_ind() argument
391 llcp_pdu_decode_cis_ind(ctx, pdu); in rp_cc_state_wait_rx_cis_ind()
392 if (!ull_peripheral_iso_setup(&pdu->llctrl.cis_ind, ctx->data.cis_create.cig_id, in rp_cc_state_wait_rx_cis_ind()
393 ctx->data.cis_create.cis_handle, in rp_cc_state_wait_rx_cis_ind()
394 &ctx->data.cis_create.conn_event_count)) { in rp_cc_state_wait_rx_cis_ind()
397 ctx->state = RP_CC_STATE_WAIT_INSTANT; in rp_cc_state_wait_rx_cis_ind()
400 llcp_rx_node_retain(ctx); in rp_cc_state_wait_rx_cis_ind()
403 rp_cc_check_instant(conn, ctx, evt, param); in rp_cc_state_wait_rx_cis_ind()
419 static void rp_cc_state_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_ntf_avail() argument
425 ctx->node_ref.rx = llcp_ntf_alloc(); in rp_cc_state_wait_ntf_avail()
427 ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RETAIN; in rp_cc_state_wait_ntf_avail()
430 llcp_rp_cc_tx_reject(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in rp_cc_state_wait_ntf_avail()
431 rp_cc_complete(conn, ctx, evt, param); in rp_cc_state_wait_ntf_avail()
441 static void rp_cc_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_check_instant() argument
448 start_event_count = ctx->data.cis_create.conn_event_count; in rp_cc_check_instant()
454 ull_conn_iso_start(conn, ctx->data.cis_create.cis_handle, in rp_cc_check_instant()
460 ctx->state = RP_CC_STATE_WAIT_CIS_ESTABLISHED; in rp_cc_check_instant()
464 static void rp_cc_state_wait_reply(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_reply() argument
471 ctx->state = RP_CC_STATE_WAIT_TX_CIS_RSP; in rp_cc_state_wait_reply()
475 ctx->data.cis_create.host_request_to += (conn->lll.interval * CONN_INT_UNIT_US); in rp_cc_state_wait_reply()
476 if (ctx->data.cis_create.host_request_to < conn->connect_accept_to) { in rp_cc_state_wait_reply()
480 ctx->data.cis_create.error = BT_HCI_ERR_CONN_ACCEPT_TIMEOUT; in rp_cc_state_wait_reply()
484 ull_peripheral_iso_release(ctx->data.cis_create.cis_handle); in rp_cc_state_wait_reply()
486 ctx->state = RP_CC_STATE_WAIT_TX_REJECT_IND; in rp_cc_state_wait_reply()
495 static void rp_cc_state_wait_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_cc_state_wait_instant() argument
500 rp_cc_check_instant(conn, ctx, evt, param); in rp_cc_state_wait_instant()
509 static void rp_cc_state_wait_cis_established(struct ll_conn *conn, struct proc_ctx *ctx, in rp_cc_state_wait_cis_established() argument
514 rp_cc_complete(conn, ctx, evt, param); in rp_cc_state_wait_cis_established()
523 static void rp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_cc_execute_fsm() argument
525 switch (ctx->state) { in rp_cc_execute_fsm()
528 rp_cc_state_idle(conn, ctx, evt, param); in rp_cc_execute_fsm()
531 rp_cc_state_wait_rx_cis_req(conn, ctx, evt, param); in rp_cc_execute_fsm()
534 rp_cc_state_wait_tx_reject_ind(conn, ctx, evt, param); in rp_cc_execute_fsm()
537 rp_cc_state_wait_tx_cis_rsp(conn, ctx, evt, param); in rp_cc_execute_fsm()
540 rp_cc_state_wait_reply(conn, ctx, evt, param); in rp_cc_execute_fsm()
543 rp_cc_state_wait_rx_cis_ind(conn, ctx, evt, param); in rp_cc_execute_fsm()
546 rp_cc_state_wait_instant(conn, ctx, evt, param); in rp_cc_execute_fsm()
549 rp_cc_state_wait_cis_established(conn, ctx, evt, param); in rp_cc_execute_fsm()
552 rp_cc_state_wait_ntf_avail(conn, ctx, evt, param); in rp_cc_execute_fsm()
560 void llcp_rp_cc_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_rp_cc_rx() argument
566 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_REQ, pdu); in llcp_rp_cc_rx()
569 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_IND, pdu); in llcp_rp_cc_rx()
573 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_REJECT, pdu); in llcp_rp_cc_rx()
580 ctx->state = RP_CC_STATE_IDLE; in llcp_rp_cc_rx()
585 bool llcp_rp_cc_awaiting_reply(struct proc_ctx *ctx) in llcp_rp_cc_awaiting_reply() argument
587 return (ctx->state == RP_CC_STATE_WAIT_REPLY); in llcp_rp_cc_awaiting_reply()
590 bool llcp_rp_cc_awaiting_established(struct proc_ctx *ctx) in llcp_rp_cc_awaiting_established() argument
592 return (ctx->state == RP_CC_STATE_WAIT_CIS_ESTABLISHED); in llcp_rp_cc_awaiting_established()
595 void llcp_rp_cc_accept(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_accept() argument
597 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_REQ_ACCEPT, NULL); in llcp_rp_cc_accept()
600 void llcp_rp_cc_reject(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_reject() argument
602 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_REQ_REJECT, NULL); in llcp_rp_cc_reject()
605 void llcp_rp_cc_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_rp_cc_run() argument
607 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_RUN, param); in llcp_rp_cc_run()
610 bool llcp_rp_cc_awaiting_instant(struct proc_ctx *ctx) in llcp_rp_cc_awaiting_instant() argument
612 return (ctx->state == RP_CC_STATE_WAIT_INSTANT); in llcp_rp_cc_awaiting_instant()
615 void llcp_rp_cc_established(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_rp_cc_established() argument
617 rp_cc_execute_fsm(conn, ctx, RP_CC_EVT_CIS_ESTABLISHED, NULL); in llcp_rp_cc_established()
622 static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param);
660 static void lp_cc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) in lp_cc_tx() argument
666 tx = llcp_tx_alloc(conn, ctx); in lp_cc_tx()
674 llcp_pdu_encode_cis_req(ctx, pdu); in lp_cc_tx()
677 llcp_pdu_encode_cis_ind(ctx, pdu); in lp_cc_tx()
685 ctx->tx_opcode = pdu->llctrl.opcode; in lp_cc_tx()
691 void llcp_lp_cc_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_lp_cc_rx() argument
697 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_CIS_RSP, pdu); in llcp_lp_cc_rx()
701 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_REJECT, pdu); in llcp_lp_cc_rx()
708 ctx->state = LP_CC_STATE_IDLE; in llcp_lp_cc_rx()
713 void llcp_lp_cc_offset_calc_reply(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_lp_cc_offset_calc_reply() argument
715 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_OFFSET_CALC_REPLY, NULL); in llcp_lp_cc_offset_calc_reply()
718 static void lp_cc_offset_calc_req(struct ll_conn *conn, struct proc_ctx *ctx, in lp_cc_offset_calc_req() argument
721 if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in lp_cc_offset_calc_req()
722 ctx->state = LP_CC_STATE_WAIT_OFFSET_CALC_TX_REQ; in lp_cc_offset_calc_req()
727 err = ull_central_iso_cis_offset_get(ctx->data.cis_create.cis_handle, in lp_cc_offset_calc_req()
728 &ctx->data.cis_create.cis_offset_min, in lp_cc_offset_calc_req()
729 &ctx->data.cis_create.cis_offset_max, in lp_cc_offset_calc_req()
730 &ctx->data.cis_create.conn_event_count); in lp_cc_offset_calc_req()
732 ctx->state = LP_CC_STATE_WAIT_OFFSET_CALC; in lp_cc_offset_calc_req()
737 lp_cc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in lp_cc_offset_calc_req()
739 ctx->state = LP_CC_STATE_WAIT_RX_CIS_RSP; in lp_cc_offset_calc_req()
740 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_CIS_RSP; in lp_cc_offset_calc_req()
745 struct proc_ctx *ctx, in lp_cc_st_wait_offset_calc_tx_req() argument
750 lp_cc_offset_calc_req(conn, ctx, evt, param); in lp_cc_st_wait_offset_calc_tx_req()
759 struct proc_ctx *ctx, in lp_cc_st_wait_offset_calc() argument
769 ctx->state = LP_CC_STATE_WAIT_TX_CIS_REQ; in lp_cc_st_wait_offset_calc()
777 static void lp_cc_send_cis_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_send_cis_req() argument
780 if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in lp_cc_send_cis_req()
781 ctx->state = LP_CC_STATE_WAIT_TX_CIS_REQ; in lp_cc_send_cis_req()
783 lp_cc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_REQ); in lp_cc_send_cis_req()
785 ctx->state = LP_CC_STATE_WAIT_RX_CIS_RSP; in lp_cc_send_cis_req()
786 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_CIS_RSP; in lp_cc_send_cis_req()
790 static void lp_cc_st_wait_tx_cis_req(struct ll_conn *conn, struct proc_ctx *ctx, in lp_cc_st_wait_tx_cis_req() argument
795 lp_cc_send_cis_req(conn, ctx, evt, param); in lp_cc_st_wait_tx_cis_req()
803 static void lp_cc_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_cc_complete() argument
805 cc_ntf_established(conn, ctx); in lp_cc_complete()
807 ctx->state = LP_CC_STATE_IDLE; in lp_cc_complete()
810 static void lp_cc_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_cc_st_idle() argument
814 switch (ctx->proc) { in lp_cc_st_idle()
820 lp_cc_offset_calc_req(conn, ctx, evt, param); in lp_cc_st_idle()
823 ctx->data.cis_create.error = BT_HCI_ERR_UNSUPP_REMOTE_FEATURE; in lp_cc_st_idle()
824 ctx->state = LP_CC_STATE_WAIT_NTF_AVAIL; in lp_cc_st_idle()
839 static void lp_cc_state_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_state_wait_ntf_avail() argument
845 ctx->node_ref.rx = llcp_ntf_alloc(); in lp_cc_state_wait_ntf_avail()
847 ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RETAIN; in lp_cc_state_wait_ntf_avail()
850 lp_cc_complete(conn, ctx, evt, param); in lp_cc_state_wait_ntf_avail()
859 static void cc_prepare_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx) in cc_prepare_cis_ind() argument
864 err = ull_central_iso_setup(ctx->data.cis_create.cis_handle, in cc_prepare_cis_ind()
865 &ctx->data.cis_create.cig_sync_delay, in cc_prepare_cis_ind()
866 &ctx->data.cis_create.cis_sync_delay, in cc_prepare_cis_ind()
867 &ctx->data.cis_create.cis_offset_min, in cc_prepare_cis_ind()
868 &ctx->data.cis_create.cis_offset_max, in cc_prepare_cis_ind()
869 &ctx->data.cis_create.conn_event_count, in cc_prepare_cis_ind()
870 ctx->data.cis_create.aa); in cc_prepare_cis_ind()
873 ctx->state = LP_CC_STATE_WAIT_INSTANT; in cc_prepare_cis_ind()
874 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_UNUSED; in cc_prepare_cis_ind()
877 static void lp_cc_send_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_send_cis_ind() argument
880 if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { in lp_cc_send_cis_ind()
881 ctx->state = LP_CC_STATE_WAIT_TX_CIS_IND; in lp_cc_send_cis_ind()
883 cc_prepare_cis_ind(conn, ctx); in lp_cc_send_cis_ind()
884 lp_cc_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_CIS_IND); in lp_cc_send_cis_ind()
888 static void lp_cc_st_wait_rx_cis_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_rx_cis_rsp() argument
896 llcp_pdu_decode_cis_rsp(ctx, param); in lp_cc_st_wait_rx_cis_rsp()
899 llcp_rx_node_retain(ctx); in lp_cc_st_wait_rx_cis_rsp()
901 lp_cc_send_cis_ind(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp()
906 ctx->data.cis_create.error = BT_HCI_ERR_UNSUPP_REMOTE_FEATURE; in lp_cc_st_wait_rx_cis_rsp()
907 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp()
914 ctx->data.cis_create.error = pdu->llctrl.reject_ext_ind.error_code; in lp_cc_st_wait_rx_cis_rsp()
915 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp()
923 static void lp_cc_st_wait_notify_cancel(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_notify_cancel() argument
929 ctx->node_ref.rx = llcp_ntf_alloc(); in lp_cc_st_wait_notify_cancel()
932 ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RETAIN; in lp_cc_st_wait_notify_cancel()
933 ctx->state = LP_CC_STATE_WAIT_ESTABLISHED; in lp_cc_st_wait_notify_cancel()
935 llcp_lp_cc_established(conn, ctx); in lp_cc_st_wait_notify_cancel()
944 static void lp_cc_st_wait_rx_cis_rsp_cancel(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_rx_cis_rsp_cancel() argument
953 tx = llcp_tx_alloc(conn, ctx); in lp_cc_st_wait_rx_cis_rsp_cancel()
960 ctx->data.cis_create.error); in lp_cc_st_wait_rx_cis_rsp_cancel()
964 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp_cancel()
968 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_rx_cis_rsp_cancel()
976 static void lp_cc_st_wait_tx_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx, in lp_cc_st_wait_tx_cis_ind() argument
981 lp_cc_send_cis_ind(conn, ctx, evt, param); in lp_cc_st_wait_tx_cis_ind()
989 static void lp_cc_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_check_instant() argument
997 start_event_count = ctx->data.cis_create.conn_event_count; in lp_cc_check_instant()
1002 ull_conn_iso_start(conn, ctx->data.cis_create.cis_handle, in lp_cc_check_instant()
1008 ctx->state = LP_CC_STATE_WAIT_ESTABLISHED; in lp_cc_check_instant()
1012 static void lp_cc_st_wait_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_instant() argument
1017 lp_cc_check_instant(conn, ctx, evt, param); in lp_cc_st_wait_instant()
1025 static void lp_cc_st_wait_established(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_cc_st_wait_established() argument
1031 lp_cc_complete(conn, ctx, evt, param); in lp_cc_st_wait_established()
1039 static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_cc_execute_fsm() argument
1041 switch (ctx->state) { in lp_cc_execute_fsm()
1043 lp_cc_st_idle(conn, ctx, evt, param); in lp_cc_execute_fsm()
1046 lp_cc_state_wait_ntf_avail(conn, ctx, evt, param); in lp_cc_execute_fsm()
1049 lp_cc_st_wait_offset_calc_tx_req(conn, ctx, evt, param); in lp_cc_execute_fsm()
1052 lp_cc_st_wait_offset_calc(conn, ctx, evt, param); in lp_cc_execute_fsm()
1055 lp_cc_st_wait_tx_cis_req(conn, ctx, evt, param); in lp_cc_execute_fsm()
1058 lp_cc_st_wait_rx_cis_rsp(conn, ctx, evt, param); in lp_cc_execute_fsm()
1061 lp_cc_st_wait_notify_cancel(conn, ctx, evt, param); in lp_cc_execute_fsm()
1064 lp_cc_st_wait_rx_cis_rsp_cancel(conn, ctx, evt, param); in lp_cc_execute_fsm()
1067 lp_cc_st_wait_tx_cis_ind(conn, ctx, evt, param); in lp_cc_execute_fsm()
1070 lp_cc_st_wait_instant(conn, ctx, evt, param); in lp_cc_execute_fsm()
1073 lp_cc_st_wait_established(conn, ctx, evt, param); in lp_cc_execute_fsm()
1082 void llcp_lp_cc_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_lp_cc_run() argument
1084 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_RUN, param); in llcp_lp_cc_run()
1087 bool llcp_lp_cc_is_active(struct proc_ctx *ctx) in llcp_lp_cc_is_active() argument
1089 return ctx->state != LP_CC_STATE_IDLE; in llcp_lp_cc_is_active()
1092 bool llcp_lp_cc_awaiting_established(struct proc_ctx *ctx) in llcp_lp_cc_awaiting_established() argument
1094 return (ctx->state == LP_CC_STATE_WAIT_ESTABLISHED); in llcp_lp_cc_awaiting_established()
1097 void llcp_lp_cc_established(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_lp_cc_established() argument
1099 lp_cc_execute_fsm(conn, ctx, LP_CC_EVT_ESTABLISHED, NULL); in llcp_lp_cc_established()
1102 bool llcp_lp_cc_cancel(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_lp_cc_cancel() argument
1104 ctx->data.cis_create.error = BT_HCI_ERR_OP_CANCELLED_BY_HOST; in llcp_lp_cc_cancel()
1106 switch (ctx->state) { in llcp_lp_cc_cancel()
1111 ctx->state = LP_CC_STATE_WAIT_NOTIFY_CANCEL; in llcp_lp_cc_cancel()
1114 ctx->state = LP_CC_STATE_WAIT_RX_CIS_RSP_CANCEL; in llcp_lp_cc_cancel()