00001 /* 00002 FreeRTOS.org V4.1.0 - copyright (C) 2003-2006 Richard Barry. 00003 00004 This file is part of the FreeRTOS.org distribution. 00005 00006 FreeRTOS.org is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 FreeRTOS.org is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with FreeRTOS.org; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 A special exception to the GPL can be applied should you wish to distribute 00021 a combined work that includes FreeRTOS.org, without being obliged to provide 00022 the source code for any proprietary components. See the licensing section 00023 of http://www.FreeRTOS.org for full details of how and when the exception 00024 can be applied. 00025 00026 *************************************************************************** 00027 See http://www.FreeRTOS.org for documentation, latest information, license 00028 and contact details. Please ensure to read the configuration and relevant 00029 port sections of the online documentation. 00030 *************************************************************************** 00031 */ 00032 00033 #ifndef USB_CDC_H 00034 #define USB_CDC_H 00035 00036 #include "usb_internal.h" 00037 00038 /* FreeRTOS */ 00039 #include "FreeRTOS.h" 00040 00041 #define USB_CDC_QUEUE_SIZE 8 00042 00043 /* Structure used to take a snapshot of the USB status from within the ISR. */ 00044 typedef struct X_ISR_STATUS 00045 { 00046 unsigned portLONG ulISR; 00047 unsigned portLONG ulCSR0; 00048 unsigned portCHAR ucFifoData[ 8 ]; 00049 } xISRStatus; 00050 00051 /* Structure used to hold the received requests. */ 00052 typedef struct 00053 { 00054 unsigned portCHAR ucReqType; 00055 unsigned portCHAR ucRequest; 00056 unsigned portSHORT usValue; 00057 unsigned portSHORT usIndex; 00058 unsigned portSHORT usLength; 00059 } xUSB_REQUEST; 00060 00061 typedef enum 00062 { 00063 eNOTHING, 00064 eJUST_RESET, 00065 eJUST_GOT_CONFIG, 00066 eJUST_GOT_ADDRESS, 00067 eSENDING_EVEN_DESCRIPTOR, 00068 eREADY_TO_SEND 00069 } eDRIVER_STATE; 00070 00071 /* Structure used to control the data being sent to the host. */ 00072 typedef struct 00073 { 00074 unsigned portCHAR ucBuffer[ usbMAX_CONTROL_MESSAGE_SIZE ]; 00075 unsigned portLONG ulNextCharIndex; 00076 unsigned portLONG ulTotalDataLength; 00077 } xCONTROL_MESSAGE; 00078 00079 #define EP_FIFO 64 00080 typedef struct BulkBufferStruct 00081 { 00082 unsigned portCHAR Data[EP_FIFO]; 00083 unsigned portCHAR Count; // count of valid bytes (inIdx) 00084 } xBULKBUFFER; 00085 00086 /*-----------------------------------------------------------*/ 00087 void vUSBCDCTask( void *pvParameters ); 00088 00089 /* Send cByte down the USB port. Characters are simply buffered and not 00090 sent unless the port is connected. */ 00091 void vUSBSendByte( portCHAR cByte, int timeout ); 00092 00093 /* MakingThings: Get a byte from the USB 00094 returns -1 if there is no character before the timeout */ 00095 inline int cUSBGetByte( portTickType timeout ); 00096 00097 #endif 00098 00099
The Make Controller Kit is an open source project maintained by MakingThings.
MakingThings code is released under the Apache 2.0 license.
Bug tracker, development wiki and status can be found at http://dev.makingthings.com.
This document was last updated on 18 May 2009.