]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/AtmelFiles/usb/common/cdc/CDCSetControlLineStateRequest.c
SAMA5D3 demo: Add CDC driver code and use CDC to create a simple command console.
[freertos] / FreeRTOS / Demo / CORTEX_A5_SAMA5D3x_Xplained_IAR / AtmelFiles / usb / common / cdc / CDCSetControlLineStateRequest.c
diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/AtmelFiles/usb/common/cdc/CDCSetControlLineStateRequest.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/AtmelFiles/usb/common/cdc/CDCSetControlLineStateRequest.c
new file mode 100644 (file)
index 0000000..a2ff3ce
--- /dev/null
@@ -0,0 +1,87 @@
+/* ----------------------------------------------------------------------------\r
+ *         ATMEL Microcontroller Software Support \r
+ * ----------------------------------------------------------------------------\r
+ * Copyright (c) 2008, Atmel Corporation\r
+ *\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above copyright notice,\r
+ * this list of conditions and the disclaimer below.\r
+ *\r
+ * Atmel's name may not be used to endorse or promote products derived from\r
+ * this software without specific prior written permission.\r
+ *\r
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR\r
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\r
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * ----------------------------------------------------------------------------\r
+ */\r
+\r
+/** \file\r
+ *\r
+ * Implementation of the CDCSetControlLineStateRequest class.\r
+ */\r
+\r
+/** \addtogroup usb_cdc\r
+ *@{\r
+ */\r
+\r
+/*----------------------------------------------------------------------------\r
+ *         Headers\r
+ *----------------------------------------------------------------------------*/\r
+\r
+#include <CDCRequests.h>\r
+\r
+/*----------------------------------------------------------------------------\r
+ *         Exported functions\r
+ *----------------------------------------------------------------------------*/\r
+\r
+/**\r
+ *  Notifies if the given request indicates that the DTE signal is present.\r
+ *  \param request Pointer to a USBGenericRequest instance.\r
+ *  \return 1 if the DTE signal is present, otherwise 0.\r
+ */\r
+uint8_t CDCSetControlLineStateRequest_IsDtePresent(\r
+    const USBGenericRequest *request)\r
+{\r
+    if ((USBGenericRequest_GetValue(request) & 0x0001) != 0) {\r
+\r
+        return 1;\r
+    }\r
+    else {\r
+\r
+        return 0;\r
+    }\r
+}\r
+\r
+/**\r
+ *  Notifies if the given request indicates that the device carrier should\r
+ *  be activated.\r
+ *  \param request Pointer to a USBGenericRequest instance.\r
+ *  \return 1 is the device should activate its carrier, 0 otherwise.\r
+ */\r
+uint8_t CDCSetControlLineStateRequest_ActivateCarrier(\r
+    const USBGenericRequest *request)\r
+{\r
+    if ((USBGenericRequest_GetValue(request) & 0x0002) != 0) {\r
+\r
+        return 1;\r
+    }\r
+    else {\r
+\r
+        return 0;\r
+    }\r
+}\r
+\r
+/**@}*/\r
+\r