DSP/BIOS TCP-Echo server. More...
#include <BoardSupport/inc/stdtypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <inttypes.h>
#include <time.h>
#include <string.h>
#include <Libs/NETlib/net.h>
#include <BoardSupport/inc/BoardSpecific.h>
#include <Common/Common.h>
#include <Common/uartio.h>
#include <Common/timer.h>
#include <Common/CPrintf.h>
#include <BoardSupport/config/netconfig.c>
#include "dspbios_echocfg.h"
#include "nettask.h"
Macros | |
#define | USE_TCP_CALLBACK 1 |
#define | BUFFER_SIZE (TCP_MAX_PACKET_SIZE) |
#define | KA_TIME(x) ((uint32_t)((x)*330000/PRD1.period)) |
Functions | |
int32_t | tcp_echo (SOCKET *so, void *data, uint32_t len, uint32_t ec) |
void | set_net_isq_interval (int32_t net_isq_interval) |
void | net_trigger (u_int32_t ms) |
Void | Create_TCP_Echo_Server (void) |
void | Echo_Task (void) |
Void | main (Void) |
Variables | |
char * | program_name = "Echo2" |
SOCKET * | tcp_echo_so = INVALID_SOCKET |
unsigned char | tcpRecvBuffer [BUFFER_SIZE] |
unsigned char | tcpSendBuffer [BUFFER_SIZE] |
unsigned char * | tx |
_ _ _ __| | ___(_) ____ _ __ | |_ / _` | / __| |/ _` | '_ \| __| | (_| | _ \__ \ | (_| | | | | |_ \__,_|(_) ___/_|\__, |_| |_|\__| Signalprocessing |___/ Technology
To verify this program, first 'ping' the DSP:
>ping 192.168.168.200
or
>ping mydemo
If the settings and network connections are correct, the pings will be replied.
The TCP Echo server will re-send (echo) anything it receives. To verify this, start NetCat (nc) with the following command
>nc 192.168.168.200 5031 | | | +-- port 5031 = User Echo Port +------------ the DSP's IP address
or
>nc mydemo 5031 | | | +------ port 5031 = User Echo Port +------------ the DSP hostname
Any characters you type in the console window will be returned. NetCat doesn't send the characters immediately, it will send the entire string following a terminating CR. Please note that the maximum length of the character string is limited by the size of the buffer used for TCP echo (ECHO_BUFFER_SIZE = 1460).
The net_isq() is activated via semaphore NetSem from PRD every 1 ms.
#define USE_TCP_CALLBACK 1 |
#define BUFFER_SIZE (TCP_MAX_PACKET_SIZE) |
#define KA_TIME | ( | x | ) | ((uint32_t)((x)*330000/PRD1.period)) |
void set_net_isq_interval | ( | int32_t | net_isq_interval | ) |
void net_trigger | ( | u_int32_t | ms | ) |
Void Create_TCP_Echo_Server | ( | void | ) |
void Echo_Task | ( | void | ) |
Void main | ( | Void | ) |
char* program_name = "Echo2" |
SOCKET* tcp_echo_so = INVALID_SOCKET |
unsigned char tcpRecvBuffer[BUFFER_SIZE] |
unsigned char tcpSendBuffer[BUFFER_SIZE] |
unsigned char* tx |