mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-19 19:27:45 -04:00
* Update History.txt and README.md for December release (#744) * Update History.txt and README.md for release * Bump mbedtls submodule to v2.28.0 (#745) * Patch project files for mbedtls (#751) * Apply group 1 patches * Apply patches for group 2 * Update project files for mbedTLS new version Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Fix warnings in projects Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Fix warnings in HTTP_S3_Download demo Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com> * Update changelog and history for corePKCS11 update (#752) * Update submodule pointer and manifest.yml for corePKCS11 (#754) * Update readme and history.txt to show that Sigv4 is a newly added library (#756) * Revert update to v143 of VS toolset (#757) * [AUTO][RELEASE]: Bump file header version to "202112.00" * Update file headers to satisfy core checks Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: johnrhen <johnrhen@users.noreply.github.com>
145 lines
4.3 KiB
C
145 lines
4.3 KiB
C
/*
|
|
* FreeRTOS V202112.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://aws.amazon.com/freertos
|
|
*
|
|
*/
|
|
|
|
|
|
/* Scheduler includes. */
|
|
#include "FreeRTOS.h"
|
|
|
|
/* Demo application includes. */
|
|
#include "partest.h"
|
|
|
|
/* Library includes. */
|
|
#include "xparameters.h"
|
|
#include "xgpio_l.h"
|
|
|
|
/* Misc hardware specific definitions. */
|
|
#define partstALL_AS_OUTPUT 0x00
|
|
#define partstCHANNEL_1 0x01
|
|
#define partstMAX_8BIT_LED 0x07
|
|
|
|
/* The outputs are split into two IO sections, these variables maintain the
|
|
current value of either section. */
|
|
static unsigned portBASE_TYPE uxCurrentOutput8Bit, uxCurrentOutput5Bit;
|
|
|
|
/*-----------------------------------------------------------*/
|
|
/*
|
|
* Setup the IO for the LED outputs.
|
|
*/
|
|
void vParTestInitialise( void )
|
|
{
|
|
/* Set both sets of LED's on the demo board to outputs. */
|
|
XGpio_mSetDataDirection( XPAR_LEDS_8BIT_BASEADDR, partstCHANNEL_1, partstALL_AS_OUTPUT );
|
|
XGpio_mSetDataDirection( XPAR_LEDS_POSITIONS_BASEADDR, partstCHANNEL_1, partstALL_AS_OUTPUT );
|
|
|
|
/* Start with all outputs off. */
|
|
uxCurrentOutput8Bit = 0;
|
|
XGpio_mSetDataReg( XPAR_LEDS_8BIT_BASEADDR, partstCHANNEL_1, 0x00 );
|
|
uxCurrentOutput5Bit = 0;
|
|
XGpio_mSetDataReg( XPAR_LEDS_POSITIONS_BASEADDR, partstCHANNEL_1, 0x00 );
|
|
}
|
|
/*-----------------------------------------------------------*/
|
|
|
|
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
|
{
|
|
unsigned portBASE_TYPE uxBaseAddress, *puxCurrentValue;
|
|
|
|
portENTER_CRITICAL();
|
|
{
|
|
/* Which IO section does the LED being set/cleared belong to? The
|
|
8 bit or 5 bit outputs? */
|
|
if( uxLED <= partstMAX_8BIT_LED )
|
|
{
|
|
uxBaseAddress = XPAR_LEDS_8BIT_BASEADDR;
|
|
puxCurrentValue = &uxCurrentOutput5Bit;
|
|
}
|
|
else
|
|
{
|
|
uxBaseAddress = XPAR_LEDS_POSITIONS_BASEADDR;
|
|
puxCurrentValue = &uxCurrentOutput8Bit;
|
|
uxLED -= partstMAX_8BIT_LED;
|
|
}
|
|
|
|
/* Setup the bit mask accordingly. */
|
|
uxLED = 0x01 << uxLED;
|
|
|
|
/* Maintain the current output value. */
|
|
if( xValue )
|
|
{
|
|
*puxCurrentValue |= uxLED;
|
|
}
|
|
else
|
|
{
|
|
*puxCurrentValue &= ~uxLED;
|
|
}
|
|
|
|
/* Write the value to the port. */
|
|
XGpio_mSetDataReg( uxBaseAddress, partstCHANNEL_1, *puxCurrentValue );
|
|
}
|
|
portEXIT_CRITICAL();
|
|
}
|
|
/*-----------------------------------------------------------*/
|
|
|
|
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
|
{
|
|
unsigned portBASE_TYPE uxBaseAddress, *puxCurrentValue;
|
|
|
|
portENTER_CRITICAL();
|
|
{
|
|
/* Which IO section does the LED being toggled belong to? The
|
|
8 bit or 5 bit outputs? */
|
|
if( uxLED <= partstMAX_8BIT_LED )
|
|
{
|
|
|
|
uxBaseAddress = XPAR_LEDS_8BIT_BASEADDR;
|
|
puxCurrentValue = &uxCurrentOutput5Bit;
|
|
}
|
|
else
|
|
{
|
|
uxBaseAddress = XPAR_LEDS_POSITIONS_BASEADDR;
|
|
puxCurrentValue = &uxCurrentOutput8Bit;
|
|
uxLED -= partstMAX_8BIT_LED;
|
|
}
|
|
|
|
/* Setup the bit mask accordingly. */
|
|
uxLED = 0x01 << uxLED;
|
|
|
|
/* Maintain the current output value. */
|
|
if( *puxCurrentValue & uxLED )
|
|
{
|
|
*puxCurrentValue &= ~uxLED;
|
|
}
|
|
else
|
|
{
|
|
*puxCurrentValue |= uxLED;
|
|
}
|
|
|
|
/* Write the value to the port. */
|
|
XGpio_mSetDataReg(uxBaseAddress, partstCHANNEL_1, *puxCurrentValue );
|
|
}
|
|
portEXIT_CRITICAL();
|
|
}
|
|
|
|
|