+static const char StrDescProduct[] = {\r
+ 8, // Length\r
+ 0x03, // Type is string\r
+ 'P', 0x00,\r
+ 'M', 0x00,\r
+ '3', 0x00\r
+};\r
+ \r
+static const char* const pStrings[] =\r
+{\r
+ StrDescLanguageCodes,\r
+ StrDescManufacturer,\r
+ StrDescProduct\r
+};\r
+\r
+const char* getStringDescriptor(uint8_t idx)\r
+{\r
+ if(idx >= (sizeof(pStrings) / sizeof(pStrings[0]))) {\r
+ return(NULL);\r
+ } else {\r
+ return(pStrings[idx]);\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