forked from PAWPAW-Mirror/lib_xua
When in sync mode Pll ref pin driving is now via interface to allow flexibility of port/tile
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#if __XC__
|
||||
|
||||
#include "xua.h"
|
||||
#include "clocking.h"
|
||||
|
||||
/** USB Audio Buffering Core.
|
||||
*
|
||||
@@ -50,7 +51,7 @@ void XUA_Buffer(
|
||||
#endif
|
||||
, chanend c_aud
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, out port p_sync
|
||||
, client interface sync_if i_sync
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -80,7 +81,7 @@ void XUA_Buffer_Ep(chanend c_aud_out,
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, out port p_sync
|
||||
, client interface sync_if i_sync
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -94,7 +95,5 @@ void XUA_Buffer_Decouple(chanend c_audio_out
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "xua_conf.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Default tile arrangement */
|
||||
|
||||
/**
|
||||
@@ -57,6 +55,13 @@
|
||||
#define PDM_TILE AUDIO_IO_TILE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Location (tile) of reference signal to CS2100. Default: AUDIO_IO_TILE
|
||||
*/
|
||||
#ifndef PLL_REF_TILE
|
||||
#define PLL_REF_TILE AUDIO_IO_TILE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Disable USB functionalty just leaving AudioHub
|
||||
*/
|
||||
|
||||
@@ -115,7 +115,7 @@ void XUA_Buffer(
|
||||
#endif
|
||||
, chanend c_aud
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, out port p_sync
|
||||
, client interface sync_if i_sync
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ void XUA_Buffer(
|
||||
, c_buff_ctrl
|
||||
#endif
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, p_sync
|
||||
, i_sync
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -200,7 +200,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
#if XUA_SYNCMODE == XUA_SYNCMODE_SYNC
|
||||
, out port p_sync
|
||||
, client interface sync_if i_sync
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -510,7 +510,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
/* SOF notification from XUD_Manager() */
|
||||
case inuint_byref(c_sof, u_tmp):
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
/* This really could (shoud) be done in decouple. However, for a quick demo this is okay
|
||||
/* This really could (should) be done in decouple. However, for a quick demo this is okay
|
||||
* Decouple expects a 16:16 number in fixed point stored in the global g_speed */
|
||||
|
||||
unsigned usbSpeed;
|
||||
@@ -528,8 +528,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
sofCount += 1000;
|
||||
if (sofCount == framesPerSec)
|
||||
{
|
||||
p_sync <: syncPinVal;
|
||||
syncPinVal = ~syncPinVal;
|
||||
/* Port is accessed via interface to allow flexibilty with location */
|
||||
i_sync.toggle();
|
||||
sofCount = 0;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "xua.h"
|
||||
#include "xua_commands.h"
|
||||
#include "clocking.h"
|
||||
|
||||
#if (SPDIF_RX)
|
||||
#include "spdif.h"
|
||||
@@ -38,6 +39,24 @@ static int clockValid[NUM_CLOCKS]; /* Store current val
|
||||
static int clockInt[NUM_CLOCKS]; /* Interupt flag for clocks */
|
||||
static int clockId[NUM_CLOCKS];
|
||||
|
||||
[[combinable]]
|
||||
void PllRefPinTask(server interface sync_if i_sync, out port p_sync)
|
||||
{
|
||||
static unsigned pinVal= 0;
|
||||
p_sync <: pinVal;
|
||||
|
||||
while(1)
|
||||
{
|
||||
select
|
||||
{
|
||||
case i_sync.toggle():
|
||||
pinVal = ~pinVal;
|
||||
p_sync <: pinVal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
static int abs(int x)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef _CLOCKING_H_
|
||||
@@ -16,5 +16,13 @@
|
||||
interrupts
|
||||
*/
|
||||
void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int);
|
||||
|
||||
interface sync_if
|
||||
{
|
||||
void toggle();
|
||||
};
|
||||
|
||||
[[combinable]]
|
||||
void PllRefPinTask(server interface sync_if i_sync, out port p_sync);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -154,14 +154,9 @@ on stdcore[XUD_TILE] : buffered in port:32 p_adat_rx = PORT_ADAT_IN;
|
||||
on tile[XUD_TILE] : buffered in port:4 p_spdif_rx = PORT_SPDIF_IN;
|
||||
#endif
|
||||
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
#if (SPDIF_RX) || (ADAT_RX) || (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
/* Reference to external clock multiplier */
|
||||
on tile[XUD_TILE] : out port p_pll_clk = PORT_PLL_REF;
|
||||
#endif
|
||||
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
/* Reference to external clock multiplier */
|
||||
on tile[AUDIO_IO_TILE] : out port p_pll_clk = PORT_PLL_REF;
|
||||
on tile[PLL_REF_TILE] : out port p_pll_ref = PORT_PLL_REF;
|
||||
#endif
|
||||
|
||||
#ifdef MIDI
|
||||
@@ -294,7 +289,7 @@ void usb_audio_core(chanend c_mix_out
|
||||
, chanend ?c_clk_ctl
|
||||
, client interface i_dfu ?dfuInterface
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, out port p_sync
|
||||
, client interface sync_if i_sync
|
||||
#endif
|
||||
VENDOR_REQUESTS_PARAMS_DEC_
|
||||
)
|
||||
@@ -378,7 +373,7 @@ VENDOR_REQUESTS_PARAMS_DEC_
|
||||
#endif
|
||||
, c_mix_out
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, p_sync
|
||||
, i_sync
|
||||
#endif
|
||||
);
|
||||
//:
|
||||
@@ -510,7 +505,7 @@ void usb_audio_io(chanend ?c_aud_in,
|
||||
{
|
||||
thread_speed();
|
||||
|
||||
clockGen(c_spdif_rx, c_adat_rx, p_pll_clk, c_dig_rx, c_clk_ctl, c_clk_int);
|
||||
clockGen(c_spdif_rx, c_adat_rx, p_pll_ref, c_dig_rx, c_clk_ctl, c_clk_int);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -589,12 +584,20 @@ int main()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
interface sync_if i_sync;
|
||||
#endif
|
||||
|
||||
USER_MAIN_DECLARATIONS
|
||||
|
||||
par
|
||||
{
|
||||
USER_MAIN_CORES
|
||||
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
on tile[PLL_REF_TILE]: PllRefPinTask(i_sync, p_pll_ref);
|
||||
|
||||
#endif
|
||||
on tile[XUD_TILE]:
|
||||
par
|
||||
{
|
||||
@@ -621,7 +624,7 @@ int main()
|
||||
#endif
|
||||
, c_clk_int, c_clk_ctl, dfuInterface
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, p_pll_clk
|
||||
, i_sync
|
||||
#endif
|
||||
VENDOR_REQUESTS_PARAMS_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user