Home
last modified time | relevance | path

Searched full:ctx (Results 1 – 25 of 851) sorted by relevance

12345678910>>...35

/Zephyr-latest/drivers/spi/
Dspi_context.h78 static inline bool spi_context_configured(struct spi_context *ctx, in spi_context_configured() argument
81 return !!(ctx->config == config); in spi_context_configured()
84 static inline bool spi_context_is_slave(struct spi_context *ctx) in spi_context_is_slave() argument
86 return (ctx->config->operation & SPI_OP_MODE_SLAVE); in spi_context_is_slave()
89 static inline void spi_context_lock(struct spi_context *ctx, in spi_context_lock() argument
96 (k_sem_count_get(&ctx->lock) == 0) && in spi_context_lock()
97 (ctx->owner == spi_cfg)) { in spi_context_lock()
101 k_sem_take(&ctx->lock, K_FOREVER); in spi_context_lock()
102 ctx->owner = spi_cfg; in spi_context_lock()
105 ctx->asynchronous = asynchronous; in spi_context_lock()
[all …]
/Zephyr-latest/tests/net/lib/lwm2m/lwm2m_engine/src/
Dmain.c98 struct lwm2m_ctx ctx; in ZTEST() local
101 (void)memset(&ctx, 0x0, sizeof(ctx)); in ZTEST()
103 ctx.remote_addr.sa_family = AF_INET; in ZTEST()
104 ctx.sock_fd = -1; in ZTEST()
105 ctx.load_credentials = NULL; in ZTEST()
106 ctx.desthostname = host_name; in ZTEST()
107 ctx.desthostnamelen = strlen(host_name); in ZTEST()
108 ctx.use_dtls = true; in ZTEST()
110 ret = lwm2m_engine_start(&ctx); in ZTEST()
118 zassert_equal(eng_ctx[0], &ctx); in ZTEST()
[all …]
/Zephyr-latest/subsys/storage/stream/
Dstream_flash.c26 struct stream_flash_ctx *ctx = (struct stream_flash_ctx *) param; in settings_direct_loader() local
34 if (cb_len != sizeof(ctx->bytes_written)) { in settings_direct_loader()
40 if (bytes_written >= ctx->bytes_written) { in settings_direct_loader()
41 ctx->bytes_written = bytes_written; in settings_direct_loader()
44 bytes_written, ctx->bytes_written); in settings_direct_loader()
51 off_t offset = (off_t) (ctx->offset + ctx->bytes_written) - 1; in settings_direct_loader()
56 if (ctx->bytes_written > 0) { in settings_direct_loader()
57 rc = flash_get_page_info_by_offs(ctx->fdev, offset, in settings_direct_loader()
63 ctx->last_erased_page_start_offset = page.start_offset; in settings_direct_loader()
65 ctx->last_erased_page_start_offset = -1; in settings_direct_loader()
[all …]
/Zephyr-latest/tests/bluetooth/common/testlib/src/
Datt_read.c42 struct bt_testlib_att_read_closure *ctx = in att_read_cb() local
45 k_mutex_lock(&ctx->lock, K_FOREVER); in att_read_cb()
47 ctx->att_err = att_err; in att_read_cb()
49 if (!att_err && ctx->result_handle) { in att_read_cb()
51 *ctx->result_handle = params->by_uuid.start_handle; in att_read_cb()
54 if (!att_err && ctx->result_size) { in att_read_cb()
56 *ctx->result_size += read_len; in att_read_cb()
57 if (*ctx->result_size > BT_ATT_MAX_ATTRIBUTE_LEN) { in att_read_cb()
62 if (read_data && ctx->result_data) { in att_read_cb()
64 MIN(read_len, net_buf_simple_tailroom(ctx->result_data)); in att_read_cb()
[all …]
/Zephyr-latest/subsys/bluetooth/controller/ll_sw/
Dull_llcp_cc.c56 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()
[all …]
Dull_llcp_conn_upd.c165 static void cu_update_conn_parameters(struct ll_conn *conn, struct proc_ctx *ctx) in cu_update_conn_parameters() argument
167 ctx->data.cu.params_changed = cu_have_params_changed( in cu_update_conn_parameters()
168 conn, ctx->data.cu.interval_max, ctx->data.cu.latency, ctx->data.cu.timeout); in cu_update_conn_parameters()
170 ull_conn_update_parameters(conn, (ctx->proc == PROC_CONN_UPDATE), ctx->data.cu.win_size, in cu_update_conn_parameters()
171 ctx->data.cu.win_offset_us, ctx->data.cu.interval_max, in cu_update_conn_parameters()
172 ctx->data.cu.latency, ctx->data.cu.timeout, in cu_update_conn_parameters()
173 ctx->data.cu.instant); in cu_update_conn_parameters()
177 static bool cu_check_conn_parameters(struct ll_conn *conn, struct proc_ctx *ctx) in cu_check_conn_parameters() argument
179 const uint16_t interval_min = ctx->data.cu.interval_min; in cu_check_conn_parameters()
180 const uint16_t interval_max = ctx->data.cu.interval_max; /* unit conn events (ie 1.25ms) */ in cu_check_conn_parameters()
[all …]
Dull_llcp_phy.c145 static void pu_prep_update_ind(struct ll_conn *conn, struct proc_ctx *ctx) in pu_prep_update_ind() argument
147 ctx->data.pu.tx = pu_select_phy(ctx->data.pu.tx); in pu_prep_update_ind()
148 ctx->data.pu.rx = pu_select_phy(ctx->data.pu.rx); in pu_prep_update_ind()
150 if (ctx->data.pu.tx != conn->lll.phy_tx) { in pu_prep_update_ind()
151 ctx->data.pu.c_to_p_phy = ctx->data.pu.tx; in pu_prep_update_ind()
153 ctx->data.pu.c_to_p_phy = 0U; in pu_prep_update_ind()
155 if (ctx->data.pu.rx != conn->lll.phy_rx) { in pu_prep_update_ind()
156 ctx->data.pu.p_to_c_phy = ctx->data.pu.rx; in pu_prep_update_ind()
158 ctx->data.pu.p_to_c_phy = 0U; in pu_prep_update_ind()
201 static uint8_t pu_check_update_ind(struct ll_conn *conn, struct proc_ctx *ctx) in pu_check_update_ind() argument
[all …]
Dull_llcp_past.c81 static uint8_t rp_check_phy(struct ll_conn *conn, struct proc_ctx *ctx, in rp_check_phy() argument
102 static void rp_past_complete(struct ll_conn *conn, struct proc_ctx *ctx) in rp_past_complete() argument
105 ctx->state = RP_PAST_STATE_IDLE; in rp_past_complete()
108 static void rp_past_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) in rp_past_st_idle() argument
112 ctx->state = RP_PAST_STATE_WAIT_RX; in rp_past_st_idle()
125 struct proc_ctx *ctx; in rp_past_resolve_cb() local
131 ctx = llcp_rr_peek(conn); in rp_past_resolve_cb()
132 if (!ctx) { in rp_past_resolve_cb()
139 if (ctx->state != RP_PAST_STATE_WAIT_RESOLVE_COMPLETE) { in rp_past_resolve_cb()
152 memcpy(&ctx->data.periodic_sync.adv_addr, &id_addr->val, sizeof(bt_addr_t)); in rp_past_resolve_cb()
[all …]
Dull_llcp.c97 struct proc_ctx *ctx; in proc_ctx_acquire() local
99 ctx = (struct proc_ctx *)mem_acquire(&owner->free); in proc_ctx_acquire()
101 if (ctx) { in proc_ctx_acquire()
103 ctx->owner = owner; in proc_ctx_acquire()
106 return ctx; in proc_ctx_acquire()
109 void llcp_proc_ctx_release(struct proc_ctx *ctx) in llcp_proc_ctx_release() argument
112 LL_ASSERT(ctx->owner); in llcp_proc_ctx_release()
115 mem_release(ctx, &ctx->owner->free); in llcp_proc_ctx_release()
135 static inline bool static_tx_buffer_available(struct ll_conn *conn, struct proc_ctx *ctx) in static_tx_buffer_available() argument
153 bool llcp_tx_alloc_peek(struct ll_conn *conn, struct proc_ctx *ctx) in llcp_tx_alloc_peek() argument
[all …]
Dull_llcp_enc.c148 static void enc_setup_lll(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t role) in enc_setup_lll() argument
153 ecb_encrypt(&ctx->data.enc.ltk[0], &ctx->data.enc.skd[0], NULL, &conn->lll.ccm_rx.key[0]); in enc_setup_lll()
183 static struct node_tx *llcp_lp_enc_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) in llcp_lp_enc_tx() argument
189 tx = llcp_tx_alloc(conn, ctx); in llcp_lp_enc_tx()
197 llcp_pdu_encode_enc_req(ctx, pdu); in llcp_lp_enc_tx()
212 ctx->tx_opcode = pdu->llctrl.opcode; in llcp_lp_enc_tx()
223 static void lp_enc_ntf(struct ll_conn *conn, struct proc_ctx *ctx) in lp_enc_ntf() argument
229 ntf = ctx->node_ref.rx; in lp_enc_ntf()
230 ctx->node_ref.rx = NULL; in lp_enc_ntf()
237 if (ctx->data.enc.error == BT_HCI_ERR_SUCCESS) { in lp_enc_ntf()
[all …]
Dull_llcp_chmu.c85 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()
[all …]
Dull_llcp_common.c118 static void lp_comm_ntf(struct ll_conn *conn, struct proc_ctx *ctx);
119 static void lp_comm_terminate_invalid_pdu(struct ll_conn *conn, struct proc_ctx *ctx);
155 static void lp_comm_tx(struct ll_conn *conn, struct proc_ctx *ctx) in lp_comm_tx() argument
161 tx = llcp_tx_alloc(conn, ctx); in lp_comm_tx()
167 switch (ctx->proc) { in lp_comm_tx()
171 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_PING_RSP; in lp_comm_tx()
176 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_RSP; in lp_comm_tx()
180 llcp_pdu_encode_min_used_chans_ind(ctx, pdu); in lp_comm_tx()
181 ctx->node_ref.tx_ack = tx; in lp_comm_tx()
182 ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_UNUSED; in lp_comm_tx()
[all …]
/Zephyr-latest/drivers/adc/
Dadc_context.h29 static void adc_context_start_sampling(struct adc_context *ctx);
30 static void adc_context_update_buffer_pointer(struct adc_context *ctx,
38 static void adc_context_enable_timer(struct adc_context *ctx);
39 static void adc_context_disable_timer(struct adc_context *ctx);
48 static void adc_context_on_complete(struct adc_context *ctx, int status);
92 static inline void adc_context_init(struct adc_context *ctx) in adc_context_init() argument
95 k_timer_init(&ctx->timer, adc_context_on_timer_expired, NULL); in adc_context_init()
97 k_sem_init(&ctx->lock, 0, 1); in adc_context_init()
98 k_sem_init(&ctx->sync, 0, 1); in adc_context_init()
101 static inline void adc_context_request_next_sampling(struct adc_context *ctx) in adc_context_request_next_sampling() argument
[all …]
/Zephyr-latest/drivers/disk/
Dflashdisk.c53 static inline bool flashdisk_with_erase(const struct flashdisk_data *ctx) in flashdisk_with_erase() argument
55 ARG_UNUSED(ctx); in flashdisk_with_erase()
58 return ctx->erase_required; in flashdisk_with_erase()
66 static inline void flashdisk_probe_erase(struct flashdisk_data *ctx) in flashdisk_probe_erase() argument
69 ctx->erase_required = in flashdisk_probe_erase()
70 flash_params_get_erase_cap(flash_get_parameters(ctx->info.dev)) & in flashdisk_probe_erase()
73 ARG_UNUSED(ctx); in flashdisk_probe_erase()
87 static int flashdisk_init_runtime(struct flashdisk_data *ctx, in flashdisk_init_runtime() argument
94 flashdisk_probe_erase(ctx); in flashdisk_init_runtime()
96 if (IS_ENABLED(CONFIG_FLASHDISK_VERIFY_PAGE_LAYOUT) && flashdisk_with_erase(ctx)) { in flashdisk_init_runtime()
[all …]
/Zephyr-latest/subsys/net/l2/ppp/
Dlink.c19 static void lcp_up(struct ppp_context *ctx) in lcp_up() argument
27 proto->lower_up(ctx); in lcp_up()
32 static void do_network(struct ppp_context *ctx) in do_network() argument
34 ppp_change_phase(ctx, PPP_NETWORK); in do_network()
39 proto->open(ctx); in do_network()
56 ctx->network_protos_open++; in do_network()
57 proto->open(ctx); in do_network()
61 if (ctx->network_protos_open == 0) { in do_network()
65 proto->close(ctx, "No network protocols open"); in do_network()
70 static void do_auth(struct ppp_context *ctx) in do_auth() argument
[all …]
Dnetwork.c19 void ppp_network_up(struct ppp_context *ctx, int proto) in ppp_network_up() argument
21 if (ctx->network_protos_up == 0) { in ppp_network_up()
22 ppp_change_phase(ctx, PPP_RUNNING); in ppp_network_up()
25 ctx->network_protos_up++; in ppp_network_up()
27 NET_DBG("[%p] Proto %s (0x%04x) %s (%d)", ctx, ppp_proto2str(proto), in ppp_network_up()
28 proto, "up", ctx->network_protos_up); in ppp_network_up()
31 void ppp_network_down(struct ppp_context *ctx, int proto) in ppp_network_down() argument
33 ctx->network_protos_up--; in ppp_network_down()
35 if (ctx->network_protos_up <= 0) { in ppp_network_down()
36 ctx->network_protos_up = 0; in ppp_network_down()
[all …]
Dpap.c14 static enum net_verdict pap_handle(struct ppp_context *ctx, in pap_handle() argument
18 return ppp_fsm_input(&ctx->pap.fsm, PPP_PAP, pkt); in pap_handle()
53 static void pap_lower_down(struct ppp_context *ctx) in pap_lower_down() argument
55 ppp_fsm_lower_down(&ctx->pap.fsm); in pap_lower_down()
58 static void pap_lower_up(struct ppp_context *ctx) in pap_lower_up() argument
60 ppp_fsm_lower_up(&ctx->pap.fsm); in pap_lower_up()
63 static void pap_open(struct ppp_context *ctx) in pap_open() argument
65 ppp_fsm_open(&ctx->pap.fsm); in pap_open()
68 static void pap_close(struct ppp_context *ctx, const uint8_t *reason) in pap_close() argument
70 ppp_fsm_close(&ctx->pap.fsm, reason); in pap_close()
[all …]
/Zephyr-latest/subsys/modbus/
Dmodbus_client.c29 static int mbc_validate_response_fc(struct modbus_context *ctx, in mbc_validate_response_fc() argument
33 uint8_t resp_fc = ctx->rx_adu.fc; in mbc_validate_response_fc()
34 uint8_t excep_code = ctx->rx_adu.data[0]; in mbc_validate_response_fc()
38 if (unit_id != ctx->rx_adu.unit_id) { in mbc_validate_response_fc()
57 static int mbc_validate_fc03fp_response(struct modbus_context *ctx, float *ptbl) in mbc_validate_fc03fp_response() argument
64 resp_byte_cnt = ctx->rx_adu.data[0]; in mbc_validate_fc03fp_response()
65 resp_data = &ctx->rx_adu.data[1]; in mbc_validate_fc03fp_response()
66 req_qty = sys_get_be16(&ctx->tx_adu.data[2]); in mbc_validate_fc03fp_response()
84 static int mbc_validate_rd_response(struct modbus_context *ctx, in mbc_validate_rd_response() argument
101 resp_byte_cnt = ctx->rx_adu.data[0]; in mbc_validate_rd_response()
[all …]
Dmodbus_core.c70 struct modbus_context *ctx; in modbus_rx_handler() local
72 ctx = CONTAINER_OF(item, struct modbus_context, server_work); in modbus_rx_handler()
74 switch (ctx->mode) { in modbus_rx_handler()
78 modbus_serial_rx_disable(ctx); in modbus_rx_handler()
79 ctx->rx_adu_err = modbus_serial_rx_adu(ctx); in modbus_rx_handler()
84 ctx->rx_adu_err = modbus_raw_rx_adu(ctx); in modbus_rx_handler()
92 if (ctx->client == true) { in modbus_rx_handler()
93 k_sem_give(&ctx->client_wait_sem); in modbus_rx_handler()
95 bool respond = modbus_server_handler(ctx); in modbus_rx_handler()
98 modbus_tx_adu(ctx); in modbus_rx_handler()
[all …]
Dmodbus_server.c34 void modbus_reset_stats(struct modbus_context *ctx) in modbus_reset_stats() argument
37 ctx->mbs_msg_ctr = 0; in modbus_reset_stats()
38 ctx->mbs_crc_err_ctr = 0; in modbus_reset_stats()
39 ctx->mbs_except_ctr = 0; in modbus_reset_stats()
40 ctx->mbs_server_msg_ctr = 0; in modbus_reset_stats()
41 ctx->mbs_noresp_ctr = 0; in modbus_reset_stats()
44 static void update_msg_ctr(struct modbus_context *ctx) in update_msg_ctr() argument
46 ctx->mbs_msg_ctr++; in update_msg_ctr()
49 static void update_crcerr_ctr(struct modbus_context *ctx) in update_crcerr_ctr() argument
51 ctx->mbs_crc_err_ctr++; in update_crcerr_ctr()
[all …]
/Zephyr-latest/drivers/modem/
Dmodem_receiver.c56 * @param ctx: receiver context to persist.
60 static int mdm_receiver_get(struct mdm_receiver_context *ctx) in mdm_receiver_get() argument
66 contexts[i] = ctx; in mdm_receiver_get()
79 * @param ctx: receiver context.
83 static void mdm_receiver_flush(struct mdm_receiver_context *ctx) in mdm_receiver_flush() argument
87 __ASSERT(ctx, "invalid ctx"); in mdm_receiver_flush()
88 __ASSERT(ctx->uart_dev, "invalid ctx device"); in mdm_receiver_flush()
90 while (uart_fifo_read(ctx->uart_dev, &c, 1) > 0) { in mdm_receiver_flush()
107 struct mdm_receiver_context *ctx; in mdm_receiver_isr() local
114 ctx = context_from_dev(uart_dev); in mdm_receiver_isr()
[all …]
/Zephyr-latest/subsys/usb/device_next/class/
Dusbd_msc.c149 struct msc_bot_ctx *ctx = usbd_class_get_private(c_data); in msc_get_bulk_in() local
150 struct msc_bot_desc *desc = ctx->desc; in msc_get_bulk_in()
162 struct msc_bot_ctx *ctx = usbd_class_get_private(c_data); in msc_get_bulk_out() local
163 struct msc_bot_desc *desc = ctx->desc; in msc_get_bulk_out()
174 struct msc_bot_ctx *ctx = usbd_class_get_private(c_data); in msc_queue_bulk_out_ep() local
179 if (atomic_test_and_set_bit(&ctx->bits, MSC_BULK_OUT_QUEUED)) { in msc_queue_bulk_out_ep()
196 atomic_clear_bit(&ctx->bits, MSC_BULK_OUT_QUEUED); in msc_queue_bulk_out_ep()
218 struct msc_bot_ctx *ctx = usbd_class_get_private(c_data); in msc_reset_handler() local
222 ctx->state = MSC_BBB_EXPECT_CBW; in msc_reset_handler()
223 for (i = 0; i < ctx->registered_luns; i++) { in msc_reset_handler()
[all …]
/Zephyr-latest/drivers/i2c/
Di2c_rtio.c55 void i2c_rtio_init(struct i2c_rtio *ctx, const struct device *dev) in i2c_rtio_init() argument
57 k_sem_init(&ctx->lock, 1, 1); in i2c_rtio_init()
58 mpsc_init(&ctx->io_q); in i2c_rtio_init()
59 ctx->txn_curr = NULL; in i2c_rtio_init()
60 ctx->txn_head = NULL; in i2c_rtio_init()
61 ctx->dt_spec.bus = dev; in i2c_rtio_init()
62 ctx->iodev.data = &ctx->dt_spec; in i2c_rtio_init()
63 ctx->iodev.api = &i2c_iodev_api; in i2c_rtio_init()
73 static bool i2c_rtio_next(struct i2c_rtio *ctx, bool completion) in i2c_rtio_next() argument
75 k_spinlock_key_t key = k_spin_lock(&ctx->slock); in i2c_rtio_next()
[all …]
/Zephyr-latest/subsys/net/lib/websocket/
Dwebsocket.c82 static int websocket_context_ref(struct websocket_context *ctx) in websocket_context_ref() argument
84 int old_rc = atomic_inc(&ctx->refcount); in websocket_context_ref()
89 static int websocket_context_unref(struct websocket_context *ctx) in websocket_context_unref() argument
91 int old_rc = atomic_dec(&ctx->refcount); in websocket_context_unref()
100 static inline bool websocket_context_is_used(struct websocket_context *ctx) in websocket_context_is_used() argument
102 return !!atomic_get(&ctx->refcount); in websocket_context_is_used()
107 struct websocket_context *ctx = NULL; in websocket_get() local
118 ctx = &contexts[i]; in websocket_get()
124 return ctx; in websocket_get()
129 struct websocket_context *ctx = NULL; in websocket_find() local
[all …]
/Zephyr-latest/subsys/net/l2/virtual/
Dvirtual.c26 struct virtual_interface_context *ctx, *tmp; in virtual_recv() local
33 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(interfaces, ctx, tmp, node) { in virtual_recv()
34 if (ctx->virtual_iface == NULL) { in virtual_recv()
38 api = net_if_get_device(ctx->virtual_iface)->api; in virtual_recv()
43 if (!net_if_is_up(ctx->virtual_iface)) { in virtual_recv()
45 net_if_get_by_iface(ctx->virtual_iface)); in virtual_recv()
49 verdict = api->recv(ctx->virtual_iface, pkt); in virtual_recv()
61 net_stats_update_bytes_recv(ctx->virtual_iface, in virtual_recv()
66 net_stats_update_processing_error(ctx->virtual_iface); in virtual_recv()
112 struct virtual_interface_context *ctx; in virtual_enable() local
[all …]

12345678910>>...35