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
3 changes: 0 additions & 3 deletions .build_Debug/src/app_flash_util.xc.d

This file was deleted.

Binary file removed .build_Debug/src/app_flash_util.xc.o
Binary file not shown.
1 change: 0 additions & 1 deletion .build_Debug/src/flash_interface.c.d

This file was deleted.

Binary file removed .build_Debug/src/flash_interface.c.o
Binary file not shown.
32 changes: 0 additions & 32 deletions .settings/org.eclipse.cdt.core.prefs

This file was deleted.

14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# The TARGET variable determines what target system the application is
# compiled for. It either refers to an XN file in the source directories
# or a valid argument for the --target option when compiling

QSPI_FLASH=1

ifeq ($(QSPI_FLASH),1)
FLASH_ARGS = -lquadflash -DQUAD_SPI_FLASH=1
TARGET = xk-audio-216-mc.xn
else
FLASH_ARGS = -lflash
TARGET = STARTKIT
endif

# The APP_NAME variable determines the name of the final .xe file. It should
# not include the .xe postfix. If left blank the name will default to
Expand All @@ -11,13 +20,14 @@ APP_NAME = app_flash_util
# The USED_MODULES variable lists other module used by the application.
USED_MODULES =


# The flags passed to xcc when building the application
# You can also set the following to override flags for a particular language:
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
# xcc for the final link (mapping) stage.
XCC_FLAGS_Debug = -O0 -g -lflash
XCC_FLAGS_Release = -O2 -g -lflash
XCC_FLAGS_Debug = -O0 -g $(FLASH_ARGS)
XCC_FLAGS_Release = -O2 -g $(FLASH_ARGS)

# The VERBOSE variable, if set to 1, enables verbose output from the make system.
VERBOSE = 0
Expand Down
Binary file removed bin/Debug/app_flash_util_Debug.xe
Binary file not shown.
29 changes: 19 additions & 10 deletions src/app_flash_util.xc
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,38 @@

#include <xs1.h>
#include <platform.h>
#include <flash.h>
#include <stdio.h>
#include <stdlib.h>
#include <syscall.h>
#include <print.h>
#include "SpecMacros.h"
#include "flash_interface.h"

#ifdef QUAD_SPI_FLASH
#include <quadflash.h>
#include <quadflashlib.h>
#else
#include <flash.h>
#include <flashlib.h>
#endif

#ifdef QUAD_SPI_FLASH
fl_QSPIPorts pFlash =
{
XS1_PORT_1B,
XS1_PORT_1C,
XS1_PORT_4B,
XS1_CLKBLK_5
};
#else
fl_SPIPorts pFlash = {
PORT_SPI_MISO,
PORT_SPI_SS,
PORT_SPI_CLK,
PORT_SPI_MOSI,
XS1_CLKBLK_1
};



fl_DeviceSpec flash_devices[] = {FL_DEVICE_WINBOND_W25X20};

#endif

