Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions simple_tests/testHWIdle.poets
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
exit /at = "stop"
load /app = +"test_hwIdle.xml"
tlink /app = *
place /bucket = *
compose /app = *
deploy /app = *
initialise /app = *
run /app = *
87 changes: 87 additions & 0 deletions simple_tests/test_doSend.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0"?>
<!--
This XML is a simple test to validate the behaviour of the Softswitch surrounding
the doSend behaviour in the OnSend handler. This example verifies that doSend is
present and respected.

The supervisor will print a single string to the console of
"** SUPERVISOR** Received Index 10"
and then exit if the test completes successfully.
-->
<Graphs xmlns="" appname="test_doSend">
<GraphType id="test_doSend_type">
<SharedCode><![CDATA[
#include <stdlib.h>
]]></SharedCode>

<Properties><![CDATA[
uint32_t ignoreCnt = 10;
]]></Properties>

<MessageTypes>
<MessageType id="test">
<Message><![CDATA[
uint32_t idx;
]]></Message>
</MessageType>
</MessageTypes>

<DeviceTypes>
<DeviceType id="A">
<State><![CDATA[
uint8_t sCnt = 0;
]]></State>

<OnInit><![CDATA[
return 1; // Trigger RTS
]]></OnInit>

<ReadyToSend><![CDATA[
if (DEVICESTATE(sCnt) <= GRAPHPROPERTIES(ignoreCnt))
{
RTSSUP();
}
]]></ReadyToSend>

<SupervisorOutPin messageTypeId="test">
<OnSend><![CDATA[
PKT(idx) = DEVICESTATE(sCnt);
if (DEVICESTATE(sCnt) < GRAPHPROPERTIES(ignoreCnt))
{
*doSend = false;
}
DEVICESTATE(sCnt)++;
]]></OnSend>
</SupervisorOutPin>
</DeviceType>

<SupervisorType id="supervisorNode">

<Code><![CDATA[
#include <iostream>
#include <sstream>
#include <string>
#include <cstdio>
]]></Code>

<SupervisorInPin id="updateIn" messageTypeId="test">
<OnReceive><![CDATA[
std::cout << "** SUPERVISOR** Received Index " << PKT(idx) << std::endl;

if(PKT(idx) >= GRAPHPROPERTIES(ignoreCnt))
{
Super::stop_application();
}
]]></OnReceive>
</SupervisorInPin>
</SupervisorType>

</DeviceTypes>
</GraphType>
<GraphInstance id="test_doSend_instance"
graphTypeId="test_doSend_type">
<DeviceInstances>
<DevI id="0" type="A"/>
</DeviceInstances>
</GraphInstance>
</Graphs>
68 changes: 68 additions & 0 deletions simple_tests/test_hwIdle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0"?>
<!--
This XML demonstrates that:

- Hardware Idle detection works as expected.

This example uses a single device to send one debug byte in its OnIdle handler
before sending a second byte when the OnHWIdle handler is called.

If completed appropriately, two debug bytes should be produced from
one hardware address:
- "0xAA" followed by "0xBB"

If built with NoRequestIdle, the test will not complete successfully
and will produce:
- "0xAA" followed by a stream of "0xCC"

-->
<Graphs xmlns="" appname="test_hwidle">
<GraphType id="test_hwidle_type">
<!-- Normal devices don't send any messages in this application. -->
<SharedCode><![CDATA[
#include "tinsel.h"
]]></SharedCode>
<DeviceTypes>
<DeviceType id="AABB">
<State><![CDATA[
uint8_t spoken = 0;
uint8_t spoken2 = 0;
]]></State>
<OnInit><![CDATA[
return 1; // Trigger RTS
]]></OnInit>
<ReadyToSend><![CDATA[
if (DEVICESTATE(spoken) == 0)
{
*requestIdle = true;
}
]]></ReadyToSend>
<OnDeviceIdle><![CDATA[
if (DEVICESTATE(spoken) == 0)
{
DEVICESTATE(spoken) = 1;
tinselUartTryPut(170); /* AA */
}
else
{
tinselUartTryPut(204); /* CC */
}
return 0;
]]></OnDeviceIdle>
<OnHardwareIdle><![CDATA[
if (DEVICESTATE(spoken2) == 0)
{
DEVICESTATE(spoken2) = 1;
tinselUartTryPut(187); /* BB */
}
]]></OnHardwareIdle>
</DeviceType>
</DeviceTypes>
</GraphType>
<GraphInstance id="test_hwidle_instance"
graphTypeId="test_hwidle_type">
<DeviceInstances>
<DevI id="0" type="AABB"/>
</DeviceInstances>
</GraphInstance>
</Graphs>
7 changes: 7 additions & 0 deletions simple_tests/testdoSend.poets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load /app = +"test_doSend.xml"
tlink /app = *
place /bucket = *
compose /app = *
deploy /app = *
initialise /app = *
run /app = *