Quality RTOS & Embedded Software

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




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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS