-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADDED] RX65N Cloud Kit initial firmware source code.
Signed-off-by: SheltyDog <[email protected]>
- Loading branch information
1 parent
dfbe408
commit 9229a04
Showing
5,001 changed files
with
1,877,188 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
/* | ||
* Amazon FreeRTOS Device Defender Demo V1.4.7 | ||
* Copyright (C) 2018 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. | ||
* | ||
* http://aws.amazon.com/freertos | ||
* http://www.FreeRTOS.org | ||
*/ | ||
|
||
/* Standard includes. */ | ||
#include "stdio.h" | ||
#include "string.h" | ||
|
||
/* FreeRTOS includes. */ | ||
#include "FreeRTOS.h" | ||
#include "message_buffer.h" | ||
#include "task.h" | ||
|
||
/* Defender includes. */ | ||
#include "aws_defender.h" | ||
|
||
/* Demo for device defender */ | ||
static void prvDefenderDemo( void * ); | ||
|
||
/* Logs the metrics init status */ | ||
static void prvLogInitStatus( DefenderErr_t eStartStatus ); | ||
|
||
/* Logs the status returned from PeriodSet */ | ||
static void prvLogPeriodStatus( DefenderErr_t eStartStatus ); | ||
|
||
/* Logs the result from starting Device Defender */ | ||
static void prvLogStartStatus( DefenderErr_t eStartStatus ); | ||
|
||
/* Monitors the report status */ | ||
static void prvMonitorReportStatus( void ); | ||
|
||
/* Logs the report status */ | ||
static void prvLogReportStatus( DefenderReportStatus_t eStartStatus ); | ||
|
||
void vStartDeviceDefenderDemo( void ) | ||
{ | ||
configSTACK_DEPTH_TYPE const xStackDepth = configMINIMAL_STACK_SIZE; | ||
|
||
( void ) xTaskCreate( prvDefenderDemo, | ||
"Defender Demo", | ||
xStackDepth, | ||
NULL, | ||
tskIDLE_PRIORITY, | ||
NULL ); | ||
} | ||
|
||
static void prvDefenderDemo( void * param ) | ||
{ | ||
DefenderMetric_t xMetricsList[ 1 ]; | ||
int32_t lReportPeriodSec = 300; | ||
DefenderErr_t eInitStatus; | ||
DefenderErr_t ePeriodStatus; | ||
DefenderErr_t eStartStatus; | ||
|
||
xMetricsList[ 0 ] = xDefenderTCPConnections; | ||
|
||
/* Silence warning about unused param */ | ||
( void ) param; | ||
|
||
eInitStatus = DEFENDER_MetricsInit( xMetricsList ); | ||
prvLogInitStatus( eInitStatus ); | ||
|
||
ePeriodStatus = DEFENDER_ReportPeriodSet( lReportPeriodSec ); | ||
prvLogPeriodStatus( ePeriodStatus ); | ||
|
||
eStartStatus = DEFENDER_Start(); | ||
prvLogStartStatus( eStartStatus ); | ||
|
||
prvMonitorReportStatus(); | ||
configPRINTF( ( "----Device Defender Demo Complete----.\r\n" ) ); | ||
vTaskDelete( NULL ); | ||
} | ||
|
||
static void prvLogInitStatus( DefenderErr_t eInitStatus ) | ||
{ | ||
switch( eInitStatus ) | ||
{ | ||
case eDefenderErrSuccess: | ||
configPRINTF( ( "Defender metrics were initialized.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderErrTooManyMetrics: | ||
configPRINTF( ( "Too many metrics were provided.\r\n" ) ); | ||
break; | ||
|
||
default: | ||
configPRINTF( ( "Unexpected init status: %d.\r\n", eInitStatus ) ); | ||
break; | ||
} | ||
} | ||
|
||
static void prvLogPeriodStatus( DefenderErr_t ePeriodStatus ) | ||
{ | ||
switch( ePeriodStatus ) | ||
{ | ||
case eDefenderErrSuccess: | ||
configPRINTF( ( "Defender period was set.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderErrPeriodTooShort: | ||
configPRINTF( ( "Report period was too short (less than 300 sec).\r\n" ) ); | ||
break; | ||
|
||
default: | ||
configPRINTF( ( "Unexpected period status: %d.\r\n", ePeriodStatus ) ); | ||
break; | ||
} | ||
} | ||
|
||
static void prvLogStartStatus( DefenderErr_t eStartStatus ) | ||
{ | ||
switch( eStartStatus ) | ||
{ | ||
case eDefenderErrSuccess: | ||
configPRINTF( ( "Defender was started.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderErrFailedToCreateTask: | ||
configPRINTF( ( "Defender task could not be created.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderErrAlreadyStarted: | ||
configPRINTF( ( "Defender task was started outside of the demo.\r\n" ) ); | ||
break; | ||
|
||
default: | ||
configPRINTF( ( "Unexpected start status: %d.\r\n", eStartStatus ) ); | ||
break; | ||
} | ||
} | ||
|
||
static void prvMonitorReportStatus( void ) | ||
{ | ||
/* Defender is started. No further action is required by the calling | ||
* aplication. However the application can query the report status as | ||
* demonstrated below. */ | ||
int32_t lTaskDelayPeriodMs = 11; | ||
DefenderReportStatus_t eReportStatus = DEFENDER_ReportStatusGet(); | ||
|
||
while( eDefenderRepInit == eReportStatus ) | ||
{ | ||
/* The first report is sent on start. Subsequent reports are sent | ||
* periodically */ | ||
/* Wait for agent to send the first report */ | ||
eReportStatus = DEFENDER_ReportStatusGet(); | ||
vTaskDelay( pdMS_TO_TICKS( lTaskDelayPeriodMs ) ); | ||
} | ||
|
||
/* First report has been sent. Will wait for a short period to give the | ||
* service a chance to respond. */ | ||
vTaskDelay( pdMS_TO_TICKS( 10000 ) ); | ||
|
||
eReportStatus = DEFENDER_ReportStatusGet(); | ||
prvLogReportStatus( eReportStatus ); | ||
} | ||
|
||
static void prvLogReportStatus( DefenderReportStatus_t eReportStatus ) | ||
{ | ||
switch( eReportStatus ) | ||
{ | ||
case eDefenderRepSuccess: | ||
configPRINTF( ( "Device Defender Acknowledged the report.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderRepInit: | ||
configPRINTF( ( "Metrics report has not yet been sent.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderRepRejected: | ||
configPRINTF( ( "Device defender service received and rejected the " | ||
"metrics report.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderRepNoAck: | ||
configPRINTF( ( "Device defender servie did not acknowledge the metrics " | ||
"within the expected time.\r\n" ) ); | ||
break; | ||
|
||
case eDefenderRepNotSent: | ||
configPRINTF( ( "The metrics report was not sent.\r\n" ) ); | ||
break; | ||
|
||
default: | ||
configPRINTF( ( "Unexpected report status: %d.\r\n", eReportStatus ) ); | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Amazon FreeRTOS V1.4.7 | ||
* Copyright (C) 2017 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. | ||
* | ||
* http://aws.amazon.com/freertos | ||
* http://www.FreeRTOS.org | ||
*/ | ||
|
||
/* Called from all the example projects to start tasks that demonstrate Amazon | ||
* FreeRTOS libraries. | ||
* | ||
* If the project was created using the AWS console then this file will have been | ||
* auto generated and only reference and start the demos that were selected in the | ||
* console. If the project was obtained from a source control repository then this | ||
* file will reference all the available and the developer can selectively comment | ||
* in or out the demos to execute. */ | ||
|
||
|
||
#include "aws_demo_runner.h" | ||
|
||
/* Demo declarations. */ | ||
/* extern void vStartDeviceDefenderDemo( void ); */ | ||
/* extern void vStartGreenGrassDiscoveryTask( void ); */ | ||
extern void vStartMQTTEchoDemo( void ); | ||
extern void vStartRenesasDemoTask( void ); | ||
|
||
/* extern void vStartOTAUpdateDemoTask( void ); */ | ||
/* extern void vStartShadowDemoTasks( void ); */ | ||
/* extern void vStartSimpleTCPServerTasks( void ); */ | ||
/* extern void vStartSubpubDemoTasks( void ); */ | ||
/* extern void vStartTCPEchoClientTasks_SeparateTasks( void ); */ | ||
/* extern void vStartTCPEchoClientTasks_SingleTasks( void ); */ | ||
|
||
/*-----------------------------------------------------------*/ | ||
|
||
/** | ||
* @brief Runs demos in the system. | ||
*/ | ||
void DEMO_RUNNER_RunDemos( void ) | ||
{ | ||
/* vStartDeviceDefenderDemo(); */ | ||
/* vStartGreenGrassDiscoveryTask(); */ | ||
/* vStartMQTTEchoDemo(); */ | ||
/* vStartOTAUpdateDemoTask(); */ | ||
/* vStartShadowDemoTasks(); */ | ||
/* vStartSimpleTCPServerTasks(); */ | ||
/* vStartSubpubDemoTasks(); */ | ||
/* vStartTCPEchoClientTasks_SeparateTasks(); */ | ||
/* vStartTCPEchoClientTasks_SingleTasks(); */ | ||
vStartRenesasDemoTask(); | ||
|
||
|
||
} |
Oops, something went wrong.