updates to pass pointer based string table to StandardRequests

This commit is contained in:
Ross Owen
2014-03-20 18:19:52 +00:00
parent 9eb50def03
commit 81473a0c5b

View File

@@ -7,6 +7,7 @@
#include <xs1.h> #include <xs1.h>
#include <safestring.h> #include <safestring.h>
#include <stddef.h>
#include "xud.h" /* XUD user defines and functions */ #include "xud.h" /* XUD user defines and functions */
#include "usb_std_requests.h" #include "usb_std_requests.h"
@@ -495,9 +496,9 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
result = USB_StandardRequests(ep0_out, ep0_in, result = USB_StandardRequests(ep0_out, ep0_in,
(unsigned char*)&devDesc_Audio2, sizeof(devDesc_Audio2), (unsigned char*)&devDesc_Audio2, sizeof(devDesc_Audio2),
(unsigned char*)&cfgDesc_Audio2, sizeof(cfgDesc_Audio2), (unsigned char*)&cfgDesc_Audio2, sizeof(cfgDesc_Audio2),
devDesc_Audio1, sizeof(devDesc_Audio1), (unsigned char*)&devDesc_Audio1, sizeof(devDesc_Audio1),
cfgDesc_Audio1, sizeof(cfgDesc_Audio1), cfgDesc_Audio1, sizeof(cfgDesc_Audio1),
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), (char(*)[])g_strTable, sizeof(g_strTable)/sizeof(char *),
&sp, c_usb_test, g_curUsbSpeed); &sp, c_usb_test, g_curUsbSpeed);
#elif FULL_SPEED_AUDIO_2 #elif FULL_SPEED_AUDIO_2
/* Return Audio 2.0 Descriptors for high_speed and full-speed */ /* Return Audio 2.0 Descriptors for high_speed and full-speed */
@@ -576,18 +577,18 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
null, 0, null, 0,
null, 0, null, 0,
#ifdef __XC__ #ifdef __XC__
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), sp, c_usb_test, g_curUsbSpeed); g_strTable, sizeof(g_strTable), sp, c_usb_test, g_curUsbSpeed);
#else #else
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), &sp, c_usb_test, g_curUsbSpeed); (char(*)[])&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, c_usb_test, g_curUsbSpeed);
#endif #endif
#elif (AUDIO_CLASS == 1) #elif (AUDIO_CLASS == 1)
/* Return Audio 1.0 Descriptors in FS, should never be in HS! */ /* Return Audio 1.0 Descriptors in FS, should never be in HS! */
result = USB_StandardRequests(ep0_out, ep0_in, result = USB_StandardRequests(ep0_out, ep0_in,
null, 0, null, 0,
null, 0, null, 0,
devDesc_Audio1, sizeof(devDesc_Audio1), (unsigned char*)&devDesc_Audio1, sizeof(devDesc_Audio1),
cfgDesc_Audio1, sizeof(cfgDesc_Audio1), cfgDesc_Audio1, sizeof(cfgDesc_Audio1),
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), &sp, c_usb_test, g_curUsbSpeed); (char(*)[])&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, c_usb_test, g_curUsbSpeed);
#else #else
/* Return Audio 2.0 Descriptors with Null device as fallback */ /* Return Audio 2.0 Descriptors with Null device as fallback */
result = USB_StandardRequests(ep0_out, ep0_in, result = USB_StandardRequests(ep0_out, ep0_in,
@@ -595,7 +596,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
(unsigned char*)&cfgDesc_Audio2, sizeof(cfgDesc_Audio2), (unsigned char*)&cfgDesc_Audio2, sizeof(cfgDesc_Audio2),
devDesc_Null, sizeof(devDesc_Null), devDesc_Null, sizeof(devDesc_Null),
cfgDesc_Null, sizeof(cfgDesc_Null), cfgDesc_Null, sizeof(cfgDesc_Null),
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), &sp, c_usb_test, g_curUsbSpeed); (char(*)[])&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, c_usb_test, g_curUsbSpeed);
#endif #endif
#ifdef DFU #ifdef DFU
} }
@@ -607,11 +608,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
DFUcfgDesc, sizeof(DFUcfgDesc), DFUcfgDesc, sizeof(DFUcfgDesc),
null, 0, /* Used same descriptors for full and high-speed */ null, 0, /* Used same descriptors for full and high-speed */
null, 0, null, 0,
#ifdef __XC__ (char(*)[])&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, c_usb_test, g_curUsbSpeed);
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), sp, c_usb_test, g_curUsbSpeed);
#else
strDescs, sizeof(strDescs)/sizeof(strDescs[0]), &sp, c_usb_test, g_curUsbSpeed);
#endif
} }
#endif #endif
} }
@@ -646,6 +643,5 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
} }
#endif #endif
} }
} }
} }