Refactor inuint_byref to testct_byref to support using status reporting. Works as before.
This commit is contained in:
@@ -1,2 +1,17 @@
|
||||
//#pragma select handler
|
||||
#include <xs1.h>
|
||||
|
||||
/* TODO Currently complier does not support inline select functions, hense this is in a seperate file to ensure this is not the case */
|
||||
#pragma select handler
|
||||
void testct_byref(chanend c, unsigned &isCt) ;
|
||||
inline void testct_byref(chanend c, unsigned &isCt)
|
||||
{
|
||||
if (testct(c))
|
||||
{
|
||||
isCt = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
isCt = 0;
|
||||
}
|
||||
}
|
||||
//void testct_byref(chanend c, unsigned &isCt) ;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* TODO Currently complier does not support inline select functions, hense this is in a seperate file to ensure this is not the case */
|
||||
#pragma select handler
|
||||
void testct_byref(chanend c, unsigned &isCt)
|
||||
void testct_byrefnot(chanend c, unsigned &isCt)
|
||||
{
|
||||
if (testct(c))
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "xc_ptr.h"
|
||||
#include "clockcmds.h"
|
||||
#include "xud.h"
|
||||
|
||||
#include "testct_byref.h"
|
||||
|
||||
//typedef unsigned int XUD_ep;
|
||||
|
||||
@@ -539,14 +539,17 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
#endif
|
||||
|
||||
#ifdef IAP
|
||||
case inuint_byref(c_iap_from_host, tmp):
|
||||
case testct_byref(c_iap_from_host, tmp):
|
||||
asm("#iap h->d");
|
||||
|
||||
if (tmp) {
|
||||
// Is a control token so reset
|
||||
} else {
|
||||
// Not a control token so is data
|
||||
/* Get buffer data from host - IAP OUT from host always into a single buffer */
|
||||
{
|
||||
xc_ptr p = iap_from_host_buffer + 4;
|
||||
xc_ptr p0 = p;
|
||||
int tail;
|
||||
inuint(c_iap_from_host); // And discard
|
||||
while (!testct(c_iap_from_host))
|
||||
{
|
||||
unsigned int datum = inuint(c_iap_from_host);
|
||||
@@ -580,7 +583,6 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
// printintln(datalength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XUD_SetNotReady(ep_iap_from_host);
|
||||
|
||||
@@ -588,13 +590,16 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
|
||||
/* release the buffer */
|
||||
SET_SHARED_GLOBAL(g_iap_from_host_flag, 1);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
/* IAP IN to host */
|
||||
case inuint_byref(c_iap_to_host, tmp):
|
||||
case testct_byref(c_iap_to_host, tmp):
|
||||
asm("#iap d->h");
|
||||
|
||||
if (tmp) {
|
||||
// Is a control token so reset
|
||||
} else {
|
||||
inuint(c_iap_to_host); // And discard
|
||||
// fill in the data
|
||||
XUD_SetData_Inline(ep_iap_to_host, c_iap_to_host);
|
||||
|
||||
@@ -604,19 +609,22 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
SET_SHARED_GLOBAL(g_iap_to_host_flag, 1);
|
||||
|
||||
swap(iap_to_host_buffer, iap_to_host_waiting_buffer);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
/* IAP interrupt IN to host */
|
||||
case inuint_byref(c_iap_to_host_int, tmp):
|
||||
case testct_byref(c_iap_to_host_int, tmp):
|
||||
asm("#iap interrupt d->h");
|
||||
|
||||
if (tmp) {
|
||||
// Is a control token so reset
|
||||
} else {
|
||||
inuint(c_iap_to_host_int); // And discard
|
||||
// fill in the data
|
||||
XUD_SetData_Inline(ep_iap_to_host_int, c_iap_to_host_int);
|
||||
|
||||
XUD_SetNotReady(ep_iap_to_host_int);
|
||||
// Don't need to handle data here as always ZLP
|
||||
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
@@ -624,5 +632,4 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
}
|
||||
|
||||
set_thread_fast_mode_off();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user