Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

how much data will xQueueSend() copy ?

Posted by chaabanemalki on May 19, 2014

Hello,

I created a Queue with one item, and the item size is 2048 bytes.

I use this queue to pass commands or data to a 3G module. the maximum size that a command can reach is about 256 bytes but for data can reach 2048.

I was wondering if I send 15 bytes in the queue will the xQueueSend() copy 2048 bytes or just 15 bytes ? and the same question for xQueueReceive() ?

Another question is from what I understand and in ordre to use queue. I have to copy the source buffer into the queue when sending, and copy the same data again when receiving the queue. Basically I'll have to use three times 2048 bytes : to pass data from the source buffer in the sending task to the queue and finally to recieve it in the receiving task. It it possible to use only the queue array that i reserved when creating the queue ?

I'm aware of passing pointers rather then actual data, (queue will be :2048 item, sizeof(item) = char) but that require to use global buffer and i'm trying to avoid global variable as much as possible.

any better ideas or help will be much appreciated


how much data will xQueueSend() copy ?

Posted by rtel on May 19, 2014

You do not get the option of how many bytes to copy into or out of a queue other than when you set the size of the queue at the time you call xQueueCreate().

Unless you have lots of RAM and can spare the time it takes to copy the data into and out of the queue I would very much recommend passing the data by reference. You may even be able to do it zero copy all the way through by having a task allocate the buffer (dynamically or from a pre-allocated pool [the pool size could be 1 if the task can wait for a buffer to be available!]), pass it by reference to whichever intermediary tasks there are, with the final task that touches the data passing the buffer to the 3G interface which is then set up to send the data directly from the original buffer. When the data has been sent the buffer is freed (either dynamically or by returning it to a pool of free buffers). This is how the zero copy interface in FreeRTOS+UDP works.

You have probably read it already, but the following link may have ideas: http://www.freertos.org/Embedded-RTOS-Queues.html

Regards.


how much data will xQueueSend() copy ?

Posted by chaabanemalki on May 21, 2014

Thank you for the informations


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists