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

Task communication, lwIP.

Posted by Nobody/Anonymous on September 11, 2006
Hi,
I need to make following thing:
First task is waiting on lwIP socket for commands, and second task is waiting on second lwIP socket.
When I get a "start sending" command on socket 1 (first task), I want to start sending data on socket 2 (second task).
And when I get a "stop sending" command, I want to stop sending data.
The question is:
If I use a global variable which is changed only by task 1, and read by task 2, do I need to use critical section? Changing a variable is probably done in one assembler command, am I right?(portCHAR on 32-bit ARM7)
Also, is there any better way to synchronize these two task? Semaphore doesnt fit well here I think, because I dont want the task 2 to take it, it only needs to read the flag to send or not.

Second question: is there any way not to block task when waiting on packet in lwIP? I want to send data continously and also check for commands from another side.

And third: can two tasks work with one lwip socket connection? For example: one sends and one waits for commands.

Please help ;]

RE: Task communication, lwIP.

Posted by Nobody/Anonymous on September 11, 2006
Q1 - A critical section is only required is both tasks change the variable. If only one task writes to the variable and the variable is of the natural width of the machine (32bit for arm7) then you are fine without. You can also use a semaphore for synchronization having the task 2 take the semaphore but never give it, and task 1 give the semaphore but never take it. Many people ignore this method of using semaphores, check out the uIP examples for this method.

Q2 - Not too familiar with lwIP but normally with berkley sockets you can setup them up to be either blocking or non blocking before binding. Check the documentation.

Q3 - Don't know.


[ 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