mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-01-21 17:20:32 -05:00
FreeRTOS_Plus_TCP_Echo_Qemu_mps2: cleanup (#1336)
* FreeRTOS_Plus_TCP_Echo_Qemu_mps2: cleanup FreeRTOS_Plus_TCP_Echo_Qemu_mps2: - Add missing include for header files. - Remove redundant function declarations. - Add "static" modifier if possible. - No need to use "weak" for EthernetISR(). Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
This commit is contained in:
parent
9165944664
commit
1325aaaad6
25 changed files with 96 additions and 84 deletions
|
|
@ -200,12 +200,14 @@ void main_tcp_echo_client_tasks( void )
|
|||
|
||||
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
/* *INDENT-OFF* */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* *INDENT-ON* */
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
/* FreeRTOS+TCP includes. */
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
#include "TCPEchoClient_SingleTasks.h"
|
||||
|
||||
/* Exclude the whole file if FreeRTOSIPConfig.h is configured to use UDP only. */
|
||||
#if ( ipconfigUSE_TCP == 1 )
|
||||
|
|
|
|||
|
|
@ -28,15 +28,16 @@
|
|||
#include <task.h>
|
||||
|
||||
#include <FreeRTOSConfig.h>
|
||||
#include <FreeRTOSIPConfig.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "main_networking.h"
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char * pcTaskName );
|
||||
void vApplicationMallocFailedHook( void );
|
||||
void main_tcp_echo_client_tasks( void );
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationTickHook( void );
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "FreeRTOS_Sockets.h"
|
||||
#include "TCPEchoClient_SingleTasks.h"
|
||||
#include "CMSIS/CMSDK_CM3.h"
|
||||
#include "main_networking.h"
|
||||
|
||||
/* Echo client task parameters */
|
||||
#define mainECHO_CLIENT_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* Not used in the linux port. */
|
||||
|
|
@ -211,17 +212,19 @@ BaseType_t xTasksAlreadyCreated = pdFALSE;
|
|||
|
||||
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
/* *INDENT-OFF* */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* *INDENT-ON* */
|
||||
{
|
||||
uint32_t ulIPAddress;
|
||||
uint32_t ulNetMask;
|
||||
uint32_t ulGatewayAddress;
|
||||
uint32_t ulDNSServerAddress;
|
||||
uint32_t ulIPAddress = 0U;
|
||||
uint32_t ulNetMask = 0U;
|
||||
uint32_t ulGatewayAddress = 0U;
|
||||
uint32_t ulDNSServerAddress = 0U;
|
||||
char cBuffer[ 16 ];
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
|
|
@ -275,7 +278,7 @@ BaseType_t xTasksAlreadyCreated = pdFALSE;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
static UBaseType_t uxRand( void )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
|
|
@ -317,7 +320,7 @@ static void prvMiscInitialisation( void )
|
|||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
static const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* Assign the name "FreeRTOS" to this network node. This function will
|
||||
* be called during the DHCP: the machine will be registered with an IP
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MAIN_NETWORKING_H
|
||||
#define MAIN_NETWORKING_H
|
||||
|
||||
/* Initializes the network and starts the TCP task. */
|
||||
void main_tcp_echo_client_tasks( void );
|
||||
|
||||
#endif /* MAIN_NETWORKING_H */
|
||||
|
|
@ -36,7 +36,8 @@ extern void uart_init( void );
|
|||
extern int main( void );
|
||||
|
||||
void _start( void );
|
||||
void __attribute__( ( weak ) ) EthernetISR( void );
|
||||
void EthernetISR( void );
|
||||
void Reset_Handler( void );
|
||||
|
||||
extern uint32_t _estack, _sidata, _sdata, _edata, _sbss, _ebss;
|
||||
|
||||
|
|
@ -65,7 +66,7 @@ void Reset_Handler( void )
|
|||
_start();
|
||||
}
|
||||
|
||||
void prvGetRegistersFromStack( uint32_t * pulFaultStackAddress )
|
||||
__attribute__( ( used ) ) static void prvGetRegistersFromStack( uint32_t * pulFaultStackAddress )
|
||||
{
|
||||
/* These are volatile to try and prevent the compiler/linker optimizing them
|
||||
* away as the variables never actually get used. If the debugger won't show the
|
||||
|
|
@ -138,28 +139,28 @@ void Default_Handler2( void )
|
|||
);
|
||||
}
|
||||
|
||||
void Default_Handler3( void )
|
||||
static void Default_Handler3( void )
|
||||
{
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void Default_Handler4( void )
|
||||
static void Default_Handler4( void )
|
||||
{
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void Default_Handler5( void )
|
||||
static void Default_Handler5( void )
|
||||
{
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void Default_Handler6( void )
|
||||
static void Default_Handler6( void )
|
||||
{
|
||||
for( ; ; )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,17 @@ extern "C" {
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
void uart_init( void );
|
||||
int _fstat( int file );
|
||||
int _read( int file,
|
||||
char * buf,
|
||||
int len );
|
||||
int _write( int file,
|
||||
char * buf,
|
||||
int len );
|
||||
|
||||
void * _sbrk( int incr );
|
||||
|
||||
typedef struct UART_t
|
||||
{
|
||||
volatile uint32_t DATA;
|
||||
|
|
|
|||
|
|
@ -226,12 +226,14 @@ void vApplicationIdleHook( void )
|
|||
|
||||
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
/* *INDENT-OFF* */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* *INDENT-ON* */
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
|
|
|
|||
|
|
@ -109,12 +109,14 @@ int main( void )
|
|||
|
||||
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
/* *INDENT-OFF* */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* *INDENT-ON* */
|
||||
{
|
||||
( void ) eNetworkEvent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,12 +161,14 @@ int main( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* *INDENT-ON* */
|
||||
{
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -161,12 +161,14 @@ int main( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* *INDENT-ON* */
|
||||
{
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -136,12 +136,14 @@ uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
|||
|
||||
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
/* *INDENT-OFF* */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue