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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ doc/README/README.rst
.lock-waf_*
.waf-*/
build/
**/.venv/**
**/.venv*/**
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pipeline {
stage('XCORE builds') {
steps {
// build all the supported firmware applications
runForEach(['i2c', 'i2c/host_xcore', 'spi', 'usb', 'xscope']) { app ->
runForEach(['i2c/device', 'i2c/host_xcore', 'spi/device', 'usb/device', 'xscope/device']) { app ->
withTools(params.TOOLS_VERSION) { // the XTC tools are necessary to build the XSCOPE host application
dir("${REPO_NAME}/examples/${app}") {
xcoreBuild()
Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PROJECT_NAME = lib_device_control
PROJECT_BRIEF = "Device Control for xcore"

INPUT = ../lib_device_control/api ../lib_device_control/src ../lib_device_control/host
INPUT = ../lib_device_control/api ../lib_device_control/inc ../host/api ../host/inc

EXCLUDE_PATTERNS = libusb.h

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ else()
endif()

# Includes and flags
set(APP_INCLUDES src)
set(APP_INCLUDES src ../shared)

set(APP_COMPILER_FLAGS
-O2
Expand All @@ -24,6 +24,6 @@ set(APP_COMPILER_FLAGS

set(APP_DEPENDENT_MODULES lib_device_control "lib_i2c(6.4.1)")

set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../..)

XMOS_REGISTER_APP()
3 changes: 0 additions & 3 deletions examples/usb/src/app.h → examples/i2c/device/src/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

#include "control.h"

/* Arbitrary resource ID assigned. Could be anything from 0x01 to 0xff */
#define RESOURCE_ID 0x12

void app(server interface control i_control);

#endif // APP_H
2 changes: 2 additions & 0 deletions examples/i2c/src/app.xc → examples/i2c/device/src/app.xc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include <stdio.h>
#include <stdint.h>
#include <assert.h>

#include "control.h"
#include "app.h"
#include "resource.h"

void app(server interface control i_control)
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright 2016-2025 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#ifndef DEBUG_CONF_H_
#define DEBUG_CONF_H_

#ifndef DEBUG_CONF_H
#define DEBUG_CONF_H

#define DEBUG_PRINT_ENABLE_ALL 0
#define DEBUG_PRINT_ENABLE_CONTROL 0

#endif // DEBUG_CONF_H_
#endif // DEBUG_CONF_H
File renamed without changes.
24 changes: 8 additions & 16 deletions examples/i2c/host_rpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,21 @@ cmake_minimum_required(VERSION 3.18)
set(CMAKE_BUILD_TYPE "Release")
project(i2c_host_app)

# Define path to lib_device_control
set(DEVICE_CONTROL_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../lib_device_control)
include("${CMAKE_CURRENT_LIST_DIR}/../../../host/host_build_i2c.cmake")

# Define source files
set(SOURCES
"${DEVICE_CONTROL_PATH}/host/device_access_i2c_rpi.c"
"${DEVICE_CONTROL_PATH}/host/util.c"
"src/host.c"
)
add_executable(i2c_host_app ${SOURCES})
add_executable(i2c_host_app "src/host.c")

target_link_libraries(i2c_host_app PRIVATE control_i2c_host)

# Directories
target_include_directories(
i2c_host_app
PRIVATE
src
${DEVICE_CONTROL_PATH}/host
${DEVICE_CONTROL_PATH}/api
${DEVICE_CONTROL_PATH}/src
i2c_host_app PRIVATE
src
../shared
)

# Properties and options
target_compile_options(i2c_host_app PRIVATE -DUSE_I2C=1 -DRPI=1 -O2)
target_compile_options(i2c_host_app PRIVATE -Wall -Wextra -Werror -O2)

