forked from PAWPAW-Mirror/lib_xua
DFU now uses an interface to DFU handler which does flash handling. Should allow access to flash on another tile more easily.
This commit is contained in:
@@ -204,7 +204,7 @@ const unsigned g_chanCount_In_HS[INPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_I
|
||||
|
||||
/* Endpoint 0 function. Handles all requests to the device */
|
||||
void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl)
|
||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface))
|
||||
{
|
||||
USB_SetupPacket_t sp;
|
||||
XUD_ep ep0_out = XUD_InitEp(c_ep0_out);
|
||||
@@ -296,11 +296,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
while(1)
|
||||
{
|
||||
/* Returns XUD_RES_OKAY for success, XUD_RES_RST for bus reset */
|
||||
#if defined(__XC__)
|
||||
XUD_Result_t result = USB_GetSetupPacket(ep0_out, ep0_in, sp);
|
||||
#else
|
||||
XUD_Result_t result = USB_GetSetupPacket(ep0_out, ep0_in, &sp);
|
||||
#endif
|
||||
|
||||
if (result == XUD_RES_OKAY)
|
||||
{
|
||||
@@ -573,13 +569,9 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
// Handshake
|
||||
chkct(c_audioControl, XS1_CT_END);
|
||||
}
|
||||
#ifdef __XC__
|
||||
|
||||
/* This will return 1 if reset requested */
|
||||
if (DFUDeviceRequests(ep0_out, ep0_in, sp, null, g_interfaceAlt[sp.wIndex], 1))
|
||||
#else
|
||||
/* This will return 1 if reset requested */
|
||||
if (DFUDeviceRequests(ep0_out, &ep0_in, &sp, null, g_interfaceAlt[sp.wIndex], 1))
|
||||
#endif
|
||||
if (DFUDeviceRequests(ep0_out, &ep0_in, &sp, null, g_interfaceAlt[sp.wIndex], dfuInterface))
|
||||
{
|
||||
DFUDelay(50000000);
|
||||
device_reboot(c_audioControl);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#ifndef _ENDPOINT0_H_
|
||||
#define _ENDPOINT0_H_
|
||||
|
||||
#include "dfu_interface.h"
|
||||
|
||||
/** Function implementing Endpoint 0 for enumeration, control and configuration
|
||||
* of USB audio devices. It uses the descriptors defined in ``descriptors_2.h``.
|
||||
*
|
||||
@@ -18,7 +20,7 @@
|
||||
* \param c_EANativeTransport_ctrl Optional chanend to be connected to EA Native
|
||||
* endpoint manager if present
|
||||
*/
|
||||
void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl,
|
||||
chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctrl);
|
||||
void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl,
|
||||
chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctr, client interface i_dfu dfuInterface);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
|
||||
#include "clocking.h"
|
||||
|
||||
[[distributable]]
|
||||
void DFUHandler(server interface i_dfu i, chanend ?c_user_cmd);
|
||||
|
||||
/* Audio I/O - Port declarations */
|
||||
#if I2S_WIRES_DAC > 0
|
||||
on tile[AUDIO_IO_TILE] : buffered out port:32 p_i2s_dac[I2S_WIRES_DAC] =
|
||||
@@ -296,6 +299,12 @@ void usb_audio_core(chanend c_mix_out
|
||||
#define c_EANativeTransport_ctrl null
|
||||
#endif
|
||||
|
||||
#ifdef DFU
|
||||
interface i_dfu dfuInterface;
|
||||
#else
|
||||
#define dfuInterface null
|
||||
#endif
|
||||
|
||||
par
|
||||
{
|
||||
/* USB Interface Core */
|
||||
@@ -367,7 +376,12 @@ void usb_audio_core(chanend c_mix_out
|
||||
/* Endpoint 0 Core */
|
||||
{
|
||||
thread_speed();
|
||||
Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, c_clk_ctl, c_EANativeTransport_ctrl);
|
||||
par
|
||||
{
|
||||
[[distribute]]
|
||||
DFUHandler(dfuInterface, null);
|
||||
Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, c_clk_ctl, c_EANativeTransport_ctrl, dfuInterface);
|
||||
}
|
||||
}
|
||||
|
||||
/* Decoupling core */
|
||||
|
||||
Reference in New Issue
Block a user