Resolving build issues due to moving from custom/devicedefines.h to conf headers. Also removed i_audMan

This commit is contained in:
xross
2017-10-31 16:00:29 +00:00
parent e98fffd966
commit 420150f737
32 changed files with 92 additions and 106 deletions

View File

@@ -67,7 +67,7 @@ int main()
on tile[1]: XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud); on tile[1]: XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
/* IOHub core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */ /* IOHub core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
on tile[0]: XUA_AudioHub(c_aud, null); on tile[0]: XUA_AudioHub(c_aud);
} }
return 0; return 0;

View File

@@ -1,12 +0,0 @@
/* Required by lib_xua at the moment. To be replaced with lib_xua_conf.h"
*/
// Copyright (c) 2016, XMOS Ltd, All rights reserved
#ifndef __custom_defines_h__
#define __custom_defines_h__
#endif // __custom_defines_h__

View File

@@ -2,8 +2,8 @@
#include <platform.h> #include <platform.h>
#include <timer.h> #include <timer.h>
#include "audiohw.h"
#include "customdefines.h" #include "xua.h"
#include "i2c_shared.h" #include "i2c_shared.h"
#include "cs5368.h" #include "cs5368.h"

View File

@@ -2,16 +2,14 @@
#ifndef __XUA_H__ #ifndef __XUA_H__
#define __XUA_H__ #define __XUA_H__
#ifdef __xua_conf_h_exists__ #include "xua_conf_full.h"
#include "xua_conf.h"
#endif
#include "xua_conf_default.h"
#if __XC__ || __STDC__
#include "xua_audiohub.h" #include "xua_audiohub.h"
#include "xua_endpoint0.h" #include "xua_endpoint0.h"
#include "xua_buffer.h" #include "xua_buffer.h"
#endif
#endif #endif

View File