# Set output directory
set_target_properties(i2c_host_app PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
8 changes: 0 additions & 8 deletions examples/i2c/host_rpi/src/resource.h

This file was deleted.

22 changes: 12 additions & 10 deletions examples/i2c/host_xcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ project(host_i2c_xcore)
# root
set(XMOS_SANDBOX_DIR ${CMAKE_SOURCE_DIR}/../../../..)

include("${CMAKE_CURRENT_LIST_DIR}/../../../host/host_build_i2c.cmake")

# target: choose the target platform
set(APP_HW_TARGET XK-EVK-XU316)

set(APP_INCLUDES src)

# source files
set(APP_C_SRCS ../../../lib_device_control/host/device_access_i2c_xcore.xc ../../../lib_device_control/host/util.c)
set(APP_INCLUDES src ../shared)

set(APP_COMPILER_FLAGS
-O2
-g
-report
-Wall
-D USE_I2C=1
-O2
-g
-report
-Wall
-Wextra
)

set(APP_DEPENDENT_MODULES lib_device_control lib_i2c)
set(APP_DEPENDENT_MODULES lib_device_control "lib_i2c(6.4.1)")
XMOS_REGISTER_APP()

target_link_libraries(${PROJECT_NAME} PRIVATE control_i2c_host)

8 changes: 0 additions & 8 deletions examples/i2c/host_xcore/src/resource.h

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ else()
set(SPI_TILE_VAL 0)
endif()

set(APP_INCLUDES src)
set(APP_INCLUDES src ../shared)

set(APP_COMPILER_FLAGS
-O2
Expand All @@ -24,6 +24,6 @@ set(APP_COMPILER_FLAGS

set(APP_DEPENDENT_MODULES lib_device_control "lib_spi(4.0.0)")

set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../..)

XMOS_REGISTER_APP()
2 changes: 0 additions & 2 deletions examples/xscope/src/app.h → examples/spi/device/src/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

#include "control.h"

#define RESOURCE_ID 0x12

void app(server interface control i_control);

#endif // APP_H_
2 changes: 2 additions & 0 deletions examples/spi/src/app.xc → examples/spi/device/src/app.xc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include <stdio.h>
#include <stdint.h>
#include <assert.h>

#include "control.h"
#include "app.h"
#include "resource.h"

void app(server interface control i_control)
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 8 additions & 27 deletions examples/spi/host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,21 @@ cmake_minimum_required(VERSION 3.18)
set(CMAKE_BUILD_TYPE "Release")
project(spi_host_app)

# Define paths
set(DEVICE_CONTROL_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../lib_device_control)
set(SPI_DRIVER_PATH ${DEVICE_CONTROL_PATH}/host/spi_driver)
include("${CMAKE_CURRENT_LIST_DIR}/../../../host/host_build_spi.cmake")

# Define source files
set(SOURCES
"${DEVICE_CONTROL_PATH}/host/device_access_spi_rpi.c"
"${DEVICE_CONTROL_PATH}/host/util.c"
"src/host.c"
)
add_executable(spi_host_app ${SOURCES})
add_executable(spi_host_app "src/host.c")

target_link_libraries(spi_host_app PRIVATE control_spi_host)

# Directories
target_include_directories(
spi_host_app
PRIVATE
src
${DEVICE_CONTROL_PATH}/host
${DEVICE_CONTROL_PATH}/api
${DEVICE_CONTROL_PATH}/src
${SPI_DRIVER_PATH}
)

# Find and link libraries
find_library(
BCM2835_LIB
NAMES libbcm2835.a
PATHS ${SPI_DRIVER_PATH}
spi_host_app PRIVATE
src
../shared
)

# Properties and options
target_compile_options(spi_host_app PRIVATE -DUSE_SPI=1 -DRPI=1 -O2)

target_link_libraries(spi_host_app PRIVATE ${BCM2835_LIB})
target_compile_options(spi_host_app PRIVATE -Wall -Wextra -Werror -O2)

# Set output directory
set_target_properties(spi_host_app PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
8 changes: 0 additions & 8 deletions examples/spi/host/src/resource.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef RESOURCE_H
#define RESOURCE_H

/* Arbitrary resource ID assigned. Could be anything from 0x01 to 0xff */
#define RESOURCE_ID 0x12

#endif // RESOURCE_H
#endif // RESOURCE_H
13 changes: 0 additions & 13 deletions examples/spi/src/app.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ project(usb)
set(APP_HW_TARGET src/XK_VOICE_L71.xn)
# set(APP_HW_TARGET src/XK-EVK-XU316-AIV.xn)

set(APP_INCLUDES src)
set(APP_INCLUDES src ../shared)

# To enable USB transport in the library, this application must build 'usb' configuration
set(TRANSPORT_CONFIG "USB")

set(APP_COMPILER_FLAGS
-O2
Expand All @@ -17,6 +20,6 @@ set(APP_COMPILER_FLAGS

set(APP_DEPENDENT_MODULES lib_device_control "lib_xud(4.0.1)")

set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../..)

XMOS_REGISTER_APP()
12 changes: 12 additions & 0 deletions examples/usb/device/src/app.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2016-2025 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#ifndef APP_H
#define APP_H

#include <xccompat.h>
#include "control.h"

void app(SERVER_INTERFACE(control, i_control));

#endif // APP_H
1 change: 1 addition & 0 deletions examples/usb/src/app.xc → examples/usb/device/src/app.xc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdint.h>
#include <assert.h>

#include "config.h"
#include "control.h"
#include "app.h"

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
// Copyright 2016-2025 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#ifndef DESCRIPTORS_H
#define DESCRIPTORS_H
#ifndef ENDPOINT0_H
#define ENDPOINT0_H

#include <xccompat.h>
#include "control.h"
#include "xud_device.h"

#define EP0_MAX_PACKET_SIZE 64

#define BCD_DEVICE 0x0100
#define BCD_USB 0x0201 // USB 2.01 needed for MSOS 2.0 support
#define VENDOR_ID 0x20B1
#define PRODUCT_ID 0x001A

#define MANUFACTURER_STR_INDEX 0x01
#define PRODUCT_STR_INDEX 0x02
Expand All @@ -23,6 +22,6 @@
#define VENDOR_SPECIFIC_SUBCLASS 0xff
#define VENDOR_SPECIFIC_PROTOCOL 0xff

void Endpoint0(chanend chan_ep0_out, chanend chan_ep0_in, client interface control i_control[1]);
void Endpoint0(chanend chan_ep0_out, chanend chan_ep0_in, CLIENT_INTERFACE_ARRAY(control, i_control, 1));

#endif // DESCRIPTORS_H
#endif // ENDPOINT0_H
Loading