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
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?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 Explorer Kit x2 Wired as 4 tile system</Name>

<Declarations>
<Declaration>tileref tile[4]</Declaration>
</Declarations>

<Packages>
<!-- Package on first explorer board -->
<Package id="0" Type="XS3-UnA-1024-FB265">
<Nodes>
<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" Oscillator="24MHz" SystemFrequency="600MHz" ReferenceFrequency="100MHz">
<Boot>
<Source Location="bootFlash"/>
<Bootee NodeId="1"/>
</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"/>
<Port Location="XS1_PORT_4C" Name="PORT_LEDS"/>
</Tile>
<Tile Number="1" Reference="tile[1]"/>
</Node>
</Nodes>
</Package>
<!-- Package on second explorer board -->
<Package id="1" Type="XS3-UnA-1024-FB265">
<Nodes>
<Node Id="1" InPackageId="0" Type="XS3-L16A-1024" Oscillator="24MHz" SystemFrequency="600MHz" ReferenceFrequency="100MHz">
<Boot>
<Source Location="LINK" BootMode="6"/>
</Boot>
<Tile Number="0" Reference="tile[2]"/>
<Tile Number="1" Reference="tile[3]"/>
</Node>
</Nodes>
</Package>
</Packages>

<!-- XTAG-4 Node -->
<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>
<!-- Two 5 wire links between the two boards -->
<!-- <Link Encoding="5wire" Delays="4clk">
<LinkEndpoint NodeId="0" Link="1"/>
<LinkEndpoint NodeId="1" Link="2"/>
</Link> -->
<!-- Delays - inter token (10b) delay, inter-symbol (1b for 2wire link) -->
<Link Encoding="2wire" Delays="5,5">
<LinkEndpoint NodeId="0" Link="2"/>
<LinkEndpoint NodeId="1" Link="1"/>
</Link>
<!-- Single 2 wire link between Node 0 device and XTAG-4 for XScope -->
<Link Encoding="2wire" Delays="6clk" Flags="XSCOPE">
<LinkEndpoint NodeId="0" Link="0"/>
<LinkEndpoint NodeId="2" Chanend="1"/>
</Link>
</Links>

<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="AT25FF321A" 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"/>
<Attribute Name="QE_REGISTER" Value="flash_qe_location_status_reg_1"/>
<Attribute Name="QE_BIT" Value="flash_qe_bit_1"/>
</Device>
</ExternalDevices>

<JTAGChain>
<JTAGDevice NodeId="0"/>
<JTAGDevice NodeId="1"/>
</JTAGChain>

</Network>
3 changes: 3 additions & 0 deletions examples/dual_AN00127_video_class/src/config.xscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<xSCOPEconfig ioMode="basic" enabled="true">
</xSCOPEconfig>

121 changes: 121 additions & 0 deletions examples/dual_AN00127_video_class/src/main.xc
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Copyright 2015-2022 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

/* Includes */
#include <platform.h>
#include <xs1.h>
#include <xscope.h>
#include <assert.h>
#include <xccompat.h>

#include "usb_video.h"
#include "xud.h"
extern "C"{
#include "xud_wrapper.h"
}

/* xSCOPE Setup Function */
#if (USE_XSCOPE == 1)
void xscope_user_init(void) {
xscope_register(0, 0, "", 0, "");
xscope_config_io(XSCOPE_IO_BASIC); /* Enable fast printing over XTAG */
}
#endif

/* USB Endpoint Defines */
#define EP_COUNT_OUT 1 // 1 OUT EP0
#define EP_COUNT_IN 3 // (1 IN EP0 + 1 INTERRUPT IN EP + 1 ISO IN EP)

/* Endpoint type tables - informs XUD what the transfer types for each Endpoint in use and also
* if the endpoint wishes to be informed of USB bus resets
*/
XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE};
XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_INT, XUD_EPTYPE_ISO};

XUD_EpType epTypeTableOut2[EP_COUNT_OUT] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE};
XUD_EpType epTypeTableIn2[EP_COUNT_IN] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_INT, XUD_EPTYPE_ISO};


