FreeRTOS Emulator with SDL2 Based Graphics and Input Library  1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
async_sockets.c File Reference

Basic example functions on how to use the sockets in the AIO library. More...

#include <stdlib.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "gfx_print.h"
#include "async_sockets.h"
#include "demo_tasks.h"

Macros

#define FIRST_INT   buffer
 
#define FIRST_STRING   (FIRST_INT + sizeof(int))
 
#define COMMON_STRUCT   (FIRST_STRING + sizeof(char) * 10)
 
#define ITEM_ARRAY   (COMMON_STRUCT + sizeof(struct common_struct))
 
#define ITEM_ARRAY_ITEM(index)   (ITEM_ARRAY + index * sizeof(char) * 3)
 

Functions

void vUDPHandlerOne (size_t read_size, char *buffer, void *args)
 
void vUDPHandlerTwo (size_t read_size, char *buffer, void *args)
 
void vUDPDemoTask (void *pvParameters)
 
void vTCPHandler (size_t read_size, char *buffer, void *args)
 
void vTCPDemoTask (void *pvParameters)
 
int xCreateSocketTasks (void)
 Creates the UDP and TCP demo tasks used for demonstration purposes. More...
 
void vDeleteSocketTasks (void)
 Deletes the demo sockets tasks found in async_sockets.h. More...
 

Variables

aIO_handle_t udp_soc_one = NULL
 
aIO_handle_t udp_soc_two = NULL
 
aIO_handle_t tcp_soc = NULL
 
TaskHandle_t UDPDemoTask = NULL
 
TaskHandle_t TCPDemoTask = NULL
 

Detailed Description

Basic example functions on how to use the sockets in the AIO library.

Author
Alex Hoffman
Date
23 January 2023
----------------------------------------------------------------------
Copyright (C) Alexander Hoffman, 2023
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------

Macro Definition Documentation

◆ COMMON_STRUCT

#define COMMON_STRUCT   (FIRST_STRING + sizeof(char) * 10)

◆ FIRST_INT

#define FIRST_INT   buffer

◆ FIRST_STRING

#define FIRST_STRING   (FIRST_INT + sizeof(int))

◆ ITEM_ARRAY

#define ITEM_ARRAY   (COMMON_STRUCT + sizeof(struct common_struct))

◆ ITEM_ARRAY_ITEM

#define ITEM_ARRAY_ITEM (   index)    (ITEM_ARRAY + index * sizeof(char) * 3)

Function Documentation

◆ vTCPDemoTask()

void vTCPDemoTask ( void *  pvParameters)

◆ vTCPHandler()

void vTCPHandler ( size_t  read_size,
char *  buffer,
void *  args 
)

◆ vUDPDemoTask()

void vUDPDemoTask ( void *  pvParameters)

◆ vUDPHandlerOne()

void vUDPHandlerOne ( size_t  read_size,
char *  buffer,
void *  args 
)

◆ vUDPHandlerTwo()

void vUDPHandlerTwo ( size_t  read_size,
char *  buffer,
void *  args 
)