void dataFlashMenu(void)
{
Expand Down Expand Up @@ -171,13 +182,11 @@ int main() {






printf("Starting Application\n");
/* Open a connection to the SPI flash */

rValue = fl_connectToDevice(pFlash, flash_devices, 1);
//rValue = fl_connectToDevice(pFlash, flash_devices, 1);
rValue = fl_connect(pFlash);
if(rValue)
{
printf("Error - Connecting to device\n");
Expand Down
9 changes: 7 additions & 2 deletions src/flash_interface.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#include <xs1.h>
#include <flash.h>

#include "flash_interface.h"
#ifdef QUAD_SPI_FLASH
#include <quadflash.h>
#include <quadflashlib.h>
#else
#include <flash.h>
#include <flashlib.h>
#endif
#include <string.h>
#include <xclib.h>
#include <stdio.h>
Expand All @@ -25,7 +31,6 @@ static int current_flash_subpage_index = 0;
static unsigned char current_flash_page_data[256];



/* Find flash images and print out the information */
int flashOpen(){

Expand Down
96 changes: 96 additions & 0 deletions xk-audio-216-mc.xn
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?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" ManuallySpecifiedRouting="true">
<Type>Board</Type>
<Name>XS2 MC Audio</Name>
<Declarations>
<Declaration>tileref tile[2]</Declaration>
<Declaration>tileref usb_tile</Declaration>
</Declarations>
<Packages>
<Package id="0" Type="XS2-UnA-512-FB236">
<Nodes>
<Node Id="0" InPackageId="0" Type="XS2-L16A-512" Oscillator="24MHz" SystemFrequency="500MHz" referencefrequency="100MHz">
<Boot>
<Source Location="SPI:bootFlash"/>
</Boot>
<Tile Number="0" Reference="tile[0]">
<Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
<Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>

<!-- Audio Ports -->
<Port Location="XS1_PORT_1A" Name="PORT_PLL_REF"/>
<Port Location="XS1_PORT_1F" Name="PORT_MCLK_IN"/>
<Port Location="XS1_PORT_1G" Name="PORT_I2S_LRCLK"/>
<Port Location="XS1_PORT_1H" Name="PORT_I2S_BCLK"/>
<Port Location="XS1_PORT_1M" Name="PORT_I2S_DAC0"/>
<port Location="XS1_PORT_1N" Name="PORT_I2S_DAC1"/>
<port Location="XS1_PORT_1O" Name="PORT_I2S_DAC2"/>
<port Location="XS1_PORT_1P" Name="PORT_I2S_DAC3"/>
<Port Location="XS1_PORT_1I" Name="PORT_I2S_ADC0"/>
<Port Location="XS1_PORT_1J" Name="PORT_I2S_ADC1"/>
<Port Location="XS1_PORT_1K" Name="PORT_I2S_ADC2"/>
<Port Location="XS1_PORT_1L" Name="PORT_I2S_ADC3"/>
<Port Location="XS1_PORT_4A" Name="PORT_I2C"/>
<Port Location="XS1_PORT_1M" Name="PORT_DSD_DAC0"/>
<port Location="XS1_PORT_1N" Name="PORT_DSD_DAC1"/>
<Port Location="XS1_PORT_1G" Name="PORT_DSD_CLK"/>
<Port Location="XS1_PORT_1E" Name="PORT_ADAT_OUT"/>--> <!-- D: COAX E: OPT -->
<Port Location="XS1_PORT_1D" Name="PORT_SPDIF_OUT"/>--> <!-- D: COAX E: OPT -->
</Tile>
<Tile Number="1" Reference="tile[1]">
<Port Location="XS1_PORT_1H" Name="PORT_USB_TX_READYIN"/>
<Port Location="XS1_PORT_1J" Name="PORT_USB_CLK"/>
<Port Location="XS1_PORT_1K" Name="PORT_USB_TX_READYOUT"/>
<Port Location="XS1_PORT_1I" Name="PORT_USB_RX_READY"/>
<Port Location="XS1_PORT_1E" Name="PORT_USB_FLAG0"/>
<Port Location="XS1_PORT_1F" Name="PORT_USB_FLAG1"/>
<Port Location="XS1_PORT_1G" Name="PORT_USB_FLAG2"/>
<Port Location="XS1_PORT_8A" Name="PORT_USB_TXD"/>
<Port Location="XS1_PORT_8B" Name="PORT_USB_RXD"/>

<!-- Audio Ports -->
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
<Port Location="XS1_PORT_1L" Name="PORT_MCLK_IN2"/>
<Port Location="XS1_PORT_1M" Name="PORT_MIDI_IN"/>
<Port Location="XS1_PORT_1N" Name="PORT_MIDI_OUT"/>
<Port Location="XS1_PORT_1O" Name="PORT_ADAT_IN"/>--> <!-- P: COAX O: OPT -->
<Port Location="XS1_PORT_1P" Name="PORT_SPDIF_IN"/>--> <!-- P: COAX O: OPT -->
</Tile>
</Node>
<Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz">
</Node>
</Nodes>
<Links>
<Link Encoding="5wire">
<LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
<LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
</Link>
</Links>
</Package>
</Packages>
<Nodes>
<Node Id="2" Type="device:" RoutingId="0x8000">
<Service Id="0" Proto="xscope_host_data(chanend c);">
<Chanend Identifier="c" end="3"/>
</Service>
</Node>
</Nodes>
<Links>
<Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
<LinkEndpoint NodeId="0" Link="XL0"/>
<LinkEndpoint NodeId="2" Chanend="1"/>
</Link>
</Links>
<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
</Device>
</ExternalDevices>
<JTAGChain>
<JTAGDevice NodeId="0"/>
<JTAGDevice NodeId="1"/>
</JTAGChain>
</Network>