-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Steve Kerrison
committed
Oct 11, 2012
1 parent
95d93f7
commit f87acc5
Showing
6 changed files
with
286 additions
and
3 deletions.
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
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,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Network xmlns="http://www.xmos.com" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.xmos.com http://www.xmos.com"> | ||
<Type>Board</Type> | ||
<Name>Swallow 256Mbit SDRAM Board</Name> | ||
|
||
<Declarations> | ||
<Declaration>core stdcore[1]</Declaration> | ||
</Declarations> | ||
|
||
<Packages> | ||
<Package id="0" Type="XS1-L1A-TQ128"> | ||
<Nodes> | ||
<Node Id="0" InPackageId="0" Type="XS1-L1A" Oscillator="25MHz" ReferenceFrequency="100MHz" SystemFrequency="600MHz"> | ||
|
||
<Boot> | ||
<Source Location="SPI:bootFlash"/> | ||
</Boot> | ||
|
||
<Core Number="0" Reference="stdcore[0]"> | ||
<!--<Port Location="XS1_PORT_1L" Name="L1_LED"/>--> <!-- "L1_LED on board --> | ||
|
||
<Port Location="XS1_PORT_1A" Name="SPI_SO"/> <!-- SPI flash lines --> | ||
<Port Location="XS1_PORT_1B" Name="SPI_SS"/> | ||
<Port Location="XS1_PORT_1C" Name="SPI_CLK"/> | ||
<Port Location="XS1_PORT_1D" Name="SPI_SI"/> | ||
|
||
<Port Location="XS1_PORT_1I" Name="I2C_SDA"/> <!-- I2C data line --> | ||
<Port Location="XS1_PORT_1J" Name="I2C_SCK"/> <!-- I2C clock line --> | ||
|
||
<Port Location="XS1_PORT_1G" Name="PORT_ETH_RXCLK" /> | ||
<!--<Port Location="XS1_PORT_1H" Name="PORT_ETH_RXER" /> Shared port --> | ||
<Port Location="XS1_PORT_1K" Name="PORT_ETH_RXDV" /> | ||
<Port Location="XS1_PORT_4C" Name="PORT_ETH_RXD" /> | ||
<Port Location="XS1_PORT_1F" Name="PORT_ETH_TXCLK" /> | ||
<Port Location="XS1_PORT_1L" Name="PORT_ETH_TXEN" /> | ||
<Port Location="XS1_PORT_4D" Name="PORT_ETH_TXD" /> | ||
<Port Location="XS1_PORT_1J" Name="PORT_ETH_MDC" /> | ||
<Port Location="XS1_PORT_1I" Name="PORT_ETH_MDIO" /> | ||
<!-- <Port Location="XS1_PORT_1B" Name="PORT_ETH_RST_N" /> Shared port --> | ||
<!-- <Port Location="XS1_PORT_8B" Name="PORT_ETH_FAKE" /> Shared port --> | ||
|
||
</Core> | ||
</Node> | ||
</Nodes> | ||
</Package> | ||
</Packages> | ||
|
||
<Links> | ||
<!-- XSCOPE --> | ||
<Link Encoding="2wire" Delays="4,4" Flags="SOD"> | ||
<LinkEndpoint NodeId="0" Link="XLD"/> | ||
<LinkEndpoint RoutingId="0x8000" Chanend="1"/> | ||
</Link> | ||
</Links> | ||
|
||
<ExternalDevices> | ||
<Device NodeId="0" Core="0" Class="SPIFlash" Name="bootFlash" Type="FL064K1F"> <!-- is AT25FS010 compatible --> | ||
<!-- <Device NodeId="0" Core="0" Class="SPIFlash" Name="bootFlash" Type="AT25FS010"> --> | ||
<Attribute Name="PORT_SPI_MISO" Value="SPI_SO"/> | ||
<Attribute Name="PORT_SPI_SS" Value="SPI_SS"/> | ||
<Attribute Name="PORT_SPI_CLK" Value="SPI_CLK"/> | ||
<Attribute Name="PORT_SPI_MOSI" Value="SPI_SI"/> | ||
</Device> | ||
</ExternalDevices> | ||
|
||
<JTAGChain> | ||
<JTAGDevice NodeId="0"/> | ||
</JTAGChain> | ||
|
||
</Network> |
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,6 @@ | ||
#define ETHERNET_DEFAULT_IMPLEMENTATION lite | ||
|
||
#define MAX_ETHERNET_PACKET_SIZE (1518) | ||
|
||
#define MAX_ETHERNET_CLIENTS (4) | ||
|
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,86 @@ | ||
/* | ||
* swallow_etherboot - Boot a Swallow grid using Ethernet | ||
* | ||
* Copyright (C) 2012 Steve Kerrison <[email protected]> | ||
* | ||
* This software is freely distributable under a derivative of the | ||
* University of Illinois/NCSA Open Source License posted in | ||
* LICENSE.txt and at <http://github.xcore.com/> | ||
*/ | ||
|
||
#include <platform.h> | ||
#include <print.h> | ||
#include <xscope.h> | ||
#include "smi.h" | ||
#include "mii_driver.h" | ||
#include "mii.h" | ||
#include "pipServer.h" | ||
#include "tcpApplication.h" | ||
#include "ipv4.h" | ||
#include "udpApplication.h" | ||
|
||
#define PORT_ETH_FAKE XS1_PORT_8C | ||
#define PORT_ETH_RXER XS1_PORT_1H | ||
#define PORT_ETH_RST_N XS1_PORT_1A | ||
|
||
mii_interface_t mii = | ||
{ | ||
XS1_CLKBLK_1, | ||
XS1_CLKBLK_2, | ||
|
||
PORT_ETH_RXCLK, | ||
PORT_ETH_RXER, | ||
PORT_ETH_RXD, | ||
PORT_ETH_RXDV, | ||
|
||
PORT_ETH_TXCLK, | ||
PORT_ETH_TXEN, | ||
PORT_ETH_TXD, | ||
|
||
PORT_ETH_FAKE, | ||
}; | ||
|
||
out port p_mii_resetn = PORT_ETH_RST_N; | ||
smi_interface_t smi = { 0x1F, PORT_ETH_MDIO, PORT_ETH_MDC }; | ||
|
||
clock clk_smi = XS1_CLKBLK_5; | ||
|
||
void udpEcho(streaming chanend ch) | ||
{ | ||
unsigned char buffer [1500]; | ||
unsigned rip, rport; | ||
int len; | ||
while (1) | ||
{ | ||
len = pipApplicationReadUDP(ch, buffer, 0, 1500, rip, rport, 1234); | ||
pipApplicationWriteUDP(ch, buffer, 0, len, rip, 1234, rport); | ||
} | ||
} | ||
|
||
void tcpEcho(streaming chanend ch) | ||
{ | ||
unsigned char buffer [1500]; | ||
int len; | ||
pipApplicationAccept(ch, 0); | ||
while (1) | ||
{ | ||
len = pipApplicationRead(ch, 0, buffer, 1500); | ||
pipApplicationWrite(ch, 0, buffer, len); | ||
} | ||
} | ||
|
||
int main(void) { | ||
streaming chan tcpApps[1]; | ||
streaming chan udpApps[1]; | ||
char ip[] = {4,128,168,192}; | ||
xscope_register(0); | ||
xscope_config_io(XSCOPE_IO_BASIC); | ||
pipAssignIPv4((ip,unsigned), 0, 0); | ||
par | ||
{ | ||
pipServer(clk_smi, p_mii_resetn, smi, mii, tcpApps, udpApps); | ||
//udpEcho(udpApps[0]); | ||
tcpEcho(tcpApps[0]); | ||
} | ||
return 0; | ||
} |
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,7 @@ | ||
#define PIP_TCP_CHANNELS 1 // At most one application | ||
#define PIP_UDP_CHANNELS 1 // At most one application | ||
|
||
#define PIP_ICMP | ||
#define PIP_UDP | ||
#define PIP_TCP 1 | ||
#define PIP_ETHTX_WORDS 800 |