• R/O
  • SSH

Scope: Commit

digital oscilloscope


Commit MetaInfo

Revisione778ca7ec17bd8291f30dd2a9082af9d0db6d65c (tree)
Zeit2018-12-03 04:14:20
AutorPJ
CommiterPJ

Log Message

firmware/bulk/setupdat: handle_get_interface() changed; handle_hispeed() removed

Ändern Zusammenfassung

Diff

diff -r 9ec289b9b4fe -r e778ca7ec17b firmware/bulk/bulk_in.c
--- a/firmware/bulk/bulk_in.c Sat Nov 24 14:06:30 2018 +0000
+++ b/firmware/bulk/bulk_in.c Sun Dec 02 19:14:20 2018 +0000
@@ -282,7 +282,7 @@
282282 type_adc = 1;
283283
284284 // renumerate
285- RENUMERATE();
285+ USBCS|=bmDISCON|bmRENUM;delay(1500);USBCS &= ~bmDISCON;
286286
287287 CPUCS = CPU_CLK_48; // CPU clock = 48MHz
288288
diff -r 9ec289b9b4fe -r e778ca7ec17b firmware/bulk/fw_common.h
--- a/firmware/bulk/fw_common.h Sat Nov 24 14:06:30 2018 +0000
+++ b/firmware/bulk/fw_common.h Sun Dec 02 19:14:20 2018 +0000
@@ -54,13 +54,12 @@
5454
5555 uint8_t alternate = 0;
5656
57-BOOL handle_get_interface(BYTE ifc, BYTE* alt_ifc)
57+uint8_t handle_get_interface(uint8_t ifc)
5858 {
59- if (ifc==0) {
60- *alt_ifc = alternate;
61- return TRUE;
62- }
63- return FALSE;
59+ if (ifc != 0)
60+ return ALT_INVALID; // If the interface specified does not exist, then the device responds with a Request Error.
61+
62+ return alternate;
6463 }
6564
6665 BYTE handle_get_configuration(void)
@@ -99,7 +98,9 @@
9998 }
10099
101100 void hispeed_isr() interrupt {
101+#ifdef OLD_HISPEED
102102 handle_hispeed();
103+#endif
103104 CLEAR_HISPEED();
104105 }
105106
diff -r 9ec289b9b4fe -r e778ca7ec17b firmware/bulk/setupdat.c
--- a/firmware/bulk/setupdat.c Sat Nov 24 14:06:30 2018 +0000
+++ b/firmware/bulk/setupdat.c Sun Dec 02 19:14:20 2018 +0000
@@ -23,13 +23,7 @@
2323 #include "FX2.h"
2424
2525
26-extern BOOL handle_vendorcommand(BYTE cmd);
27-extern BOOL handle_set_configuration(BYTE cfg);
28-extern BOOL handle_get_interface(BYTE ifc, BYTE* alt_ifc);
29-extern BOOL handle_set_interface(BYTE ifc,BYTE alt_ifc);
30-extern BYTE handle_get_configuration();
31-extern BOOL handle_set_configuration(BYTE cfg);
32-extern void handle_reset_ep(BYTE ep);
26+//extern void handle_reset_ep(BYTE ep);
3327
3428 /**
3529 * Predefs for handlers
@@ -100,8 +94,8 @@
10094
10195 case GET_INTERFACE:
10296 {
103- BYTE alt_ifc;
104- if (!handle_get_interface(SETUPDAT[4],&alt_ifc)) {
97+ uint8_t alt_ifc = handle_get_interface(SETUPDAT[4]);
98+ if (alt_ifc == ALT_INVALID) {
10599 STALLEP0();
106100 } else {
107101 EP0BUF[0] = alt_ifc;
@@ -249,14 +243,16 @@
249243
250244 #include "descr.h"
251245
252-//WORD pDevConfig = (WORD)&dscr_config_fs;
246+#ifdef OLD_HISPEED
247+WORD pDevConfig = (WORD)&dscr_config_fs;
253248
254249 #ifndef USB_FS
255250 // Hi Speed Interrupt
256251 void handle_hispeed() __critical {
257-// pDevConfig = (WORD)&dscr_config_hs;
252+ pDevConfig = (WORD)&dscr_config_hs;
258253 }
259254 #endif
255+#endif // OLD_HISPEED
260256
261257 /**
262258 * Handle:
diff -r 9ec289b9b4fe -r e778ca7ec17b firmware/bulk/setupdat.h
--- a/firmware/bulk/setupdat.h Sat Nov 24 14:06:30 2018 +0000
+++ b/firmware/bulk/setupdat.h Sun Dec 02 19:14:20 2018 +0000
@@ -96,15 +96,25 @@
9696 \endverbatim
9797 */
9898
99+#include <stdint.h>
100+
101+BOOL handle_vendorcommand(BYTE cmd);
102+BOOL handle_set_configuration(BYTE cfg);
103+uint8_t handle_get_interface(uint8_t ifc);
104+enum { ALT_INVALID = 0xff };
105+BOOL handle_set_interface(BYTE ifc, BYTE alt_ifc);
106+BYTE handle_get_configuration(void);
107+BOOL handle_set_configuration(BYTE cfg);
108+
99109 // for ease functions
100110
101111 #define STALLEP0() EP0CS |= bmEPSTALL
102112 // to use this, the endpoint needs bit 8 to be IN=1,OUT=0
103113 //#define RESETTOGGLE(ep) TOGCTL = (ep&0x0F) + ((ep&0x80)>>3); TOGCTL |= bmRESETTOGGLE
104114 #define RESETTOGGLE(ep) TOGCTL = (ep&0x0F) + ((ep&0x80)>>3); TOGCTL = (ep&0x0F) + ((ep&0x80)>>3) + bmRESETTOGGLE
105-#define RENUMERATE_START USBCS|=bmDISCON|bmRENUM
106-#define RENUMERATE_END USBCS &= ~bmDISCON
107-#define RENUMERATE() USBCS|=bmDISCON|bmRENUM;delay(1500);USBCS &= ~bmDISCON
115+//#define RENUMERATE_START USBCS|=bmDISCON|bmRENUM
116+//#define RENUMERATE_END USBCS &= ~bmDISCON
117+//#define RENUMERATE() USBCS|=bmDISCON|bmRENUM;delay(1500);USBCS &= ~bmDISCON
108118
109119 //! see TRM 2-3
110120 //! here are the usb setup data commands
@@ -139,16 +149,17 @@
139149 You can also use the usbjt and enable the sudav isr
140150 and call the function from withing the sudav isr routine
141151 */
142-void handle_setupdata();
152+void handle_setupdata(void);
143153
154+#ifdef OLD_HISPEED
144155 /**
145156 For devices to properly handle usb hispeed
146157 (This is if your descriptor has high speed and full speed versions
147- and it should since the fx2lp is a high speed capable device
148- )
158+ and it should since the fx2lp is a high speed capable device)
149159 enable both USBRESET and HISPEED interrupts and
150160 call this function to switch the descriptors
151161 **/
152162 void handle_hispeed();
163+#endif // OLD_HISPEED
153164
154165 #endif
diff -r 9ec289b9b4fe -r e778ca7ec17b firmware/iso/fw_common.h
--- a/firmware/iso/fw_common.h Sat Nov 24 14:06:30 2018 +0000
+++ b/firmware/iso/fw_common.h Sun Dec 02 19:14:20 2018 +0000
@@ -30,13 +30,12 @@
3030
3131 uint8_t alternate = 0;
3232
33-BOOL handle_get_interface(BYTE ifc, BYTE* alt_ifc)
33+uint8_t handle_get_interface(uint8_t ifc)
3434 {
35- if (ifc==0) {
36- *alt_ifc = alternate;
37- return TRUE;
38- }
39- return FALSE;
35+ if (ifc != 0)
36+ return ALT_INVALID; // If the interface specified does not exist, then the device responds with a Request Error.
37+
38+ return alternate;
4039 }
4140
4241 BYTE handle_get_configuration(void)
@@ -63,7 +62,9 @@
6362 }
6463
6564 void hispeed_isr() interrupt {
65+#ifdef OLD_HISPEED
6666 handle_hispeed();
67+#endif
6768 CLEAR_HISPEED();
6869 }
6970
diff -r 9ec289b9b4fe -r e778ca7ec17b firmware/iso/probe.c
--- a/firmware/iso/probe.c Sat Nov 24 14:06:30 2018 +0000
+++ b/firmware/iso/probe.c Sun Dec 02 19:14:20 2018 +0000
@@ -363,7 +363,7 @@
363363 OED = 0;
364364
365365 // renumerate
366- RENUMERATE();
366+ USBCS|=bmDISCON|bmRENUM;delay(1500);USBCS &= ~bmDISCON;
367367
368368 // set 0 wait cycles on data memory access (MOVX)
369369 CKCON = CKCON_MD_0;
diff -r 9ec289b9b4fe -r e778ca7ec17b firmware/test_in/test_in.c
--- a/firmware/test_in/test_in.c Sat Nov 24 14:06:30 2018 +0000
+++ b/firmware/test_in/test_in.c Sun Dec 02 19:14:20 2018 +0000
@@ -262,18 +262,15 @@
262262 return FALSE;
263263 }
264264
265-BOOL handle_get_interface(uint8_t ifc, uint8_t * alt_ifc)
265+uint8_t handle_get_interface(uint8_t ifc)
266266 {
267267 if (usb_config == USB_CFG_OFF)
268- return FALSE; // Address state: A Request Error response is given by the device.
268+ return ALT_INVALID; // Address state: A Request Error response is given by the device.
269269
270- switch (ifc) {
271- case USB_IFC_ID:
272- *alt_ifc = usb_ifc0_alt;
273- return TRUE;
274- }
270+ if (ifc != USB_IFC_ID)
271+ return ALT_INVALID; // If the interface specified does not exist, then the device responds with a Request Error.
275272
276- return FALSE; // If the interface specified does not exist, then the device responds with a Request Error.
273+ return usb_ifc0_alt;
277274 }
278275
279276 BOOL handle_set_interface(uint8_t ifc, uint8_t alt_ifc)
Show on old repository browser