void spi_data_queue_destroy(void) { int i; if (spi_div_buf != NULL) { for (i = 0 ; i < SPI_DATA_QUEUE_TYPE_NB ; i++) { if (spi_div_buf[i].buffer != NULL) { spi_os_vfree(spi_div_buf[i].buffer); spi_div_buf[i].buffer = NULL; } } } if (gspi_data_prepare_packet != NULL) { spi_os_vfree(gspi_data_prepare_packet); gspi_data_prepare_packet = NULL; } if (gspi_data_packet_buf != NULL) { spi_os_free(gspi_data_packet_buf); gspi_data_packet_buf = NULL; } if (spi_div_buf != NULL) { spi_os_vfree(spi_div_buf); spi_div_buf = NULL; } if (spi_queue_info != NULL) { spi_os_vfree(spi_queue_info); spi_queue_info = NULL; } }
/********************************************************** Prototype void spi_app_receive_msg ( struct spi_os_msg * msg ) Type function Description receive data from spi task message queue and Pack data for spi data. Then inqueue the message to spi_data_queue_XXX_tx Param input msg : message received from other task Return value (none) ***********************************************************/ void spi_receive_msg_from_app(struct spi_os_msg *msg) { enum SPI_MAIN_MSG_T type; enum SPI_DATA_QUEUE_TYPE_T q_type; enum SPI_DATA_TYPE_T mux_type; unsigned int in_length = 0, out_length = 0; void *in_buffer = 0; void *out_buffer = 0; type = msg->signal_code; in_length = msg->data_length; in_buffer = msg->data; switch (type) { case SPI_MAIN_MSG_IPC_SEND: q_type = SPI_DATA_QUEUE_TYPE_IPC_TX; mux_type = SPI_DATA_MUX_IPC; break; case SPI_MAIN_MSG_RAW_SEND: q_type = SPI_DATA_QUEUE_TYPE_RAW_TX; mux_type = SPI_DATA_MUX_RAW; break; case SPI_MAIN_MSG_RFS_SEND: q_type = SPI_DATA_QUEUE_TYPE_RFS_TX; mux_type = SPI_DATA_MUX_RFS; break; default: SPI_OS_ASSERT(("[SPI] spi_app_receive_msg Unknown type")); return; } out_buffer = spi_os_malloc(in_length+SPI_DATA_HEADER_SIZE); out_length = _pack_spi_data(mux_type, out_buffer, in_buffer, in_length); if (spi_data_inqueue(&spi_queue_info[q_type], out_buffer, out_length) == 0) { SPI_OS_ASSERT(("[SPI] spi_app_receive_msg inqueue[%d] Fail", q_type)); } spi_os_free(in_buffer); spi_os_free(out_buffer); }