X-Git-Url: http://git.asbjorn.biz/?p=rapper.git;a=blobdiff_plain;f=new_cmsis%2Fusb%2Fvcom.c;fp=new_cmsis%2Fusb%2Fvcom.c;h=0000000000000000000000000000000000000000;hp=dcc06e432b9ff2f51154fef6e0ac1c2afcee1b67;hb=ab3f716f01b5b40ce743fbaa5780e12e448b609c;hpb=2253dc3498d4ace7f07884ec6d40d654ca677571 diff --git a/new_cmsis/usb/vcom.c b/new_cmsis/usb/vcom.c deleted file mode 100755 index dcc06e4..0000000 --- a/new_cmsis/usb/vcom.c +++ /dev/null @@ -1,104 +0,0 @@ -/*---------------------------------------------------------------------------- - * Name: vcomdemo.c - * Purpose: USB virtual COM port Demo - * Version: V1.20 - *---------------------------------------------------------------------------- - * This software is supplied "AS IS" without any warranties, express, - * implied or statutory, including but not limited to the implied - * warranties of fitness for purpose, satisfactory quality and - * noninfringement. Keil extends you a royalty-free right to reproduce - * and distribute executable files created using this software for use - * on NXP Semiconductors LPC microcontroller devices only. Nothing else - * gives you the right to use this software. - * - * Copyright (c) 2009 Keil - An ARM Company. All rights reserved. - *---------------------------------------------------------------------------*/ - -#include -#include "lpc_types.h" - -#include "usb.h" -#include "cfg.h" -#include "hw.h" -#include "core.h" -#include "cdc.h" -#include "cdcuser.h" -#include "serial.h" -#include "vcom.h" - -/* Example group ----------------------------------------------------------- */ -/** @defgroup USBDEV_USBCDC USBCDC - * @ingroup USBDEV_Examples - * @{ - */ - -/*---------------------------------------------------------------------------- - Initialises the VCOM port. - Call this function before using VCOM_putchar or VCOM_getchar - *---------------------------------------------------------------------------*/ -void VCOM_Init(void) { -#if PORT_NUM - CDC_Init (1); -#else - CDC_Init (0); -#endif -} - - -/*---------------------------------------------------------------------------- - Reads character from serial port buffer and writes to USB buffer - *---------------------------------------------------------------------------*/ -void VCOM_Serial2Usb(void) { - static char serBuf [USB_CDC_BUFSIZE]; - int numBytesRead, numAvailByte; - - ser_AvailChar (&numAvailByte); - if (numAvailByte > 0) { - if (CDC_DepInEmpty) { - numBytesRead = ser_Read (&serBuf[0], &numAvailByte); - - CDC_DepInEmpty = 0; - USB_WriteEP (CDC_DEP_IN, (unsigned char *)&serBuf[0], numBytesRead); - } - } - -} - -/*---------------------------------------------------------------------------- - Reads character from USB buffer and writes to serial port buffer - *---------------------------------------------------------------------------*/ -void VCOM_Usb2Serial(void) { - static char serBuf [32]; - int numBytesToRead, numBytesRead, numAvailByte; - - CDC_OutBufAvailChar (&numAvailByte); - if (numAvailByte > 0) { - numBytesToRead = numAvailByte > 32 ? 32 : numAvailByte; - numBytesRead = CDC_RdOutBuf (&serBuf[0], &numBytesToRead); -#if PORT_NUM - ser_Write (1, &serBuf[0], &numBytesRead); -#else - ser_Write (0, &serBuf[0], &numBytesRead); -#endif - } - -} - - -/*---------------------------------------------------------------------------- - checks the serial state and initiates notification - *---------------------------------------------------------------------------*/ -void VCOM_CheckSerialState (void) { - unsigned short temp; - static unsigned short serialState; - - temp = CDC_GetSerialState(); - if (serialState != temp) { - serialState = temp; - CDC_NotificationIn(); // send SERIAL_STATE notification - } -} - -/* - * @} - */