Lines Matching refs:handle

340 …ost_device_t host_id, const spi_device_interface_config_t *dev_config, spi_device_handle_t *handle)  in spi_bus_add_device()  argument
476 *handle = dev; in spi_bus_add_device()
491 esp_err_t spi_bus_remove_device(spi_device_handle_t handle) in spi_bus_remove_device() argument
493 SPI_CHECK(handle!=NULL, "invalid handle", ESP_ERR_INVALID_ARG); in spi_bus_remove_device()
496 …SPI_CHECK(uxQueueMessagesWaiting(handle->trans_queue)==0, "Have unfinished transactions", ESP_ERR_… in spi_bus_remove_device()
497 …SPI_CHECK(handle->host->cur_cs == DEV_NUM_MAX || handle->host->device[handle->host->cur_cs] != han… in spi_bus_remove_device()
498 if (handle->ret_queue) { in spi_bus_remove_device()
499 …SPI_CHECK(uxQueueMessagesWaiting(handle->ret_queue)==0, "Have unfinished transactions", ESP_ERR_IN… in spi_bus_remove_device()
503 if (handle->cfg.clock_source == SPI_CLK_SRC_RC_FAST) { in spi_bus_remove_device()
509 int spics_io_num = handle->cfg.spics_io_num; in spi_bus_remove_device()
513 if (handle->trans_queue) vQueueDelete(handle->trans_queue); in spi_bus_remove_device()
514 if (handle->ret_queue) vQueueDelete(handle->ret_queue); in spi_bus_remove_device()
515 spi_bus_lock_unregister_dev(handle->dev_lock); in spi_bus_remove_device()
517 assert(handle->host->device[handle->id] == handle); in spi_bus_remove_device()
518 handle->host->device[handle->id] = NULL; in spi_bus_remove_device()
519 free(handle); in spi_bus_remove_device()
523 esp_err_t spi_device_get_actual_freq(spi_device_handle_t handle, int* freq_khz) in spi_device_get_actual_freq() argument
525 if ((spi_device_t*)handle == NULL || freq_khz == NULL) { in spi_device_get_actual_freq()
529 *freq_khz = handle->real_clk_freq_hz / 1000; in spi_device_get_actual_freq()
761 static SPI_MASTER_ISR_ATTR esp_err_t check_trans_valid(spi_device_handle_t handle, spi_transaction_… in check_trans_valid() argument
763 SPI_CHECK(handle!=NULL, "invalid dev handle", ESP_ERR_INVALID_ARG); in check_trans_valid()
764 spi_host_t *host = handle->host; in check_trans_valid()
769 …d = (((trans_desc->flags & SPI_TRANS_VARIABLE_DUMMY)? t_ext->dummy_bits: handle->cfg.dummy_bits) !… in check_trans_valid()
770 bool extra_dummy_enabled = handle->hal_dev.timing_conf.timing_dummy; in check_trans_valid()
771 bool is_half_duplex = ((handle->cfg.flags & SPI_DEVICE_HALFDUPLEX) != 0); in check_trans_valid()
782 …SPI_CHECK(!((trans_desc->flags & SPI_TRANS_MODE_OCT) && (handle->cfg.flags & SPI_DEVICE_3WIRE)), "… in check_trans_valid()
785 …SPI_CHECK(!((trans_desc->flags & (SPI_TRANS_MODE_DIO|SPI_TRANS_MODE_QIO)) && (handle->cfg.flags & … in check_trans_valid()
885 esp_err_t SPI_MASTER_ATTR spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t *tra… in spi_device_queue_trans() argument
887 esp_err_t ret = check_trans_valid(handle, trans_desc); in spi_device_queue_trans()
890 spi_host_t *host = handle->host; in spi_device_queue_trans()
892 …SPI_CHECK(!spi_bus_device_is_polling(handle), "Cannot queue new transaction while previous polling… in spi_device_queue_trans()
896 if (host->device_acquiring_lock != handle && (trans_desc->flags & SPI_TRANS_CS_KEEP_ACTIVE)) { in spi_device_queue_trans()
911 BaseType_t r = xQueueSend(handle->trans_queue, (void *)&trans_buf, ticks_to_wait); in spi_device_queue_trans()
922 ret = spi_bus_lock_bg_request(handle->dev_lock); in spi_device_queue_trans()
933 esp_err_t SPI_MASTER_ATTR spi_device_get_trans_result(spi_device_handle_t handle, spi_transaction_t… in spi_device_get_trans_result() argument
937 SPI_CHECK(handle!=NULL, "invalid dev handle", ESP_ERR_INVALID_ARG); in spi_device_get_trans_result()
940 …SPI_CHECK(!(handle->cfg.flags & SPI_DEVICE_NO_RETURN_RESULT), "API not Supported!", ESP_ERR_NOT_SU… in spi_device_get_trans_result()
943 r=xQueueReceive(handle->ret_queue, (void*)&trans_buf, ticks_to_wait); in spi_device_get_trans_result()
958 esp_err_t SPI_MASTER_ATTR spi_device_transmit(spi_device_handle_t handle, spi_transaction_t *trans_… in spi_device_transmit() argument
963 ret = spi_device_queue_trans(handle, trans_desc, portMAX_DELAY); in spi_device_transmit()
966 ret = spi_device_get_trans_result(handle, &ret_trans, portMAX_DELAY); in spi_device_transmit()
1037 esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_start(spi_device_handle_t handle, spi_transaction_… in spi_device_polling_start() argument
1041 ret = check_trans_valid(handle, trans_desc); in spi_device_polling_start()
1043 …SPI_CHECK(!spi_bus_device_is_polling(handle), "Cannot send polling transaction while the previous … in spi_device_polling_start()
1048 spi_host_t *host = handle->host; in spi_device_polling_start()
1049 if (host->device_acquiring_lock != handle) { in spi_device_polling_start()
1054 ret = spi_bus_lock_acquire_start(handle->dev_lock, ticks_to_wait); in spi_device_polling_start()
1057 ret = spi_bus_lock_wait_bg_done(handle->dev_lock, ticks_to_wait); in spi_device_polling_start()
1068 spi_new_trans(handle, &host->cur_trans_buf); in spi_device_polling_start()
1073 esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_end(spi_device_handle_t handle, TickType_t ticks_t… in spi_device_polling_end() argument
1075 SPI_CHECK(handle != NULL, "invalid dev handle", ESP_ERR_INVALID_ARG); in spi_device_polling_end()
1076 spi_host_t *host = handle->host; in spi_device_polling_end()
1078 assert(host->cur_cs == handle->id); in spi_device_polling_end()
1079 assert(handle == get_acquiring_dev(host)); in spi_device_polling_end()
1099 if (host->device_acquiring_lock != handle) { in spi_device_polling_end()
1101 spi_bus_lock_acquire_end(handle->dev_lock); in spi_device_polling_end()
1107 esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_transmit(spi_device_handle_t handle, spi_transacti… in spi_device_polling_transmit() argument
1110 ret = spi_device_polling_start(handle, trans_desc, portMAX_DELAY); in spi_device_polling_transmit()
1113 return spi_device_polling_end(handle, portMAX_DELAY); in spi_device_polling_transmit()