Lines Matching full:ctx

85 static void lp_chmu_tx(struct ll_conn *conn, struct proc_ctx *ctx)  in lp_chmu_tx()  argument
91 tx = llcp_tx_alloc(conn, ctx); in lp_chmu_tx()
97 llcp_pdu_encode_chan_map_update_ind(ctx, pdu); in lp_chmu_tx()
99 ctx->tx_opcode = pdu->llctrl.opcode; in lp_chmu_tx()
105 static void lp_chmu_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in lp_chmu_complete() argument
107 ull_conn_chan_map_set(conn, ctx->data.chmu.chm); in lp_chmu_complete()
109 ctx->state = LP_CHMU_STATE_IDLE; in lp_chmu_complete()
112 static void lp_chmu_send_channel_map_update_ind(struct ll_conn *conn, struct proc_ctx *ctx, in lp_chmu_send_channel_map_update_ind() argument
116 !llcp_tx_alloc_peek(conn, ctx)) { in lp_chmu_send_channel_map_update_ind()
117 ctx->state = LP_CHMU_STATE_WAIT_TX_CHAN_MAP_IND; in lp_chmu_send_channel_map_update_ind()
121 ctx->data.chmu.instant = ull_conn_event_counter(conn) + CHMU_INSTANT_DELTA; in lp_chmu_send_channel_map_update_ind()
123 lp_chmu_tx(conn, ctx); in lp_chmu_send_channel_map_update_ind()
125 ctx->state = LP_CHMU_STATE_WAIT_INSTANT; in lp_chmu_send_channel_map_update_ind()
129 static void lp_chmu_st_wait_tx_chan_map_ind(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_chmu_st_wait_tx_chan_map_ind() argument
134 lp_chmu_send_channel_map_update_ind(conn, ctx, evt, param); in lp_chmu_st_wait_tx_chan_map_ind()
142 static void lp_chmu_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_chmu_check_instant() argument
147 if (is_instant_reached_or_passed(ctx->data.chmu.instant, event_counter)) { in lp_chmu_check_instant()
149 lp_chmu_complete(conn, ctx, evt, param); in lp_chmu_check_instant()
153 static void lp_chmu_st_wait_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_chmu_st_wait_instant() argument
158 lp_chmu_check_instant(conn, ctx, evt, param); in lp_chmu_st_wait_instant()
166 static void lp_chmu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in lp_chmu_execute_fsm() argument
169 switch (ctx->state) { in lp_chmu_execute_fsm()
175 lp_chmu_st_wait_tx_chan_map_ind(conn, ctx, evt, param); in lp_chmu_execute_fsm()
178 lp_chmu_st_wait_instant(conn, ctx, evt, param); in lp_chmu_execute_fsm()
186 void llcp_lp_chmu_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_lp_chmu_rx() argument
196 ctx->state = LP_CHMU_STATE_IDLE; in llcp_lp_chmu_rx()
201 void llcp_lp_chmu_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_lp_chmu_run() argument
203 lp_chmu_execute_fsm(conn, ctx, LP_CHMU_EVT_RUN, param); in llcp_lp_chmu_run()
206 bool llcp_lp_chmu_awaiting_instant(struct proc_ctx *ctx) in llcp_lp_chmu_awaiting_instant() argument
208 return (ctx->state == LP_CHMU_STATE_WAIT_INSTANT); in llcp_lp_chmu_awaiting_instant()
216 static void rp_chmu_complete(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_chmu_complete() argument
218 ull_conn_chan_map_set(conn, ctx->data.chmu.chm); in rp_chmu_complete()
220 ctx->state = RP_CHMU_STATE_IDLE; in rp_chmu_complete()
223 static void rp_chmu_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_chmu_st_idle() argument
227 ctx->state = RP_CHMU_STATE_WAIT_RX_CHAN_MAP_IND; in rp_chmu_st_idle()
235 static void rp_chmu_st_wait_rx_channel_map_update_ind(struct ll_conn *conn, struct proc_ctx *ctx, in rp_chmu_st_wait_rx_channel_map_update_ind() argument
240 llcp_pdu_decode_chan_map_update_ind(ctx, param); in rp_chmu_st_wait_rx_channel_map_update_ind()
241 if (is_instant_not_passed(ctx->data.chmu.instant, in rp_chmu_st_wait_rx_channel_map_update_ind()
244 ctx->state = RP_CHMU_STATE_WAIT_INSTANT; in rp_chmu_st_wait_rx_channel_map_update_ind()
248 ctx->state = RP_CHMU_STATE_IDLE; in rp_chmu_st_wait_rx_channel_map_update_ind()
257 static void rp_chmu_check_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_chmu_check_instant() argument
262 if (((event_counter - ctx->data.chmu.instant) & 0xFFFF) <= 0x7FFF) { in rp_chmu_check_instant()
263 rp_chmu_complete(conn, ctx, evt, param); in rp_chmu_check_instant()
267 static void rp_chmu_st_wait_instant(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_chmu_st_wait_instant() argument
272 rp_chmu_check_instant(conn, ctx, evt, param); in rp_chmu_st_wait_instant()
280 static void rp_chmu_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, in rp_chmu_execute_fsm() argument
283 switch (ctx->state) { in rp_chmu_execute_fsm()
285 rp_chmu_st_idle(conn, ctx, evt, param); in rp_chmu_execute_fsm()
288 rp_chmu_st_wait_rx_channel_map_update_ind(conn, ctx, evt, param); in rp_chmu_execute_fsm()
291 rp_chmu_st_wait_instant(conn, ctx, evt, param); in rp_chmu_execute_fsm()
299 void llcp_rp_chmu_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) in llcp_rp_chmu_rx() argument
305 rp_chmu_execute_fsm(conn, ctx, RP_CHMU_EVT_RX_CHAN_MAP_IND, pdu); in llcp_rp_chmu_rx()
312 ctx->state = RP_CHMU_STATE_IDLE; in llcp_rp_chmu_rx()
317 void llcp_rp_chmu_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) in llcp_rp_chmu_run() argument
319 rp_chmu_execute_fsm(conn, ctx, RP_CHMU_EVT_RUN, param); in llcp_rp_chmu_run()
322 bool llcp_rp_chmu_awaiting_instant(struct proc_ctx *ctx) in llcp_rp_chmu_awaiting_instant() argument
324 return (ctx->state == RP_CHMU_STATE_WAIT_INSTANT); in llcp_rp_chmu_awaiting_instant()