/*
#define PORT_USB_CLK on USB_TILE: XS1_PORT_1J
#define PORT_USB_TXD on USB_TILE: XS1_PORT_8A
#define PORT_USB_RXD on USB_TILE: XS1_PORT_8B
#define PORT_USB_TX_READYOUT on USB_TILE: XS1_PORT_1K
#define PORT_USB_TX_READYIN on USB_TILE: XS1_PORT_1H
#define PORT_USB_RX_READY on USB_TILE: XS1_PORT_1I
#define PORT_USB_FLAG0 on USB_TILE: XS1_PORT_1E
#define PORT_USB_FLAG1 on USB_TILE: XS1_PORT_1F
*/

XUD_resources_t resources =
{
on tile[0]: XS1_PORT_1E, // flag0_port
on tile[0]: XS1_PORT_1F, // flag1_port
null, // flag2_port
on tile[0]: XS1_PORT_1J, // p_usb_clk
on tile[0]: XS1_PORT_8A, // p_usb_txd
on tile[0]: XS1_PORT_8B, // p_usb_rxd
on tile[0]: XS1_PORT_1K, // tx_readyout
on tile[0]: XS1_PORT_1H, // tx_readyin
on tile[0]: XS1_PORT_1I, // rx_rdy
on tile[0]: XS1_CLKBLK_4, // tx_usb_clk
on tile[0]: XS1_CLKBLK_5, // rx_usb_clk
};

XUD_resources_t resources2 =
{
on tile[2]: XS1_PORT_1E,
on tile[2]: XS1_PORT_1F,
null,
on tile[2]: XS1_PORT_1J,
on tile[2]: XS1_PORT_8A,
on tile[2]: XS1_PORT_8B,
on tile[2]: XS1_PORT_1K,
on tile[2]: XS1_PORT_1H,
on tile[2]: XS1_PORT_1I,
on tile[2]: XS1_CLKBLK_4,
on tile[2]: XS1_CLKBLK_5,
};

int main() {

chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN];
chan c_ep_out2[EP_COUNT_OUT], c_ep_in2[EP_COUNT_IN];


/* 'Par' statement to run the following tasks in parallel */
par
{
on USB_TILE:
{
init_xud_resources(resources);
printstr("XUD\n");
XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN,
null, epTypeTableOut, epTypeTableIn,
XUD_SPEED_HS, XUD_PWR_BUS);
}

on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0], PRODUCT_ID);

on USB_TILE: VideoEndpointsHandler(c_ep_in[1], c_ep_in[2], 0);

#undef USB_TILE
#define USB_TILE tile[2]

on USB_TILE:
{
init_xud_resources(resources2);
printstr("XUD\n");
XUD_Main_wrapper(c_ep_out2, EP_COUNT_OUT, c_ep_in2, EP_COUNT_IN,
null, epTypeTableOut2, epTypeTableIn2,
XUD_SPEED_HS, XUD_PWR_BUS);
}

on USB_TILE: Endpoint0_wrapper(c_ep_out2[0], c_ep_in2[0], PRODUCT_ID + 1);

on USB_TILE: VideoEndpointsHandler_wrapper(c_ep_in2[1], c_ep_in2[2], 1);


}
return 0;
}
19 changes: 19 additions & 0 deletions examples/dual_AN00127_video_class/src/usb_video.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2015-2021 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#ifndef USB_VIDEO_H_
#define USB_VIDEO_H_

#include "xud_device.h"
#include "uvc_req.h"
#include "uvc_defs.h"

#define DEBUG 0

/* Function to handle all endpoints of the Video class excluding control endpoint0 */
void VideoEndpointsHandler(chanend c_epint_in, chanend c_episo_in, unsigned instance);

/* Endpoint 0 handles both std USB requests and Video class-specific requests */
void Endpoint0(chanend chan_ep0_out, chanend chan_ep0_in, unsigned short PID);

#endif /* USB_VIDEO_H_ */
Loading