forked from PAWPAW-Mirror/lib_xua
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
|
#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 */
|
/* 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
|
#pragma select handler
|
||||||
void testct_byref(chanend c, unsigned &isCt)
|
void testct_byrefnot(chanend c, unsigned &isCt)
|
||||||
{
|
{
|
||||||
if (testct(c))
|
if (testct(c))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "xc_ptr.h"
|
#include "xc_ptr.h"
|
||||||
#include "clockcmds.h"
|
#include "clockcmds.h"
|
||||||
#include "xud.h"
|
#include "xud.h"
|
||||||
|
#include "testct_byref.h"
|
||||||
|
|
||||||
//typedef unsigned int XUD_ep;
|
//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
|
#endif
|
||||||
|
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
case inuint_byref(c_iap_from_host, tmp):
|
case testct_byref(c_iap_from_host, tmp):
|
||||||
asm("#iap h->d");
|
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 */
|
/* Get buffer data from host - IAP OUT from host always into a single buffer */
|
||||||
{
|
|
||||||
xc_ptr p = iap_from_host_buffer + 4;
|
xc_ptr p = iap_from_host_buffer + 4;
|
||||||
xc_ptr p0 = p;
|
xc_ptr p0 = p;
|
||||||
int tail;
|
int tail;
|
||||||
|
inuint(c_iap_from_host); // And discard
|
||||||
while (!testct(c_iap_from_host))
|
while (!testct(c_iap_from_host))
|
||||||
{
|
{
|
||||||
unsigned int datum = inuint(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);
|
// printintln(datalength);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
XUD_SetNotReady(ep_iap_from_host);
|
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 */
|
/* release the buffer */
|
||||||
SET_SHARED_GLOBAL(g_iap_from_host_flag, 1);
|
SET_SHARED_GLOBAL(g_iap_from_host_flag, 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* IAP IN to host */
|
/* IAP IN to host */
|
||||||
case inuint_byref(c_iap_to_host, tmp):
|
case testct_byref(c_iap_to_host, tmp):
|
||||||
asm("#iap d->h");
|
asm("#iap d->h");
|
||||||
|
if (tmp) {
|
||||||
|
// Is a control token so reset
|
||||||
|
} else {
|
||||||
|
inuint(c_iap_to_host); // And discard
|
||||||
// fill in the data
|
// fill in the data
|
||||||
XUD_SetData_Inline(ep_iap_to_host, c_iap_to_host);
|
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);
|
SET_SHARED_GLOBAL(g_iap_to_host_flag, 1);
|
||||||
|
|
||||||
swap(iap_to_host_buffer, iap_to_host_waiting_buffer);
|
swap(iap_to_host_buffer, iap_to_host_waiting_buffer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* IAP interrupt IN to host */
|
/* 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");
|
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
|
// fill in the data
|
||||||
XUD_SetData_Inline(ep_iap_to_host_int, c_iap_to_host_int);
|
XUD_SetData_Inline(ep_iap_to_host_int, c_iap_to_host_int);
|
||||||
|
|
||||||
XUD_SetNotReady(ep_iap_to_host_int);
|
XUD_SetNotReady(ep_iap_to_host_int);
|
||||||
// Don't need to handle data here as always ZLP
|
// Don't need to handle data here as always ZLP
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#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();
|
set_thread_fast_mode_off();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user