mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-07-27 08:13:55 +00:00
Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083)
* Use new version of CI-CD Actions, checkout@v3 instead of checkout@v2 on all jobs * Use cSpell spell check, and use ubuntu-20.04 for formatting check * Add in bot formatting action * Update freertos_demo.yml and freertos_plus_demo.yml files to increase github log readability * Add in a Qemu demo onto the workflows.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -119,14 +119,14 @@ extern void vLoggingPrintf( const char * pcFormatString,
|
||||
* own random number generation method. For example, it might be possible to
|
||||
* generate a random number by sampling noise on an analogue input. */
|
||||
extern UBaseType_t uxRand();
|
||||
#define ipconfigRAND32() uxRand()
|
||||
#define ipconfigRAND32() uxRand()
|
||||
|
||||
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
|
||||
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
|
||||
* is not set to 1 then the network event hook will never be called. See
|
||||
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml
|
||||
*/
|
||||
#define ipconfigUSE_NETWORK_EVENT_HOOK 1
|
||||
#define ipconfigUSE_NETWORK_EVENT_HOOK 1
|
||||
|
||||
/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
|
||||
* a network buffer cannot be obtained then the calling task is held in the Blocked
|
||||
@@ -140,7 +140,7 @@ extern UBaseType_t uxRand();
|
||||
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
|
||||
* milliseconds can be converted to a time in ticks by dividing the time in
|
||||
* milliseconds by portTICK_PERIOD_MS. */
|
||||
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
|
||||
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
|
||||
|
||||
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
|
||||
* address, netmask, DNS server address and gateway address from a DHCP server. If
|
||||
@@ -149,7 +149,7 @@ extern UBaseType_t uxRand();
|
||||
* set to 1 if a valid configuration cannot be obtained from a DHCP server for any
|
||||
* reason. The static configuration used is that passed into the stack by the
|
||||
* FreeRTOS_IPInit() function call. */
|
||||
#define ipconfigUSE_DHCP 1
|
||||
#define ipconfigUSE_DHCP 1
|
||||
|
||||
/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at
|
||||
* increasing time intervals until either a reply is received from a DHCP server
|
||||
@@ -158,7 +158,7 @@ extern UBaseType_t uxRand();
|
||||
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
|
||||
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
|
||||
* a DHCP reply being received. */
|
||||
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
|
||||
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
|
||||
|
||||
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
|
||||
* stack can only send a UDP message to a remove IP address if it knowns the MAC
|
||||
@@ -169,19 +169,19 @@ extern UBaseType_t uxRand();
|
||||
* cache then the UDP message is replaced by a ARP message that solicits the
|
||||
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
|
||||
* number of entries that can exist in the ARP table at any one time. */
|
||||
#define ipconfigARP_CACHE_ENTRIES 6
|
||||
#define ipconfigARP_CACHE_ENTRIES 6
|
||||
|
||||
/* ARP requests that do not result in an ARP response will be re-transmitted a
|
||||
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
|
||||
* aborted. */
|
||||
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
|
||||
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
|
||||
|
||||
/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
|
||||
* table being created or refreshed and the entry being removed because it is stale.
|
||||
* New ARP requests are sent for ARP cache entries that are nearing their maximum
|
||||
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
|
||||
* equal to 1500 seconds (or 25 minutes). */
|
||||
#define ipconfigMAX_ARP_AGE 150U
|
||||
#define ipconfigMAX_ARP_AGE 150U
|
||||
|
||||
/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
|
||||
* routines, which are relatively large. To save code space the full
|
||||
@@ -193,19 +193,19 @@ extern UBaseType_t uxRand();
|
||||
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
|
||||
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
|
||||
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
|
||||
#define ipconfigINCLUDE_FULL_INET_ADDR 1
|
||||
#define ipconfigINCLUDE_FULL_INET_ADDR 1
|
||||
|
||||
/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
|
||||
* are available to the IP stack. The total number of network buffers is limited
|
||||
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
|
||||
* to a pre-determinable value. */
|
||||
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60U
|
||||
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60U
|
||||
|
||||
/* A FreeRTOS queue is used to send events from application tasks to the IP
|
||||
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
|
||||
* be queued for processing at any one time. The event queue must be a minimum of
|
||||
* 5 greater than the total number of network buffers. */
|
||||
#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
|
||||
#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
|
||||
|
||||
/* The address of a socket is the combination of its IP address and its port
|
||||
* number. FreeRTOS_bind() is used to manually allocate a port number to a socket
|
||||
@@ -219,48 +219,48 @@ extern UBaseType_t uxRand();
|
||||
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
|
||||
* on a socket that has not yet been bound will result in the send operation being
|
||||
* aborted. */
|
||||
#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
|
||||
#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
|
||||
|
||||
/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
|
||||
#define ipconfigUDP_TIME_TO_LIVE 128
|
||||
#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
|
||||
#define ipconfigUDP_TIME_TO_LIVE 128
|
||||
#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
|
||||
|
||||
/* USE_TCP: Use TCP and all its features */
|
||||
#define ipconfigUSE_TCP ( 1 )
|
||||
#define ipconfigUSE_TCP ( 1 )
|
||||
|
||||
/* Use the TCP socket wake context with a callback. */
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK ( 1 )
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK ( 1 )
|
||||
|
||||
/* USE_WIN: Let TCP use windowing mechanism. */
|
||||
#define ipconfigUSE_TCP_WIN ( 1 )
|
||||
#define ipconfigUSE_TCP_WIN ( 1 )
|
||||
|
||||
/* The MTU is the maximum number of bytes the payload of a network frame can
|
||||
* contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
|
||||
* lower value can save RAM, depending on the buffer management scheme used. If
|
||||
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
|
||||
* be divisible by 8. */
|
||||
#define ipconfigNETWORK_MTU 1500U
|
||||
#define ipconfigNETWORK_MTU 1500U
|
||||
|
||||
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
|
||||
* through the FreeRTOS_gethostbyname() API function. */
|
||||
#define ipconfigUSE_DNS 1
|
||||
#define ipconfigUSE_DNS 1
|
||||
|
||||
/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
|
||||
* generate replies to incoming ICMP echo (ping) requests. */
|
||||
#define ipconfigREPLY_TO_INCOMING_PINGS 1
|
||||
#define ipconfigREPLY_TO_INCOMING_PINGS 1
|
||||
|
||||
/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
|
||||
* FreeRTOS_SendPingRequest() API function is available. */
|
||||
#define ipconfigSUPPORT_OUTGOING_PINGS 0
|
||||
#define ipconfigSUPPORT_OUTGOING_PINGS 0
|
||||
|
||||
/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
|
||||
* (and associated) API function is available. */
|
||||
#define ipconfigSUPPORT_SELECT_FUNCTION 1
|
||||
#define ipconfigSUPPORT_SELECT_FUNCTION 1
|
||||
|
||||
/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
|
||||
* that are not in Ethernet II format will be dropped. This option is included for
|
||||
* potential future IP stack developments. */
|
||||
#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
|
||||
#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
|
||||
|
||||
/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
|
||||
* responsibility of the Ethernet interface to filter out packets that are of no
|
||||
@@ -270,57 +270,57 @@ extern UBaseType_t uxRand();
|
||||
* because the packet will already have been passed into the stack). If the
|
||||
* Ethernet driver does all the necessary filtering in hardware then software
|
||||
* filtering can be removed by using a value other than 1 or 0. */
|
||||
#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
|
||||
#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
|
||||
|
||||
/* The windows simulator cannot really simulate MAC interrupts, and needs to
|
||||
* block occasionally to allow other tasks to run. */
|
||||
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
|
||||
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
|
||||
|
||||
/* Advanced only: in order to access 32-bit fields in the IP packets with
|
||||
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
|
||||
* This has to do with the contents of the IP-packets: all 32-bit fields are
|
||||
* 32-bit-aligned, plus 16-bit(!) */
|
||||
#define ipconfigPACKET_FILLER_SIZE 2U
|
||||
#define ipconfigPACKET_FILLER_SIZE 2U
|
||||
|
||||
/* Define the size of the pool of TCP window descriptors. On the average, each
|
||||
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
|
||||
* outstanding packets (for Rx and Tx). When using up to 10 TP sockets
|
||||
* simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
|
||||
#define ipconfigTCP_WIN_SEG_COUNT 240U
|
||||
#define ipconfigTCP_WIN_SEG_COUNT 240U
|
||||
|
||||
/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
|
||||
* maximum size. Define the size of Rx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_RX_BUFFER_LENGTH ( 4096U )
|
||||
#define ipconfigTCP_RX_BUFFER_LENGTH ( 4096U )
|
||||
|
||||
/* Define the size of Tx buffer for TCP sockets. */
|
||||
#define ipconfigTCP_TX_BUFFER_LENGTH ( 4096U )
|
||||
#define ipconfigTCP_TX_BUFFER_LENGTH ( 4096U )
|
||||
|
||||
/* When using call-back handlers, the driver may check if the handler points to
|
||||
* real program memory (RAM or flash) or just has a random non-zero value. */
|
||||
#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL )
|
||||
#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL )
|
||||
|
||||
/* Include support for TCP hang protection. All sockets in a connecting or
|
||||
* disconnecting stage will timeout after a period of non-activity. */
|
||||
#define ipconfigTCP_HANG_PROTECTION ( 1 )
|
||||
#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
|
||||
#define ipconfigTCP_HANG_PROTECTION ( 1 )
|
||||
#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
|
||||
|
||||
/* Include support for TCP keep-alive messages. */
|
||||
#define ipconfigTCP_KEEP_ALIVE ( 1 )
|
||||
#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20U ) /* in seconds */
|
||||
#define ipconfigTCP_KEEP_ALIVE ( 1 )
|
||||
#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20U ) /* in seconds */
|
||||
|
||||
#define portINLINE __inline
|
||||
#define portINLINE __inline
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Set ipconfigBUFFER_PADDING on 64-bit platforms */
|
||||
#if INTPTR_MAX == INT64_MAX
|
||||
#define ipconfigBUFFER_PADDING ( 14U )
|
||||
#define ipconfigBUFFER_PADDING ( 14U )
|
||||
#endif /* INTPTR_MAX == INT64_MAX */
|
||||
|
||||
|
||||
#define configMAC
|
||||
|
||||
extern BaseType_t xPlatformIsNetworkUp(void);
|
||||
extern BaseType_t xPlatformIsNetworkUp( void );
|
||||
|
||||
|
||||
#endif /* FREERTOS_IP_CONFIG_H */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -458,16 +458,16 @@ static pcap_if_t * prvPrintAvailableNetworkInterfaces( void )
|
||||
printf( " (%s)\n", prvRemoveSpaces( cBuffer, sizeof( cBuffer ), xInterface->description ? xInterface->description : "No description" ) );
|
||||
printf( "\n" );
|
||||
#ifdef configNETWORK_INTERFACE_TYPE_TO_USE
|
||||
{
|
||||
if( xInterface->description != NULL )
|
||||
{
|
||||
if( xInterface->description != NULL )
|
||||
if( xDesiredAdapter( xInterface->description ) )
|
||||
{
|
||||
if( xDesiredAdapter( xInterface->description ) )
|
||||
{
|
||||
printf( "The description of adapter %d matches with '%s'\n", lInterfaceNumber, configNETWORK_INTERFACE_TYPE_TO_USE );
|
||||
xConfigNetworkInterfaceToUse = lInterfaceNumber;
|
||||
}
|
||||
printf( "The description of adapter %d matches with '%s'\n", lInterfaceNumber, configNETWORK_INTERFACE_TYPE_TO_USE );
|
||||
xConfigNetworkInterfaceToUse = lInterfaceNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* ifdef configNETWORK_INTERFACE_TYPE_TO_USE */
|
||||
lInterfaceNumber++;
|
||||
}
|
||||
@@ -846,9 +846,9 @@ static void prvInterruptSimulatorTask( void * pvParameters )
|
||||
pxNetworkBuffer->xDataLength = ( size_t ) pxHeader->len;
|
||||
|
||||
#if ( niDISRUPT_PACKETS == 1 )
|
||||
{
|
||||
pxNetworkBuffer = vRxFaultInjection( pxNetworkBuffer, pucPacketData );
|
||||
}
|
||||
{
|
||||
pxNetworkBuffer = vRxFaultInjection( pxNetworkBuffer, pucPacketData );
|
||||
}
|
||||
#endif /* niDISRUPT_PACKETS */
|
||||
|
||||
if( pxNetworkBuffer != NULL )
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
#ifndef LIBSLIRP_VERSION_H_
|
||||
#define LIBSLIRP_VERSION_H_
|
||||
#define LIBSLIRP_VERSION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SLIRP_MAJOR_VERSION 4
|
||||
#define SLIRP_MINOR_VERSION 7
|
||||
#define SLIRP_MICRO_VERSION 0
|
||||
#define SLIRP_VERSION_STRING "4.7.0"
|
||||
#define SLIRP_MAJOR_VERSION 4
|
||||
#define SLIRP_MINOR_VERSION 7
|
||||
#define SLIRP_MICRO_VERSION 0
|
||||
#define SLIRP_VERSION_STRING "4.7.0"
|
||||
|
||||
#define SLIRP_CHECK_VERSION(major,minor,micro) \
|
||||
(SLIRP_MAJOR_VERSION > (major) || \
|
||||
(SLIRP_MAJOR_VERSION == (major) && SLIRP_MINOR_VERSION > (minor)) || \
|
||||
(SLIRP_MAJOR_VERSION == (major) && SLIRP_MINOR_VERSION == (minor) && \
|
||||
SLIRP_MICRO_VERSION >= (micro)))
|
||||
#define SLIRP_CHECK_VERSION( major, minor, micro ) \
|
||||
( SLIRP_MAJOR_VERSION > ( major ) || \
|
||||
( SLIRP_MAJOR_VERSION == ( major ) && SLIRP_MINOR_VERSION > ( minor ) ) || \
|
||||
( SLIRP_MAJOR_VERSION == ( major ) && SLIRP_MINOR_VERSION == ( minor ) && \
|
||||
SLIRP_MICRO_VERSION >= ( micro ) ) )
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* LIBSLIRP_VERSION_H_ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -39,12 +39,12 @@
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
|
||||
/* In case multiple interfaces are used, define them statically. */
|
||||
/* In case multiple interfaces are used, define them statically. */
|
||||
|
||||
/* there is only 1 physical interface. */
|
||||
/* there is only 1 physical interface. */
|
||||
static NetworkInterface_t xInterfaces[ 1 ];
|
||||
|
||||
/* It will have several end-points. */
|
||||
/* It will have several end-points. */
|
||||
static NetworkEndPoint_t xEndPoints[ 4 ];
|
||||
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
BaseType_t xApplicationDNSQueryHook_Multi( struct xNetworkEndPoint * pxEndPoint,
|
||||
const char * pcName )
|
||||
const char * pcName )
|
||||
#else
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
@@ -132,7 +132,7 @@ uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
* events are only received if implemented in the MAC driver. */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
#else
|
||||
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
|
||||
#endif
|
||||
@@ -146,11 +146,11 @@ uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
{
|
||||
/* Print out the network configuration, which may have come from a DHCP
|
||||
* server. */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxNetworkEndPoints );
|
||||
#else
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxNetworkEndPoints );
|
||||
#else
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
|
||||
FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
|
||||
@@ -202,30 +202,30 @@ void vPlatformInitIpStack( void )
|
||||
/* Initialise the network interface.*/
|
||||
FreeRTOS_debug_printf( ( "FreeRTOS_IPInit\r\n" ) );
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
/* Initialise the interface descriptor for WinPCap. */
|
||||
#ifdef ipconfigUSE_LIBSLIRP
|
||||
extern NetworkInterface_t* pxLibslirp_FillInterfaceDescriptor(BaseType_t xEMACIndex,
|
||||
NetworkInterface_t * pxInterface);
|
||||
pxLibslirp_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
|
||||
#else
|
||||
pxWinPcap_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
|
||||
#endif
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
/* Initialise the interface descriptor for WinPCap. */
|
||||
#ifdef ipconfigUSE_LIBSLIRP
|
||||
extern NetworkInterface_t * pxLibslirp_FillInterfaceDescriptor( BaseType_t xEMACIndex,
|
||||
NetworkInterface_t * pxInterface );
|
||||
pxLibslirp_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
|
||||
#else
|
||||
pxWinPcap_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
|
||||
#endif
|
||||
|
||||
/* === End-point 0 === */
|
||||
FreeRTOS_FillEndPoint( &( xInterfaces[ 0 ] ), &( xEndPoints[ 0 ] ), ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
/* === End-point 0 === */
|
||||
FreeRTOS_FillEndPoint( &( xInterfaces[ 0 ] ), &( xEndPoints[ 0 ] ), ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
#if ( ipconfigUSE_DHCP != 0 )
|
||||
{
|
||||
/* End-point 0 wants to use DHCPv4. */
|
||||
xEndPoints[ 0 ].bits.bWantDHCP = pdTRUE;
|
||||
}
|
||||
#endif /* ( ipconfigUSE_DHCP != 0 ) */
|
||||
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
|
||||
xResult = FreeRTOS_IPInit_Multi();
|
||||
#else
|
||||
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
|
||||
xResult = FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
#endif /* defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */
|
||||
{
|
||||
/* End-point 0 wants to use DHCPv4. */
|
||||
xEndPoints[ 0 ].bits.bWantDHCP = pdTRUE;
|
||||
}
|
||||
#endif /* ( ipconfigUSE_DHCP != 0 ) */
|
||||
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
|
||||
xResult = FreeRTOS_IPInit_Multi();
|
||||
#else /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
|
||||
xResult = FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
#endif /* defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */
|
||||
|
||||
configASSERT( xResult == pdTRUE );
|
||||
}
|
||||
@@ -254,5 +254,5 @@ BaseType_t xPlatformIsNetworkUp( void )
|
||||
return eDHCPContinue;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="include">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -96,7 +96,7 @@
|
||||
#define INCLUDE_xEventGroupSetBitsFromISR 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
#define INCLUDE_pcTaskGetTaskName 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
@@ -119,7 +119,7 @@
|
||||
unsigned long ulGetRunTimeCounterValue( void );
|
||||
void vConfigureTimerForRunTimeStats( void );
|
||||
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
|
||||
|
||||
@@ -210,19 +210,19 @@ extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
#define configPRINTF( X ) vLoggingPrintf X
|
||||
|
||||
#define portNOP() __nop()
|
||||
#define portNOP() __nop()
|
||||
|
||||
/* The UDP port to use for incoming command inputs. The outgoing port is
|
||||
set to ( configUDP_CLI_PORT_NUMBER + 1 ). */
|
||||
#define configUDP_CLI_PORT_NUMBER 5001
|
||||
* set to ( configUDP_CLI_PORT_NUMBER + 1 ). */
|
||||
#define configUDP_CLI_PORT_NUMBER 5001
|
||||
|
||||
/* The size of the global output buffer that is available for use when there
|
||||
are multiple command interpreters running at once (for example, one on a UART
|
||||
and one on TCP/IP). This is done to prevent an output buffer being defined by
|
||||
each implementation - which would waste RAM. In this case, there is only one
|
||||
command interpreter running, and it has its own local output buffer, so the
|
||||
global buffer is just set to be one byte long as it is not used and should not
|
||||
take up unnecessary RAM. */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 1
|
||||
* are multiple command interpreters running at once (for example, one on a UART
|
||||
* and one on TCP/IP). This is done to prevent an output buffer being defined by
|
||||
* each implementation - which would waste RAM. In this case, there is only one
|
||||
* command interpreter running, and it has its own local output buffer, so the
|
||||
* global buffer is just set to be one byte long as it is not used and should not
|
||||
* take up unnecessary RAM. */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 1
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -89,58 +89,60 @@ UBaseType_t uxRand( void )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if defined( configUSE_STATIC_ALLOCATION ) && ( configUSE_STATIC_ALLOCATION == 1U )
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
* state will be stored. */
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if defined( configUSE_TIMERS ) && ( configUSE_TIMERS == 1U )
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
#endif /* defined( configUSE_TIMERS ) && ( configUSE_TIMERS == 1U ) */
|
||||
@@ -149,7 +151,7 @@ UBaseType_t uxRand( void )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configUSE_MALLOC_FAILED_HOOK == 1U )
|
||||
#if ( configUSE_MALLOC_FAILED_HOOK == 1U )
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/*
|
||||
@@ -172,7 +174,7 @@ UBaseType_t uxRand( void )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configUSE_IDLE_HOOK == 1U )
|
||||
#if ( configUSE_IDLE_HOOK == 1U )
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
/*
|
||||
@@ -191,7 +193,7 @@ UBaseType_t uxRand( void )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configUSE_TICK_HOOK == 1U )
|
||||
#if ( configUSE_TICK_HOOK == 1U )
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
/*
|
||||
@@ -206,15 +208,16 @@ UBaseType_t uxRand( void )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1U )
|
||||
/*
|
||||
* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task.
|
||||
*/
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
|
||||
StackType_t **ppxTimerTaskStackBuffer,
|
||||
uint32_t *pulTimerTaskStackSize )
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1U )
|
||||
|
||||
/*
|
||||
* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task.
|
||||
*/
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/*
|
||||
* If the buffers to be provided to the Timer task are declared inside this
|
||||
@@ -244,15 +247,16 @@ UBaseType_t uxRand( void )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1U )
|
||||
/*
|
||||
* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task.
|
||||
*/
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||
StackType_t **ppxIdleTaskStackBuffer,
|
||||
uint32_t *pulIdleTaskStackSize )
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1U )
|
||||
|
||||
/*
|
||||
* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task.
|
||||
*/
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/*
|
||||
* If the buffers to be provided to the Idle task are declared inside this
|
||||
@@ -280,4 +284,4 @@ UBaseType_t uxRand( void )
|
||||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION == 1U */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -34,7 +34,7 @@
|
||||
*
|
||||
* Also note that it is assumed this demo is going to be used for short periods
|
||||
* of time only, and therefore timer overflows are not handled.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <Windows.h>
|
||||
@@ -45,25 +45,25 @@
|
||||
#if configGENERATE_RUN_TIME_STATS == 1
|
||||
|
||||
/* Time at start of day (in ns). */
|
||||
static LARGE_INTEGER lStartTime;
|
||||
static LARGE_INTEGER lStartTime;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vConfigureTimerForRunTimeStats( void )
|
||||
{
|
||||
( void ) QueryPerformanceCounter( &lStartTime );
|
||||
}
|
||||
void vConfigureTimerForRunTimeStats( void )
|
||||
{
|
||||
( void ) QueryPerformanceCounter( &lStartTime );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulGetRunTimeCounterValue( void )
|
||||
{
|
||||
LARGE_INTEGER lCurrentTime;
|
||||
( void ) QueryPerformanceCounter( &lCurrentTime );
|
||||
unsigned long ulGetRunTimeCounterValue( void )
|
||||
{
|
||||
LARGE_INTEGER lCurrentTime;
|
||||
|
||||
configASSERT( lCurrentTime.QuadPart > lStartTime.QuadPart );
|
||||
( void ) QueryPerformanceCounter( &lCurrentTime );
|
||||
|
||||
return ( unsigned long ) ( lCurrentTime.QuadPart - lStartTime.QuadPart );
|
||||
configASSERT( lCurrentTime.QuadPart > lStartTime.QuadPart );
|
||||
|
||||
}
|
||||
return ( unsigned long ) ( lCurrentTime.QuadPart - lStartTime.QuadPart );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
#endif /* configGENERATE_RUN_TIME_STATS == 1 */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33529.622
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resource Files">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
/* mbed TLS includes. */
|
||||
#if defined( MBEDTLS_CONFIG_FILE )
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#else
|
||||
#include "mbedtls/mbedtls_config.h"
|
||||
#include "mbedtls/mbedtls_config.h"
|
||||
#endif
|
||||
#include "mbedtls/entropy.h"
|
||||
|
||||
@@ -103,21 +103,22 @@ void mbedtls_platform_free( void * ptr )
|
||||
*
|
||||
* @param[in, out] pMutex mbedtls mutex handle.
|
||||
*/
|
||||
static void mbedtls_platform_mutex_init( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
configASSERT( pMutex != NULL );
|
||||
static void mbedtls_platform_mutex_init( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
configASSERT( pMutex != NULL );
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
/* Create a statically-allocated FreeRTOS mutex. This should never fail as
|
||||
* storage is provided. */
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
pMutex->mutexHandle = xSemaphoreCreateMutexStatic( &( pMutex->mutexStorage ) );
|
||||
#elif( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
pMutex->mutexHandle = xSemaphoreCreateMutex();
|
||||
#endif
|
||||
/* Create a statically-allocated FreeRTOS mutex. This should never fail as
|
||||
* storage is provided. */
|
||||
|
||||
configASSERT( pMutex->mutexHandle != NULL );
|
||||
}
|
||||
pMutex->mutexHandle = xSemaphoreCreateMutexStatic( &( pMutex->mutexStorage ) );
|
||||
#elif ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
pMutex->mutexHandle = xSemaphoreCreateMutex();
|
||||
#endif
|
||||
|
||||
configASSERT( pMutex->mutexHandle != NULL );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -129,11 +130,11 @@ static void mbedtls_platform_mutex_init( mbedtls_threading_mutex_t * pMutex )
|
||||
* @note This function is an empty stub as nothing needs to be done to free
|
||||
* a statically allocated FreeRTOS mutex.
|
||||
*/
|
||||
static void mbedtls_platform_mutex_free( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
vSemaphoreDelete( pMutex->mutexHandle );
|
||||
pMutex->mutexHandle = NULL;
|
||||
}
|
||||
static void mbedtls_platform_mutex_free( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
vSemaphoreDelete( pMutex->mutexHandle );
|
||||
pMutex->mutexHandle = NULL;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -144,23 +145,23 @@ static void mbedtls_platform_mutex_free( mbedtls_threading_mutex_t * pMutex )
|
||||
*
|
||||
* @return 0 (success) is always returned as any other failure is asserted.
|
||||
*/
|
||||
static int mbedtls_platform_mutex_lock( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
BaseType_t mutexStatus = 0;
|
||||
static int mbedtls_platform_mutex_lock( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
BaseType_t mutexStatus = 0;
|
||||
|
||||
configASSERT( pMutex != NULL );
|
||||
configASSERT( pMutex->mutexHandle != NULL );
|
||||
configASSERT( pMutex != NULL );
|
||||
configASSERT( pMutex->mutexHandle != NULL );
|
||||
|
||||
/* mutexStatus is not used if asserts are disabled. */
|
||||
( void ) mutexStatus;
|
||||
/* mutexStatus is not used if asserts are disabled. */
|
||||
( void ) mutexStatus;
|
||||
|
||||
/* This function should never fail if the mutex is initialized. */
|
||||
mutexStatus = xSemaphoreTake( pMutex->mutexHandle, portMAX_DELAY );
|
||||
/* This function should never fail if the mutex is initialized. */
|
||||
mutexStatus = xSemaphoreTake( pMutex->mutexHandle, portMAX_DELAY );
|
||||
|
||||
configASSERT( mutexStatus == pdTRUE );
|
||||
configASSERT( mutexStatus == pdTRUE );
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -171,79 +172,79 @@ static int mbedtls_platform_mutex_lock( mbedtls_threading_mutex_t * pMutex )
|
||||
*
|
||||
* @return 0 is always returned as any other failure is asserted.
|
||||
*/
|
||||
static int mbedtls_platform_mutex_unlock( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
BaseType_t mutexStatus = 0;
|
||||
static int mbedtls_platform_mutex_unlock( mbedtls_threading_mutex_t * pMutex )
|
||||
{
|
||||
BaseType_t mutexStatus = 0;
|
||||
|
||||
configASSERT( pMutex != NULL );
|
||||
configASSERT( pMutex->mutexHandle != NULL );
|
||||
/* mutexStatus is not used if asserts are disabled. */
|
||||
( void ) mutexStatus;
|
||||
configASSERT( pMutex != NULL );
|
||||
configASSERT( pMutex->mutexHandle != NULL );
|
||||
/* mutexStatus is not used if asserts are disabled. */
|
||||
( void ) mutexStatus;
|
||||
|
||||
/* This function should never fail if the mutex is initialized. */
|
||||
mutexStatus = xSemaphoreGive( pMutex->mutexHandle );
|
||||
configASSERT( mutexStatus == pdTRUE );
|
||||
/* This function should never fail if the mutex is initialized. */
|
||||
mutexStatus = xSemaphoreGive( pMutex->mutexHandle );
|
||||
configASSERT( mutexStatus == pdTRUE );
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if defined( MBEDTLS_THREADING_ALT )
|
||||
int mbedtls_platform_threading_init( void )
|
||||
{
|
||||
mbedtls_threading_set_alt( mbedtls_platform_mutex_init,
|
||||
mbedtls_platform_mutex_free,
|
||||
mbedtls_platform_mutex_lock,
|
||||
mbedtls_platform_mutex_unlock );
|
||||
return 0;
|
||||
}
|
||||
#if defined( MBEDTLS_THREADING_ALT )
|
||||
int mbedtls_platform_threading_init( void )
|
||||
{
|
||||
mbedtls_threading_set_alt( mbedtls_platform_mutex_init,
|
||||
mbedtls_platform_mutex_free,
|
||||
mbedtls_platform_mutex_lock,
|
||||
mbedtls_platform_mutex_unlock );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !MBEDTLS_THREADING_ALT */
|
||||
#else /* !MBEDTLS_THREADING_ALT */
|
||||
|
||||
void (* mbedtls_mutex_init)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_init;
|
||||
void (* mbedtls_mutex_free)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_free;
|
||||
int (* mbedtls_mutex_lock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_lock;
|
||||
int (* mbedtls_mutex_unlock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_unlock;
|
||||
void (* mbedtls_mutex_init)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_init;
|
||||
void (* mbedtls_mutex_free)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_free;
|
||||
int (* mbedtls_mutex_lock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_lock;
|
||||
int (* mbedtls_mutex_unlock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_platform_mutex_unlock;
|
||||
|
||||
#endif /* !MBEDTLS_THREADING_ALT */
|
||||
#endif /* !MBEDTLS_THREADING_ALT */
|
||||
|
||||
#endif /* MBEDTLS_THREADING_C */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if defined( MBEDTLS_ENTROPY_HARDWARE_ALT )
|
||||
/* Determine which API is available */
|
||||
#if defined(_WIN32)
|
||||
#if defined( _WIN32 )
|
||||
#define RNG_SOURCE_WINDOWS_CRYPT
|
||||
#elif defined(__linux__)
|
||||
#elif defined( __linux__ )
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#if defined(SYS_getrandom)
|
||||
#if defined( SYS_getrandom )
|
||||
#define RNG_SOURCE_GETRANDOM
|
||||
#endif /* SYS_getrandom */
|
||||
#elif defined( ARM_RDI_MONITOR ) || defined( SEMIHOSTING )
|
||||
#define RNG_SOURCE_SEMIHOST
|
||||
#else
|
||||
#define RNG_SOURCE_DEV_RANDOM
|
||||
#endif
|
||||
#endif /* if defined( _WIN32 ) */
|
||||
|
||||
#if defined(RNG_SOURCE_WINDOWS_CRYPT)
|
||||
#if defined( RNG_SOURCE_WINDOWS_CRYPT )
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
int mbedtls_hardware_poll( void * data,
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen )
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen )
|
||||
{
|
||||
int lStatus = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||
HCRYPTPROV hProv = 0;
|
||||
|
||||
/* Unferenced parameter. */
|
||||
/* Unreferenced parameter. */
|
||||
( void ) data;
|
||||
|
||||
/*
|
||||
* This is port-specific for the Windows simulator, so just use Crypto API.
|
||||
*/
|
||||
* This is port-specific for the Windows simulator, so just use Crypto API.
|
||||
*/
|
||||
|
||||
if( TRUE == CryptAcquireContextA(
|
||||
&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) )
|
||||
@@ -274,13 +275,14 @@ int (* mbedtls_mutex_unlock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_plat
|
||||
|
||||
if( rslt >= 0 )
|
||||
{
|
||||
*olen = (size_t) rslt;
|
||||
*olen = ( size_t ) rslt;
|
||||
rslt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rslt = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||
}
|
||||
|
||||
return rslt;
|
||||
}
|
||||
#elif defined( RNG_SOURCE_SEMIHOST )
|
||||
@@ -292,7 +294,7 @@ int (* mbedtls_mutex_unlock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_plat
|
||||
int rslt = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||
int file;
|
||||
|
||||
(void) data;
|
||||
( void ) data;
|
||||
|
||||
configASSERT( olen != NULL );
|
||||
configASSERT( output != NULL );
|
||||
@@ -322,7 +324,7 @@ int (* mbedtls_mutex_unlock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_plat
|
||||
( void ) _close( file );
|
||||
return rslt;
|
||||
}
|
||||
#else
|
||||
#else /* if defined( RNG_SOURCE_WINDOWS_CRYPT ) */
|
||||
#include <stdio.h>
|
||||
int mbedtls_hardware_poll( void * data,
|
||||
unsigned char * output,
|
||||
@@ -336,7 +338,8 @@ int (* mbedtls_mutex_unlock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_plat
|
||||
configASSERT( olen != NULL );
|
||||
configASSERT( output != NULL );
|
||||
|
||||
file = fopen("/dev/urandom", "rb");
|
||||
file = fopen( "/dev/urandom", "rb" );
|
||||
|
||||
if( file != NULL )
|
||||
{
|
||||
rslt = fread( output, 1, len, file );
|
||||
@@ -352,8 +355,9 @@ int (* mbedtls_mutex_unlock)( mbedtls_threading_mutex_t * mutex ) = mbedtls_plat
|
||||
{
|
||||
rslt = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||
}
|
||||
|
||||
return rslt;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* if defined( RNG_SOURCE_WINDOWS_CRYPT ) */
|
||||
#endif /* if defined( MBEDTLS_ENTROPY_HARDWARE_ALT ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -43,13 +43,13 @@ typedef struct mbedtls_threading_mutex
|
||||
{
|
||||
SemaphoreHandle_t mutexHandle;
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
StaticSemaphore_t mutexStorage;
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
|
||||
} mbedtls_threading_mutex_t;
|
||||
|
||||
#if defined( MBEDTLS_THREADING_ALT )
|
||||
int mbedtls_platform_threading_init( void );
|
||||
int mbedtls_platform_threading_init( void );
|
||||
#endif
|
||||
|
||||
int mbedtls_platform_send( void * ctx,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* 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
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
* @file core_pkcs11_config.h
|
||||
* @brief PCKS#11 config options.
|
||||
* @brief PKCS#11 config options.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user