+const char* getStringDescriptor(uint8_t idx)\r
+{\r
+ switch (idx) {\r
+ case STR_LANGUAGE_CODES:\r
+ return StrDescLanguageCodes;\r
+ case STR_MANUFACTURER:\r
+ return StrDescManufacturer;\r
+ case STR_PRODUCT:\r
+ return StrDescProduct;\r
+ default:\r
+ return NULL;\r
+ }\r
+}\r
+\r
+// Bitmap for all status bits in CSR which must be written as 1 to cause no effect\r
+#define REG_NO_EFFECT_1_ALL AT91C_UDP_RX_DATA_BK0 | AT91C_UDP_RX_DATA_BK1 \\r
+ |AT91C_UDP_STALLSENT | AT91C_UDP_RXSETUP \\r
+ |AT91C_UDP_TXCOMP\r
+\r
+// Clear flags in the UDP_CSR register\r
+#define UDP_CLEAR_EP_FLAGS(endpoint, flags) { \\r
+ volatile unsigned int reg; \\r
+ reg = pUdp->UDP_CSR[(endpoint)]; \\r
+ reg |= REG_NO_EFFECT_1_ALL; \\r
+ reg &= ~(flags); \\r
+ pUdp->UDP_CSR[(endpoint)] = reg; \\r
+} \r
+\r
+// Set flags in the UDP_CSR register\r
+#define UDP_SET_EP_FLAGS(endpoint, flags) { \\r
+ volatile unsigned int reg; \\r
+ reg = pUdp->UDP_CSR[(endpoint)]; \\r
+ reg |= REG_NO_EFFECT_1_ALL; \\r
+ reg |= (flags); \\r
+ pUdp->UDP_CSR[(endpoint)] = reg; \\r
+}\r