init
This commit is contained in:
11
lib_adat/examples/app_adat_rx_example/CMakeLists.txt
Normal file
11
lib_adat/examples/app_adat_rx_example/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
|
||||
project(app_adat_rx_example)
|
||||
|
||||
set(APP_HW_TARGET xk-audio-316-mc.xn)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../deps.cmake)
|
||||
set(APP_COMPILER_FLAGS -O3 -g -D ADAT_REF=100)
|
||||
|
||||
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
|
||||
|
||||
XMOS_REGISTER_APP()
|
||||
2
lib_adat/examples/app_adat_rx_example/basic.xscope
Normal file
2
lib_adat/examples/app_adat_rx_example/basic.xscope
Normal file
@@ -0,0 +1,2 @@
|
||||
<xSCOPEconfig ioMode="basic" enabled="true">
|
||||
</xSCOPEconfig>
|
||||
79
lib_adat/examples/app_adat_rx_example/src/main.xc
Normal file
79
lib_adat/examples/app_adat_rx_example/src/main.xc
Normal file
@@ -0,0 +1,79 @@
|
||||
// Copyright 2011-2024 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <platform.h>
|
||||
#include <xs1.h>
|
||||
#include <print.h>
|
||||
#include "adat_rx.h"
|
||||
|
||||
/* Port declarations */
|
||||
buffered in port:32 p_adat_rx = PORT_ADAT_IN;
|
||||
out port p_ctrl = PORT_CTRL;
|
||||
|
||||
/* Receive loop */
|
||||
void receive_adat(streaming chanend c)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
adatReceiver48000(p_adat_rx, c);
|
||||
adatReceiver44100(p_adat_rx, c);
|
||||
}
|
||||
}
|
||||
//::
|
||||
|
||||
/* Data handler */
|
||||
void collect_samples(streaming chanend c)
|
||||
{
|
||||
unsigned head, channels[9];
|
||||
int count = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
c :> head;
|
||||
if ((head & 0xF) == 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
channels[i] = head;
|
||||
}
|
||||
++count;
|
||||
|
||||
if ((count % 100000) == 0)
|
||||
{
|
||||
printstr("Frames received: ");
|
||||
printintln(count);
|
||||
}
|
||||
// One whole frame in channels [0..7]
|
||||
}
|
||||
}
|
||||
//::
|
||||
|
||||
void board_setup(void)
|
||||
{
|
||||
set_port_drive_high(p_ctrl);
|
||||
|
||||
// Drive control port to turn on 3V3.
|
||||
// Bits set to low will be high-z, pulled down.
|
||||
p_ctrl <: 0xA0;
|
||||
|
||||
// Wait for power supplies to be up and stable.
|
||||
delay_milliseconds(10);
|
||||
}
|
||||
|
||||
/* Top-level main */
|
||||
int main(void)
|
||||
{
|
||||
streaming chan c;
|
||||
par
|
||||
{
|
||||
on tile[0]:
|
||||
{
|
||||
board_setup();
|
||||
receive_adat(c);
|
||||
}
|
||||
on tile[0]: collect_samples(c);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//::
|
||||
93
lib_adat/examples/app_adat_rx_example/src/xk-audio-316-mc.xn
Normal file
93
lib_adat/examples/app_adat_rx_example/src/xk-audio-316-mc.xn
Normal file
@@ -0,0 +1,93 @@
|
||||
<?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>xcore.ai MC Audio Board</Name>
|
||||
|
||||
<Declarations>
|
||||
<Declaration>tileref tile[2]</Declaration>
|
||||
</Declarations>
|
||||
|
||||
<Packages>
|
||||
<Package id="0" Type="XS3-UnA-1024-TQ128">
|
||||
<Nodes>
|
||||
<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" Oscillator="24MHz" SystemFrequency="600MHz" ReferenceFrequency="100MHz">
|
||||
<Boot>
|
||||
<Source Location="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"/>
|
||||
|
||||
<!-- Various ctrl signals -->
|
||||
<Port Location="XS1_PORT_8D" Name="PORT_CTRL"/>
|
||||
|
||||
<!-- I2C -->
|
||||
<Port Location="XS1_PORT_1L" Name="PORT_I2C_SCL"/>
|
||||
<Port Location="XS1_PORT_1M" Name="PORT_I2C_SDA"/>
|
||||
|
||||
<!-- Clocking -->
|
||||
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
|
||||
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN_USB"/>
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_PLL_REF"/>
|
||||
|
||||
<!-- Audio Ports: Digital -->
|
||||
<Port Location="XS1_PORT_1O" Name="PORT_ADAT_IN"/> <!-- N: Coax O: Optical -->
|
||||
<Port Location="XS1_PORT_1N" Name="PORT_SPDIF_IN"/> <!-- N: Coax O: Optical -->
|
||||
|
||||
</Tile>
|
||||
<Tile Number="1" Reference="tile[1]">
|
||||
<!-- Audio Ports: I2S -->
|
||||
<Port Location="XS1_PORT_1D" Name="PORT_MCLK_IN"/>
|
||||
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT_2"/>
|
||||
<Port Location="XS1_PORT_1B" Name="PORT_I2S_LRCLK"/>
|
||||
<Port Location="XS1_PORT_1C" Name="PORT_I2S_BCLK"/>
|
||||
<Port Location="XS1_PORT_1P" Name="PORT_I2S_DAC0"/>
|
||||
<port Location="XS1_PORT_1O" Name="PORT_I2S_DAC1"/>
|
||||
<port Location="XS1_PORT_1N" Name="PORT_I2S_DAC2"/>
|
||||
<port Location="XS1_PORT_1M" 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"/>
|
||||
|
||||
<!-- Audio Ports: Digital -->
|
||||
<Port Location="XS1_PORT_1G" Name="PORT_ADAT_OUT"/> <!-- A: Coax G: Optical -->
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_SPDIF_OUT"/> <!-- A: Coax G: Optical -->
|
||||
|
||||
<!-- MIDI -->
|
||||
<Port Location="XS1_PORT_1F" Name="PORT_MIDI_IN"/>
|
||||
<Port Location="XS1_PORT_4C" Name="PORT_MIDI_OUT"/> <!-- bit[0] -->
|
||||
|
||||
</Tile>
|
||||
</Node>
|
||||
</Nodes>
|
||||
</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="5clk" Flags="XSCOPE">
|
||||
<LinkEndpoint NodeId="0" Link="XL0"/>
|
||||
<LinkEndpoint NodeId="2" Chanend="1"/>
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" PageSize="256" SectorSize="4096" NumPages="16384">
|
||||
<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"/>
|
||||
</JTAGChain>
|
||||
|
||||
</Network>
|
||||
Reference in New Issue
Block a user