@@ -3,22 +3,12 @@
#if __XC__ #if __XC__
#include "xccompat.h"
#ifndef NO_USB #ifndef NO_USB
#include "dfu_interface.h" #include "dfu_interface.h"
#endif #endif
typedef interface audManage_if
{
[[guarded]]
void transfer_buffers(int * unsafe in_aud_buf, int * unsafe in_usb_buf,
int * unsafe out_usb_buf, int * unsafe out_aud_buf);
[[guarded]]
void transfer_samples(int in_mic_buf[], int in_spk_buf[], int out_mic_buf[], int out_spk_buf[]);
} audManage_if;
/** The audio driver thread. /** The audio driver thread.
* *
* This function drives I2S ports and handles samples to/from other digital * This function drives I2S ports and handles samples to/from other digital
@@ -44,7 +34,6 @@ void XUA_AudioHub(chanend ?c_aud
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, chanend c_pdm_in , chanend c_pdm_in
#endif #endif
, client audManage_if ?i_audMan
); );
void SpdifTxWrapper(chanend c_spdif_tx); void SpdifTxWrapper(chanend c_spdif_tx);
@@ -62,11 +51,8 @@ void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
#endif // __XC__ #endif // __XC__
void UserBufferManagementInit(CLIENT_INTERFACE(audManage_if, i_audMan)); void UserBufferManagementInit();
void UserBufferManagement(unsigned sampsFromUsbToAudio[],
unsigned sampsFromAudioToUsb[],
CLIENT_INTERFACE(audManage_if, i_audMan));
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]);
#endif // __XUA_AUDIOHUB_H__ #endif // __XUA_AUDIOHUB_H__

View File

@@ -1,6 +1,11 @@
#ifndef __XUA_BUFFER_H__ #ifndef __XUA_BUFFER_H__
#define __XUA_BUFFER_H__ #define __XUA_BUFFER_H__
/** USB Audio Buffering Thread.
#if __XC__
#include "xua.h"
/** USB Audio Buffering Core.
* *
* This function buffers USB audio data between the XUD layer and the decouple * This function buffers USB audio data between the XUD layer and the decouple
* thread. Most of the chanend parameters to the function should be connected to * thread. Most of the chanend parameters to the function should be connected to
@@ -17,8 +22,6 @@
* \param c_aud_ctl Audio control channel connected to Endpoint0() * \param c_aud_ctl Audio control channel connected to Endpoint0()
* \param p_off_mclk A port that is clocked of the MCLK input (not the MCLK input itself) * \param p_off_mclk A port that is clocked of the MCLK input (not the MCLK input itself)
*/ */
#include "devicedefines.h"
void XUA_Buffer( void XUA_Buffer(
chanend c_aud_out, chanend c_aud_out,
@@ -112,6 +115,6 @@ void XUA_Buffer_Decouple(chanend c_audio_out
#endif #endif
); );
#endif
#endif #endif

View File

@@ -2,9 +2,12 @@
* @brief Defines relating to device configuration and customisation of lib_xua * @brief Defines relating to device configuration and customisation of lib_xua
* @author Ross Owen, XMOS Limited * @author Ross Owen, XMOS Limited
*/ */
#ifndef __XUA_CONF_H__ #ifndef __XUA_CONF_DEFAULT_H__
#define __XUA_CONF_H__ #define __XUA_CONF_DEFAULT_H__
#ifdef __xua_conf_h_exists__
#include "xua_conf.h"
#endif
@@ -1163,7 +1166,7 @@
#endif #endif
#ifndef __ASSEMBLER__
/* Endpoint addresses enums */ /* Endpoint addresses enums */
enum USBEndpointNumber_In enum USBEndpointNumber_In
{ {
@@ -1209,6 +1212,8 @@ enum USBEndpointNumber_Out
ENDPOINT_COUNT_OUT /* End marker */ ENDPOINT_COUNT_OUT /* End marker */
}; };
#endif
/*** Internal defines below here. NOT FOR MODIFICATION ***/ /*** Internal defines below here. NOT FOR MODIFICATION ***/
#define AUDIO_STOP_FOR_DFU (0x12345678) #define AUDIO_STOP_FOR_DFU (0x12345678)

View File

@@ -0,0 +1,10 @@
#ifndef __XUA_CONF_FULL_H__
#define __XUA_CONF_FULL_H__
#ifdef __xua_conf_h_exists__
#include "xua_conf.h"
#endif
#include "xua_conf_default.h"
#endif

View File

@@ -2,10 +2,11 @@
#ifndef _XUA_ENDPOINT0_H_ #ifndef _XUA_ENDPOINT0_H_
#define _XUA_ENDPOINT0_H_ #define _XUA_ENDPOINT0_H_
#include "xua_conf_default.h" #include "xua.h"
#include "dfu_interface.h" #include "dfu_interface.h"
#include "vendorrequests.h" #include "vendorrequests.h"
#if __XC__
/** Function implementing Endpoint 0 for enumeration, control and configuration /** Function implementing Endpoint 0 for enumeration, control and configuration
* of USB audio devices. It uses the descriptors defined in ``descriptors_2.h``. * of USB audio devices. It uses the descriptors defined in ``descriptors_2.h``.
* *
@@ -27,3 +28,4 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl,
VENDOR_REQUESTS_PARAMS_DEC_); VENDOR_REQUESTS_PARAMS_DEC_);
#endif #endif
#endif

View File

@@ -14,10 +14,7 @@
#include <xs1_su.h> #include <xs1_su.h>
#include <string.h> #include <string.h>
#include "xua_conf_default.h" #include "xua.h"
#include "devicedefines.h" /* TODO rm me */
#include "xua_audiohub.h"
#include "audioports.h" #include "audioports.h"
#include "audiohw.h" #include "audiohw.h"
@@ -248,7 +245,7 @@ static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samp
#ifndef NO_USB #ifndef NO_USB
#pragma unsafe arrays #pragma unsafe arrays
static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord, client audManage_if ?i_audMan) static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord)
{ {
outuint(c_out, underflowWord); outuint(c_out, underflowWord);
@@ -290,7 +287,7 @@ static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, con
#else #else
inuint(c_out); inuint(c_out);
#endif #endif
UserBufferManagement(samplesOut, samplesIn[readBuffNo], i_audMan); UserBufferManagement(samplesOut, samplesIn[readBuffNo]);
#if NUM_USB_CHAN_IN > 0 #if NUM_USB_CHAN_IN > 0
#pragma loop unroll #pragma loop unroll
@@ -306,9 +303,9 @@ static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, con
#else /* NO_USB */ #else /* NO_USB */
#pragma unsafe arrays #pragma unsafe arrays
static inline unsigned DoSampleTransfer(chanend ?c_out, const int readBuffNo, const unsigned underflowWord, client audManage_if ?i_audMan) static inline unsigned DoSampleTransfer(chanend ?c_out, const int readBuffNo, const unsigned underflowWord)
{ {
UserBufferManagement(samplesOut, samplesIn[readBuffNo], i_audMan); UserBufferManagement(samplesOut, samplesIn[readBuffNo]);
return 0; return 0;
} }
#endif /* NO_USB */ #endif /* NO_USB */
@@ -448,20 +445,19 @@ static inline void InitPorts(unsigned divide)
/* I2S delivery thread */ /* I2S delivery thread */
#pragma unsafe arrays #pragma unsafe arrays
unsigned static deliver(chanend ?c_out, chanend ?c_spd_out, unsigned static deliver(chanend ?c_out, chanend ?c_spd_out
#ifdef ADAT_TX #ifdef ADAT_TX
chanend c_adat_out, , chanend c_adat_out
unsigned adatSmuxMode, , unsigned adatSmuxMode
#endif #endif
unsigned divide, unsigned curSamFreq, , unsigned divide, unsigned curSamFreq
#if(defined(SPDIF_RX) || defined(ADAT_RX)) #if(defined(SPDIF_RX) || defined(ADAT_RX))
chanend c_dig_rx, , chanend c_dig_rx
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
chanend c_pdm_pcm, , chanend c_pdm_pcm
#endif #endif
chanend ?unused, )
client audManage_if i_audMan)
{ {
/* Since DAC and ADC buffered ports off by one sample we buffer previous ADC frame */ /* Since DAC and ADC buffered ports off by one sample we buffer previous ADC frame */
@@ -538,12 +534,12 @@ unsigned static deliver(chanend ?c_out, chanend ?c_spd_out,
} }
#endif // ((DEBUG_MIC_ARRAY == 1) && (NUM_PDM_MICS > 0)) #endif // ((DEBUG_MIC_ARRAY == 1) && (NUM_PDM_MICS > 0))
UserBufferManagementInit(i_audMan); UserBufferManagementInit();
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord, i_audMan); unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord);
// Reinitialise user state before entering the main loop // Reinitialise user state before entering the main loop
UserBufferManagementInit(i_audMan); UserBufferManagementInit();
#ifdef ADAT_TX #ifdef ADAT_TX
unsafe{ unsafe{
@@ -1001,9 +997,9 @@ unsigned static deliver(chanend ?c_out, chanend ?c_spd_out,
/* The below looks a bit odd but forces the compiler to inline twice */ /* The below looks a bit odd but forces the compiler to inline twice */
unsigned command; unsigned command;
if(readBuffNo) if(readBuffNo)
command = DoSampleTransfer(c_out, 1, underflowWord, i_audMan); command = DoSampleTransfer(c_out, 1, underflowWord);
else else
command = DoSampleTransfer(c_out, 0, underflowWord, i_audMan); command = DoSampleTransfer(c_out, 0, underflowWord);
if(command) if(command)
{ {
@@ -1123,7 +1119,6 @@ chanend c_dig_rx,
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, chanend c_pdm_in , chanend c_pdm_in
#endif #endif
, client audManage_if ?i_audMan
) )
{ {
#if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE) #if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
@@ -1351,24 +1346,23 @@ chanend c_dig_rx,
outuint(c_adat_out, adatMultiple); outuint(c_adat_out, adatMultiple);
outuint(c_adat_out, adatSmuxMode); outuint(c_adat_out, adatSmuxMode);
#endif #endif
command = deliver(c_mix_out, command = deliver(c_mix_out
#ifdef SPDIF_TX #ifdef SPDIF_TX
c_spdif_out, , c_spdif_out
#else #else
null, , null
#endif #endif
#ifdef ADAT_TX #ifdef ADAT_TX
c_adat_out, , c_adat_out
adatSmuxMode, , adatSmuxMode
#endif #endif
divide, curSamFreq, , divide, curSamFreq
#if defined (ADAT_RX) || defined (SPDIF_RX) #if defined (ADAT_RX) || defined (SPDIF_RX)
c_dig_rx, , c_dig_rx
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
c_pdm_in, , c_pdm_in
#endif #endif
null, i_audMan
); );
#ifndef NO_USB #ifndef NO_USB

View File

@@ -3,15 +3,13 @@
#include "xua_audiohub.h" #include "xua_audiohub.h"
/* Default implementation for UserBufferManagementInit() */ /* Default implementation for UserBufferManagementInit() */
void __attribute__ ((weak)) UserBufferManagementInit(CLIENT_INTERFACE(audManage_if, i_audMan)) void __attribute__ ((weak)) UserBufferManagementInit()
{ {
/* Do nothing */ /* Do nothing */
} }
/* Default implementation for UserBufferManagement() */ /* Default implementation for UserBufferManagement() */
void __attribute__ ((weak)) UserBufferManagement(unsigned sampsFromUsbToAudio[], void __attribute__ ((weak)) UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[])
unsigned sampsFromAudioToUsb[],
CLIENT_INTERFACE(audManage_if, i_audMan))
{ {
/* Do nothing */ /* Do nothing */
} }

View File

@@ -3,7 +3,7 @@
#include <assert.h> #include <assert.h>
#include <print.h> #include <print.h>
#include "devicedefines.h" #include "xua.h"
#include "commands.h" #include "commands.h"
#if defined(SPDIF_RX) #if defined(SPDIF_RX)

View File

@@ -1,8 +1,8 @@
#ifndef __XUA_INTERNAL_CMDS_H__ #ifndef __XUA_INTERNAL_CMDS_H__
#define __XUA_INTERNAL_CMDS_H_ #define __XUA_INTERNAL_CMDS_H__
#include "xua_conf_default.h" #include "xua.h"
/* Clocking commands - c_clk_ctl */ /* Clocking commands - c_clk_ctl */
#define GET_SEL 0 /* Get value of clock selector */ #define GET_SEL 0 /* Get value of clock selector */

View File

@@ -2,13 +2,15 @@
* @brief Implements relevant requests from the USB Audio 2.0 Specification * @brief Implements relevant requests from the USB Audio 2.0 Specification
* @author Ross Owen, XMOS Semiconductor * @author Ross Owen, XMOS Semiconductor
*/ */
#include "xua.h"
#ifndef NO_USB #ifndef NO_USB
#include <xs1.h> #include <xs1.h>
#include "xud_device.h" #include "xud_device.h"
#include "usbaudio20.h" #include "usbaudio20.h"
#include "usbaudio10.h" #include "usbaudio10.h"
#include "dbcalc.h" #include "dbcalc.h"
#include "devicedefines.h"
#include "commands.h" #include "commands.h"
#include "xc_ptr.h" #include "xc_ptr.h"
#ifdef MIXER #ifdef MIXER

View File

@@ -2,7 +2,7 @@
#define _VENDORREQUESTS_H_ #define _VENDORREQUESTS_H_
#include <xccompat.h> #include <xccompat.h>
#include "xua_conf_default.h" #include "xua.h"
#include "xud_device.h" #include "xud_device.h"
/* Functions that handle vustomer vendor requests. /* Functions that handle vustomer vendor requests.

View File

@@ -7,7 +7,7 @@
#include <safestring.h> #include <safestring.h>
#include <stddef.h> #include <stddef.h>
#include "xua_conf_default.h" #include "xua.h"
#ifndef NO_USB #ifndef NO_USB
#include "xud_device.h" /* Standard descriptor requests */ #include "xud_device.h" /* Standard descriptor requests */

View File

@@ -1,5 +1,5 @@
#include "devicedefines.h" /* Device specific defines */ #include "xua.h" /* Device specific defines */
#ifndef EXCLUDE_USB_AUDIO_MAIN #ifndef EXCLUDE_USB_AUDIO_MAIN
/** /**

View File

@@ -2,8 +2,8 @@
#include <xs1.h> #include <xs1.h>
#include <print.h> #include <print.h>
#include "xua.h"
#include "mixer.h" #include "mixer.h"
#include "devicedefines.h"
#include "xc_ptr.h" #include "xc_ptr.h"
#include "commands.h" #include "commands.h"
#include "dbcalc.h" #include "dbcalc.h"

View File

@@ -1,7 +1,7 @@
#ifndef MIC_ARRAY_CONF_H_ #ifndef MIC_ARRAY_CONF_H_
#define MIC_ARRAY_CONF_H_ #define MIC_ARRAY_CONF_H_
#include "customdefines.h" #include "xua_conf_full.h"
#define MIC_ARRAY_MAX_FRAME_SIZE_LOG2 0 #define MIC_ARRAY_MAX_FRAME_SIZE_LOG2 0
#define MIC_ARRAY_NUM_MICS (NUM_PDM_MICS) #define MIC_ARRAY_NUM_MICS (NUM_PDM_MICS)

View File

@@ -1,5 +1,5 @@
#include "devicedefines.h" #include "xua.h"
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)

View File

@@ -1,5 +1,5 @@
#include "xua_conf_default.h"" #include "xua.h"
#if (NUM_PDM_MICS > 0) && !defined(MIC_PROCESSING_USE_INTERFACE) #if (NUM_PDM_MICS > 0) && !defined(MIC_PROCESSING_USE_INTERFACE)

View File

@@ -5,7 +5,7 @@
#undef __ASSEMBLER__ #undef __ASSEMBLER__
#include "audioports.h" #include "audioports.h"
#include <xccompat.h> #include <xccompat.h>
#include "xua_conf_default.h" #include "xua.h"
/* Note since DSD ports could be reused for I2S ports we do all the setup manually in C */ /* Note since DSD ports could be reused for I2S ports we do all the setup manually in C */
#if DSD_CHANS_DAC > 0 #if DSD_CHANS_DAC > 0

View File

@@ -2,7 +2,7 @@
#define _AUDIOPORTS_H_ #define _AUDIOPORTS_H_
#include <xccompat.h> #include <xccompat.h>
#include "xua_conf_default.h" #include "xua.h"
#ifdef __XC__ #ifdef __XC__
void ConfigAudioPorts( void ConfigAudioPorts(

View File

@@ -1,7 +1,7 @@
#include <xs1.h> #include <xs1.h>
#include <platform.h> #include <platform.h>
#include <print.h> #include <print.h>
#include "xua_conf_default.h" #include "xua.h"
#include "audioports.h" #include "audioports.h"

View File

@@ -1,7 +1,7 @@
#ifndef NO_USB #ifndef NO_USB
#include <xs1.h> #include <xs1.h>
#include "xua.h"
#include "xc_ptr.h" #include "xc_ptr.h"
#include "devicedefines.h"
#include "interrupt.h" #include "interrupt.h"
#include "commands.h" #include "commands.h"
#include "xud.h" #include "xud.h"

View File

@@ -2,8 +2,7 @@
#include <xs1.h> #include <xs1.h>
#include <print.h> #include <print.h>
#include "devicedefines.h" #include "xua.h"
#include "xua_buffer.h"
#ifdef MIDI #ifdef MIDI
#include "usb_midi.h" #include "usb_midi.h"

View File

@@ -3,9 +3,7 @@
Warnings relating to configuration defines located in this XC source file rather than the devicedefines.h header file in order to avoid multiple warnings being issued when the devicedefines.h header file is included in multiple files. Warnings relating to configuration defines located in this XC source file rather than the devicedefines.h header file in order to avoid multiple warnings being issued when the devicedefines.h header file is included in multiple files.
*/ */
#include "customdefines.h" #include "xua_conf_default.h"
#include "customdefines.h"
#ifndef NO_USB #ifndef NO_USB

View File

@@ -8,7 +8,7 @@
#define _DEVICE_DESCRIPTORS_ #define _DEVICE_DESCRIPTORS_
#include <stddef.h> #include <stddef.h>
#include "xua_conf_default.h" /* Device specific define */ #include "xua.h" /* Device specific define */
#include "descriptor_defs.h" #include "descriptor_defs.h"
#include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */ #include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */
#include "usbaudiocommon.h" #include "usbaudiocommon.h"

View File

@@ -1,5 +1,5 @@
#ifndef NO_USB #ifndef NO_USB
#include "xua_conf_default.h" #include "xua.h"
#include "hostactive.h" #include "hostactive.h"
#include "audiostream.h" #include "audiostream.h"

View File

@@ -1,8 +1,7 @@
#include "devicedefines.h" #include "xua.h"
#if (XUA_DFU == 1) #if (XUA_DFU == 1)
#include <xs1.h> #include <xs1.h>
#include <platform.h> #include <platform.h>
#include "devicedefines.h"
#ifndef NO_USB #ifndef NO_USB
#include "xud_device.h" #include "xud_device.h"

View File

@@ -2,6 +2,8 @@
#ifndef __DFU_INTERFACE_H__ #ifndef __DFU_INTERFACE_H__
#define __DFU_INTERFACE_H__ #define __DFU_INTERFACE_H__
#if __XC__
#include "xud_device.h" #include "xud_device.h"
interface i_dfu interface i_dfu
@@ -9,6 +11,8 @@ interface i_dfu
{unsigned, int, int, int, unsigned} HandleDfuRequest(USB_SetupPacket_t &sp, unsigned data_buffer[], unsigned data_buffer_length, unsigned dfuState); {unsigned, int, int, int, unsigned} HandleDfuRequest(USB_SetupPacket_t &sp, unsigned data_buffer[], unsigned data_buffer_length, unsigned dfuState);
void finish(); void finish();
}; };
#endif
#endif #endif

View File

@@ -1,7 +1,7 @@
#ifndef __usb_midi_h__ #ifndef __usb_midi_h__
#define __usb_midi_h__ #define __usb_midi_h__
#include "devicedefines.h" #include "xua.h"
/** USB MIDI I/O thread. /** USB MIDI I/O thread.
* *