MSP-BSL v3.0 master
authorMax Groening <m-groening@ti.com>
Wed, 25 Mar 2015 10:00:13 +0000 (11:00 +0100)
committerMax Groening <m-groening@ti.com>
Wed, 25 Mar 2015 10:00:13 +0000 (11:00 +0100)
 * SPI  support added. Supports now UART, I2C and SPI for MSP430/MSP432 BSLs.
 * USB stack updated.

208 files changed:
BSL_Comm.c [deleted file]
BSL_Comm.h [deleted file]
F5xx_F6xx_Core_Lib/HAL_FLASH.c [deleted file]
F5xx_F6xx_Core_Lib/HAL_FLASH.h [deleted file]
F5xx_F6xx_Core_Lib/HAL_MACROS.h [deleted file]
F5xx_F6xx_Core_Lib/HAL_PMAP.c [deleted file]
F5xx_F6xx_Core_Lib/HAL_PMAP.h [deleted file]
F5xx_F6xx_Core_Lib/HAL_PMM.c [deleted file]
F5xx_F6xx_Core_Lib/HAL_PMM.h [deleted file]
F5xx_F6xx_Core_Lib/HAL_TLV.c [deleted file]
F5xx_F6xx_Core_Lib/HAL_TLV.h [deleted file]
F5xx_F6xx_Core_Lib/HAL_UCS.c [deleted file]
F5xx_F6xx_Core_Lib/HAL_UCS.h [deleted file]
I2C.c [deleted file]
I2C.h [deleted file]
LICENSE.txt [deleted file]
README.md
USB_API/USB_CDC_API/UsbCdc.c [deleted file]
USB_API/USB_CDC_API/UsbCdc.h [deleted file]
USB_API/USB_Common/UsbIsr.h [deleted file]
USB_API/USB_Common/defMSP430USB.h [deleted file]
USB_API/USB_Common/device.h [deleted file]
USB_API/USB_Common/dma.c [deleted file]
USB_API/USB_Common/types.h [deleted file]
USB_API/USB_Common/usb.c [deleted file]
USB_API/USB_Common/usb.h [deleted file]
USB_API/USB_HID_API/UsbHid.c [deleted file]
USB_API/USB_HID_API/UsbHid.h [deleted file]
USB_API/USB_HID_API/UsbHidReportHandler.c [deleted file]
USB_API/USB_HID_API/UsbHidReportHandler.h [deleted file]
USB_API/USB_HID_API/UsbHidReq.c [deleted file]
USB_API/USB_HID_API/UsbHidReq.h [deleted file]
USB_API/USB_MSC_API/UsbMsc.h [deleted file]
USB_API/USB_MSC_API/UsbMscReq.c [deleted file]
USB_API/USB_MSC_API/UsbMscReq.h [deleted file]
USB_API/USB_MSC_API/UsbMscScsi.c [deleted file]
USB_API/USB_MSC_API/UsbMscScsi.h [deleted file]
USB_API/USB_MSC_API/UsbMscStateMachine.c [deleted file]
USB_API/USB_MSC_API/UsbMscStateMachine.h [deleted file]
USB_config/MSP430_CDC.inf [deleted file]
USB_config/descriptors.dat [deleted file]
USB_config/descriptors.h [deleted file]
baudrateselect.c [deleted file]
baudrateselect.h [deleted file]
doc/MSP-BSL User's Guide.pdf [new file with mode: 0644]
firmware/MSP-BSL_3.0.d43 [new file with mode: 0644]
firmware/MSP-BSL_3.0.txt [new file with mode: 0644]
initMCU.c [deleted file]
initMCU.h [deleted file]
main.c [deleted file]
main.h [deleted file]
manifest.htm [moved from MSP430-BSL_2.1_Manifest.htm with 96% similarity]
source/MSP_BSL.ewd [moved from CDC_UART_Bridge_F5509.ewd with 93% similarity]
source/MSP_BSL.ewp [moved from CDC_UART_Bridge_F5509.ewp with 78% similarity]
source/MSP_BSL.eww [moved from CDC_UART_Bridge.eww with 68% similarity]
source/USB_API/USB_CDC_API/UsbCdc.c [new file with mode: 0644]
source/USB_API/USB_CDC_API/UsbCdc.h [new file with mode: 0644]
source/USB_API/USB_Common/UsbIsr.h [new file with mode: 0644]
source/USB_API/USB_Common/defMSP430USB.h [new file with mode: 0644]
source/USB_API/USB_Common/device.h [new file with mode: 0644]
source/USB_API/USB_Common/types.h [new file with mode: 0644]
source/USB_API/USB_Common/usb.c [new file with mode: 0644]
source/USB_API/USB_Common/usb.h [new file with mode: 0644]
source/USB_API/USB_Common/usbdma.c [new file with mode: 0644]
source/USB_API/USB_HID_API/UsbHid.c [new file with mode: 0644]
source/USB_API/USB_HID_API/UsbHid.h [new file with mode: 0644]
source/USB_API/USB_HID_API/UsbHidReq.c [new file with mode: 0644]
source/USB_API/USB_HID_API/UsbHidReq.h [new file with mode: 0644]
source/USB_API/USB_MSC_API/UsbMsc.h [new file with mode: 0644]
source/USB_API/USB_MSC_API/UsbMscReq.c [new file with mode: 0644]
source/USB_API/USB_MSC_API/UsbMscReq.h [new file with mode: 0644]
source/USB_API/USB_MSC_API/UsbMscScsi.c [new file with mode: 0644]
source/USB_API/USB_MSC_API/UsbMscScsi.h [new file with mode: 0644]
source/USB_API/USB_MSC_API/UsbMscStateMachine.c [new file with mode: 0644]
source/USB_API/USB_MSC_API/UsbMscStateMachine.h [new file with mode: 0644]
source/USB_API/USB_PHDC_API/UsbPHDC.c [new file with mode: 0644]
source/USB_API/USB_PHDC_API/UsbPHDC.h [new file with mode: 0644]
source/USB_app/usbConstructs.c [new file with mode: 0644]
source/USB_app/usbConstructs.h [new file with mode: 0644]
source/USB_app/usbEventHandling.c [new file with mode: 0644]
source/USB_config/MSP430_CDC.inf [new file with mode: 0644]
source/USB_config/MSP430_CDC.zip [new file with mode: 0644]
source/USB_config/UsbIsr.c [moved from USB_config/UsbIsr.c with 53% similarity]
source/USB_config/descriptors.c [moved from USB_config/descriptors.c with 62% similarity]
source/USB_config/descriptors.dat [new file with mode: 0644]
source/USB_config/descriptors.h [new file with mode: 0644]
source/USB_config/readme.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/adc10_a.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/adc10_a.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/adc12_a.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/adc12_a.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/aes.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/aes.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/bak_batt.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/bak_batt.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/comp_b.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/comp_b.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/crc.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/crc.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/dac12_a.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/dac12_a.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/CCS/msp430f5xx_6xxgeneric.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/IAR/msp430f5xx_6xxgeneric.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/dma.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/dma.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/flash.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/flash.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/mpy32.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/mpy32.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/pmm.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/pmm.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/ram.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/ram.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/sfr.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/sfr.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/sys.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/sys.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/ucs.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/deprecated/ucs.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/dma.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/dma.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/driverlib.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_a_spi.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_a_spi.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_a_uart.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_a_uart.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_b_i2c.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_b_i2c.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_b_spi.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_b_spi.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_i2c.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_i2c.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_spi.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_spi.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_uart.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/eusci_uart.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/flash.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/flash.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/gpio.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/gpio.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/inc/hw_memmap.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/inc/hw_regaccess.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/inc/hw_types.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/inc/version.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ldopwr.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ldopwr.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/mpy32.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/mpy32.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/pmap.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/pmap.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/pmm.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/pmm.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ram.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ram.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ref.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ref.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/rtc_a.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/rtc_a.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/rtc_b.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/rtc_b.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/rtc_c.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/rtc_c.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/sd24_b.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/sd24_b.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/sfr.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/sfr.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/sys.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/sys.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/tec.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/tec.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/timer_a.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/timer_a.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/timer_b.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/timer_b.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/timer_d.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/timer_d.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/tlv.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/tlv.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ucs.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/ucs.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_a_spi.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_a_spi.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_a_uart.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_a_uart.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_b_i2c.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_b_i2c.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_b_spi.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_b_spi.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_i2c.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_i2c.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_spi.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_spi.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_uart.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/usci_uart.h [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/wdt_a.c [new file with mode: 0644]
source/driverlib/MSP430F5xx_6xx/wdt_a.h [new file with mode: 0644]
source/hal.c [new file with mode: 0644]
source/hal.h [new file with mode: 0644]
source/main.c [new file with mode: 0644]
source/peripherals.c [new file with mode: 0644]
source/peripherals.h [new file with mode: 0644]
timer.c [deleted file]
timer.h [deleted file]
uart.c [deleted file]
uart.h [deleted file]
usb/usbConstructs.c [deleted file]
usb/usbConstructs.h [deleted file]
usb/usbEventHandling.c [deleted file]

diff --git a/BSL_Comm.c b/BSL_Comm.c
deleted file mode 100644 (file)
index f68d2c5..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * BSL_Comm.c
- *
- * The I2C state machine.
- *
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include "BSL_Comm.h"
-#include "descriptors.h"
-#include "USB_API\USB_Common\types.h"          // Basic Type declarations
-#include "USB_API\USB_CDC_API\UsbCdc.h"        // USB-specific functions
-
-// Description:
-//   Analyzes incoming usbdata
-//   return: I2C write trigger
-unsigned int length = 0;
-unsigned char state = SWAIT;
-
-unsigned char CoreCommand[256];
-unsigned char i = 0;
-
-extern volatile BYTE bDataReceiveCompleted_event[];  // data receive completed event
-
-unsigned char UART_FSM(BYTE* dataBuffer)
-{
-       unsigned int retvalue = 0;
-       
-       switch(state)
-       {
-               case(SWAIT):    // wait for UART_HEADER to start the data sequence
-                USBCDC_receiveData(dataBuffer, UART_HEADER_LENGTH, CDC0_INTFNUM);
-                if(dataBuffer[0] == UART_HEADER) 
-                {
-                       length = 0;
-                       state = SSTART;
-                }
-         else if (dataBuffer[0] == UART_CMD_HEADER)
-         {
-             state = SCMD;
-         }
-             
-                retvalue = 0;
-                break;
-               case(SSTART):   // read in length bytes
-                bDataReceiveCompleted_event[0] = FALSE;
-                USBCDC_receiveData(dataBuffer + UART_HEADER_LENGTH, UART_LENGTH_LENGTH, CDC0_INTFNUM);
-                while (bDataReceiveCompleted_event[0] == FALSE){};             // wait until data received
-                length = ((unsigned char) dataBuffer[1 + UART_HEADER_LENGTH] << 8) | dataBuffer[0 + UART_HEADER_LENGTH];
-                state = SDATA;
-                retvalue = 0;
-                break;
-               case(SDATA):    // read in all data (length bytes) plus CRC
-                bDataReceiveCompleted_event[0] = FALSE;
-                USBCDC_receiveData(dataBuffer + UART_HEADER_LENGTH + UART_LENGTH_LENGTH, length + UART_CRC_LENGTH, CDC0_INTFNUM);
-                while (bDataReceiveCompleted_event[0] == FALSE){};
-                
-                USBCDC_rejectData(CDC0_INTFNUM);               // discard leftover bytes
-
-                state = SWAIT;
-                retvalue = UART_HEADER_LENGTH + UART_LENGTH_LENGTH + length + UART_CRC_LENGTH;
-                break;         
-
-        case SCMD:
-            USBCDC_receiveData(dataBuffer, UART_CMD_LENGTH, CDC0_INTFNUM);
-            retvalue = dataBuffer[0];
-            state = SWAIT;
-        break;
-         
-               default:
-                state = SWAIT;
-                retvalue = 0;
-                break;                         
-       }
-       return retvalue;
-}
diff --git a/BSL_Comm.h b/BSL_Comm.h
deleted file mode 100644 (file)
index eac56b5..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * BSL_Comm.h
- *
- * The I2C state machine.
- *
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef BSL_COMM_H_
-#define BSL_COMM_H_
-#include "USB_API/USB_Common/types.h"          // Basic Type declarations
-
-#define UART_HEADER         0x80
-#define UART_CMD_HEADER     0xA0
-#define UART_HEADER_LENGTH     1               // length in byte
-#define UART_LENGTH_LENGTH     2               // length in byte
-#define UART_CRC_LENGTH                2               // length in byte
-#define UART_CMD_LENGTH            1           // length in byte
-
-// define STATES
-#define SWAIT  0x00
-#define SSTART 0x01
-#define SLENGTH        0x02
-#define SDATA  0x03
-#define SSEND  0x04
-#define SCMD    0x05
-
-
-
-unsigned char UART_FSM(BYTE *dataBuffer);
-
-#endif /*BSL_COMM_H_*/
diff --git a/F5xx_F6xx_Core_Lib/HAL_FLASH.c b/F5xx_F6xx_Core_Lib/HAL_FLASH.c
deleted file mode 100644 (file)
index bcf3d7f..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- *
- * HAL_FLASH.c
- * Flash Library for flash memory controller of MSP430F5xx/6xx family
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 01/18/2011
- *  
- ******************************************************************************/
-#include "msp430.h"
-#include "HAL_FLASH.h"
-
-void Flash_SegmentErase(uint16_t *Flash_ptr)
-{
-  FCTL3 = FWKEY;                            // Clear Lock bit
-  FCTL1 = FWKEY + ERASE;                    // Set Erase bit
-  *Flash_ptr = 0;                           // Dummy write to erase Flash seg
-  while (FCTL3 & BUSY);                     // test busy
-  FCTL1 = FWKEY;                            // Clear WRT bit
-  FCTL3 = FWKEY + LOCK;                     // Set LOCK bit
-}
-
-uint8_t Flash_EraseCheck(uint16_t *Flash_ptr, uint16_t len)
-{
-  uint16_t i;
-  
-  for (i = 0; i < len; i++) {               // was erasing successfull?
-    if (*(Flash_ptr + i) != 0xFF) {
-      return FLASH_STATUS_ERROR;
-    }
-  }
-
-  return FLASH_STATUS_OK;
-}
-
-void FlashWrite_8(uint8_t *Data_ptr, uint8_t *Flash_ptr, uint16_t count)
-{
-  FCTL3 = FWKEY;                            // Clear Lock bit
-  FCTL1 = FWKEY+WRT;                        // Enable byte/word write mode
-  
-  while (count > 0) {
-    while (FCTL3 & BUSY);                   // test busy
-    *Flash_ptr++ = *Data_ptr++;             // Write to Flash
-    count--;
-  }
-
-  FCTL1 = FWKEY;                            // Clear write bit
-  FCTL3 = FWKEY + LOCK;                     // Set LOCK bit
-}
-
-void FlashWrite_16(uint16_t *Data_ptr, uint16_t *Flash_ptr, uint16_t count)
-{
-  FCTL3 = FWKEY;                            // Clear Lock bit
-  FCTL1 = FWKEY+WRT;                        // Enable byte/word write mode
-  
-  while (count > 0) {
-    while (FCTL3 & BUSY);                   // test busy
-    *Flash_ptr++ = *Data_ptr++;             // Write to Flash
-    count--;
-  }
-
-  FCTL1 = FWKEY;                            // Clear Erase bit
-  FCTL3 = FWKEY + LOCK;                     // Set LOCK bit
-}
-
-void FlashWrite_32(uint32_t *Data_ptr, uint32_t *Flash_ptr, uint16_t count)
-{
-  FCTL3 = FWKEY;                            // Clear Lock bit
-  FCTL1 = FWKEY + BLKWRT;                   // Enable long-word write
-  
-  while (count > 0) {
-    while (FCTL3 & BUSY);                   // test busy
-    *Flash_ptr++ = *Data_ptr++;             // Write to Flash
-    count--;
-  }
-
-  FCTL1 = FWKEY;                            // Clear Erase bit
-  FCTL3 = FWKEY + LOCK;                     // Set LOCK bit
-}
-
-void FlashMemoryFill_32(uint32_t value, uint32_t *Flash_ptr, uint16_t count)
-{
-  FCTL3 = FWKEY;                            // Clear Lock bit
-  FCTL1 = FWKEY + BLKWRT;                   // Enable long-word write
-
-  while (count > 0) {
-    while (FCTL3 & BUSY);                   // test busy
-    *Flash_ptr++ = value;                   // Write to Flash
-    count--;
-  }
-
-  FCTL1 = FWKEY;                            // Clear Erase bit
-  FCTL3 = FWKEY + LOCK;                      // Set LOCK bit
-}
diff --git a/F5xx_F6xx_Core_Lib/HAL_FLASH.h b/F5xx_F6xx_Core_Lib/HAL_FLASH.h
deleted file mode 100644 (file)
index 32a1d50..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- *
- * HAL_FLASH.h
- * Flash Library for flash memory controller of MSP430F5xx/6xx family
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 01/18/2011
- *  
- ******************************************************************************/
-
-#ifndef HAL_FLASH_H
-#define HAL_FLASH_H
-
-#include <stdint.h>
-
-//******************************************************************************
-// Defines
-//******************************************************************************
-
-#define FLASH_STATUS_OK     0
-#define FLASH_STATUS_ERROR  1
-
-/*******************************************************************************
- * \brief   Erase a single segment of the flash memory
- *
- * \param *Flash_ptr    Pointer into the flash segment to erase
- ******************************************************************************/
-extern void Flash_SegmentErase(uint16_t *Flash_ptr);
-
-/*******************************************************************************
- * \brief   Erase Check of the flash memory
- *
- * \param *Flash_ptr    Pointer into the flash segment to erase
- * \param len           give the len in word
- ******************************************************************************/
-extern uint8_t Flash_EraseCheck(uint16_t *Flash_ptr, uint16_t len);
-
-/*******************************************************************************
- * \brief   Write data into the flash memory (Byte format)
- *
- * \param *Data_ptr     Pointer to the Data to write
- * \param *Flash_ptr    Pointer into the flash to write data to
- * \param count         number of data to write
- ******************************************************************************/
-extern void FlashWrite_8(uint8_t *Data_ptr, uint8_t *Flash_ptr, uint16_t count);
-
-/*******************************************************************************
- * \brief   Write data into the flash memory (Word format)
- *
- * \param *Data_ptr     Pointer to the Data to write
- * \param *Flash_ptr    Pointer into the flash to write data to
- * \param count         number of data to write
- ******************************************************************************/
-extern void FlashWrite_16(uint16_t *Data_ptr, uint16_t *Flash_ptr, uint16_t count);
-
-/*******************************************************************************
- * \brief   Write data into the flash memory (Long format)
- *
- * \param *Data_ptr     Pointer to the Data to write
- * \param *Flash_ptr    Pointer into the flash to write data to
- * \param count         number of data to write
- ******************************************************************************/
-extern void FlashWrite_32(uint32_t *Data_ptr, uint32_t *Flash_ptr, uint16_t count);
-
-/*******************************************************************************
- * \brief   Fill data into the flash memory (Long format)
- *
- * \param value         Pointer to the Data to write
- * \param *Flash_ptr    pointer into the flash to write data to
- * \param count         number of data to write (= byte * 4)
- ******************************************************************************/
-extern void FlashMemoryFill_32(uint32_t value, uint32_t *Flash_ptr, uint16_t count);
-
-#endif /* HAL_FLASH_H */
diff --git a/F5xx_F6xx_Core_Lib/HAL_MACROS.h b/F5xx_F6xx_Core_Lib/HAL_MACROS.h
deleted file mode 100644 (file)
index 398074f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ****************************************************************************
- *
- * HAL_MACROS.h
- * Flash Library for flash memory controller of MSP430F5xx/6xx family
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 12/15/2010
- *  
-******************************************************************************/
-
-#ifndef HAL_MACROS_H
-#define HAL_MACROS_H
-
-/*
- *  This macro is for use by other macros to form a fully valid C statement.
- */
-#define st(x)      do { x } while (__LINE__ == -1)
-
-#endif /* HAL_MACROS_H */
diff --git a/F5xx_F6xx_Core_Lib/HAL_PMAP.c b/F5xx_F6xx_Core_Lib/HAL_PMAP.c
deleted file mode 100644 (file)
index a8b0e0d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- *
- * HAL_PMAP.c
- * Port Mapper Library for PMAP controller of MSP430F5xx/6xx family
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 12/15/2010
- *  
- ******************************************************************************/
-
-#include "msp430.h"
-#include "HAL_PMAP.h" 
-
-// Check and define PMAP function only if the device has port mapping capability
-// Note: This macro is defined in the device-specific header file if this
-// feature is available on a given MSP430.
-#ifdef __MSP430_HAS_PORT_MAPPING__ 
-
-void configure_ports(const uint8_t *port_mapping, uint8_t *PxMAPy, 
-                    uint8_t num_of_ports, uint8_t port_map_reconfig)
-{
-  uint16_t i;
-  
-  // Store current interrupt state, then disable all interrupts
-  uint16_t globalInterruptState = __get_SR_register() & GIE;
-  __disable_interrupt();
-  
-  // Get write-access to port mapping registers:
-  PMAPPWD = PMAPPW;
-  
-  if (port_map_reconfig) {
-    // Allow reconfiguration during runtime:
-    PMAPCTL = PMAPRECFG;
-  }
-  
-  // Configure Port Mapping: 
-  for (i = 0; i < num_of_ports * 8; i++) {
-    PxMAPy[i] = port_mapping[i];
-  }
-  
-  // Disable write-access to port mapping registers:
-  PMAPPWD = 0;
-  
-  // Restore previous interrupt state
-  __bis_SR_register(globalInterruptState);
-}
-
-#endif  /* __MSP430_HAS_PORT_MAPPING__ */
diff --git a/F5xx_F6xx_Core_Lib/HAL_PMAP.h b/F5xx_F6xx_Core_Lib/HAL_PMAP.h
deleted file mode 100644 (file)
index 3dcf35e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- *
- * HAL_PMAP.h
- * Port Mapper Library for PMAP controller of MSP430F5xx/6xx family
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 12/15/2010
- *  
- ******************************************************************************/
-
-#ifndef HAL_PMAP_H
-#define HAL_PMAP_H
-
-#include <stdint.h>
-
-/*******************************************************************************
- * \brief   Configures the MSP430 Port Mapper
- *
- * \param *port_mapping     Pointer to init Data
- * \param PxMAPy            Pointer start of first Port Mapper to initialize
- * \param num_of_ports      Number of Ports to initialize
- * \param port_map_reconfig Flag to enable/disable reconfiguration
- *
- ******************************************************************************/
-extern void configure_ports(const uint8_t *port_mapping, uint8_t *PxMAPy, 
-                            uint8_t num_of_ports, uint8_t port_map_reconfig);
-
-#endif /* HAL_PMAP_H */
diff --git a/F5xx_F6xx_Core_Lib/HAL_PMM.c b/F5xx_F6xx_Core_Lib/HAL_PMM.c
deleted file mode 100644 (file)
index aa113db..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*******************************************************************************
- *
- * HAL_PMM.c
- * Power Management Module Library for MSP430F5xx/6xx family
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 12/15/2010
- *          Modified SetVcoreUp() and SetVcoreDown() functions
- *  
- ******************************************************************************/
-
-#include "msp430.h"
-#include "HAL_PMM.h"
-
-#define _HAL_PMM_DISABLE_SVML_
-#define _HAL_PMM_DISABLE_SVSL_
-#define _HAL_PMM_DISABLE_FULL_PERFORMANCE_
-
-#ifdef _HAL_PMM_DISABLE_SVML_
-#define _HAL_PMM_SVMLE  SVMLE
-#else
-#define _HAL_PMM_SVMLE  0
-#endif
-
-#ifdef _HAL_PMM_DISABLE_SVSL_
-#define _HAL_PMM_SVSLE  SVSLE
-#else
-#define _HAL_PMM_SVSLE  0
-#endif
-
-#ifdef _HAL_PMM_DISABLE_FULL_PERFORMANCE_
-#define _HAL_PMM_SVSFP  SVSLFP
-#define _HAL_PMM_SVMFP  SVMLFP
-#else
-#define _HAL_PMM_SVSFP  0
-#define _HAL_PMM_SVMFP  0
-#endif
-
-/*******************************************************************************
- * \brief   Increase Vcore by one level
- *
- * \param level     Level to which Vcore needs to be increased
- * \return status   Success/failure
- ******************************************************************************/
-static uint16_t SetVCoreUp(uint8_t level)
-{
-  uint16_t PMMRIE_backup, SVSMHCTL_backup, SVSMLCTL_backup;
-   
-  // The code flow for increasing the Vcore has been altered to work around
-  // the erratum FLASH37. 
-  // Please refer to the Errata sheet to know if a specific device is affected
-  // DO NOT ALTER THIS FUNCTION
-
-  // Open PMM registers for write access   
-  PMMCTL0_H = 0xA5;
-  
-  // Disable dedicated Interrupts
-  // Backup all registers
-  PMMRIE_backup = PMMRIE;
-  PMMRIE &= ~(SVMHVLRPE | SVSHPE | SVMLVLRPE | SVSLPE | SVMHVLRIE |
-        SVMHIE | SVSMHDLYIE | SVMLVLRIE | SVMLIE | SVSMLDLYIE );
-  SVSMHCTL_backup = SVSMHCTL;
-  SVSMLCTL_backup = SVSMLCTL;
-
-  // Clear flags
-  PMMIFG = 0;
-
-  // Set SVM highside to new level and check if a VCore increase is possible
-  SVSMHCTL = SVMHE | SVSHE | (SVSMHRRL0 * level);    
-
-  // Wait until SVM highside is settled
-  while ((PMMIFG & SVSMHDLYIFG) == 0); 
-
-  // Clear flag
-  PMMIFG &= ~SVSMHDLYIFG;
-  
-  // Check if a VCore increase is possible
-  if ((PMMIFG & SVMHIFG) == SVMHIFG) {      // -> Vcc is too low for a Vcore increase
-       // recover the previous settings
-       PMMIFG &= ~SVSMHDLYIFG;
-       SVSMHCTL = SVSMHCTL_backup;
-
-       // Wait until SVM highside is settled
-       while ((PMMIFG & SVSMHDLYIFG) == 0);
-
-       // Clear all Flags
-       PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG);
-
-       PMMRIE = PMMRIE_backup;                 // Restore PMM interrupt enable register
-       PMMCTL0_H = 0x00;                       // Lock PMM registers for write access
-       return PMM_STATUS_ERROR;                // return: voltage not set
-  }
-  
-  // Set also SVS highside to new level            
-  // Vcc is high enough for a Vcore increase
-  SVSMHCTL |= (SVSHRVL0 * level);
-
-  // Wait until SVM highside is settled
-  while ((PMMIFG & SVSMHDLYIFG) == 0);    
-
-  // Clear flag
-  PMMIFG &= ~SVSMHDLYIFG;
-  
-  // Set VCore to new level
-  PMMCTL0_L = PMMCOREV0 * level;
-
-  // Set SVM, SVS low side to new level
-  SVSMLCTL = SVMLE | (SVSMLRRL0 * level) | SVSLE | (SVSLRVL0 * level);
-
-  // Wait until SVM, SVS low side is settled
-  while ((PMMIFG & SVSMLDLYIFG) == 0);
-
-  // Clear flag
-  PMMIFG &= ~SVSMLDLYIFG;
-  // SVS, SVM core and high side are now set to protect for the new core level
-  
-  // Restore Low side settings
-  // Clear all other bits _except_ level settings
-  SVSMLCTL &= (SVSLRVL0+SVSLRVL1+SVSMLRRL0+SVSMLRRL1+SVSMLRRL2);
-
-  // Clear level settings in the backup register,keep all other bits
-  SVSMLCTL_backup &= ~(SVSLRVL0+SVSLRVL1+SVSMLRRL0+SVSMLRRL1+SVSMLRRL2);
-  
-  // Restore low-side SVS monitor settings
-  SVSMLCTL |= SVSMLCTL_backup;
-  
-  // Restore High side settings
-  // Clear all other bits except level settings
-  SVSMHCTL &= (SVSHRVL0+SVSHRVL1+SVSMHRRL0+SVSMHRRL1+SVSMHRRL2);
-
-  // Clear level settings in the backup register,keep all other bits
-  SVSMHCTL_backup &= ~(SVSHRVL0+SVSHRVL1+SVSMHRRL0+SVSMHRRL1+SVSMHRRL2);
-
-  // Restore backup 
-  SVSMHCTL |= SVSMHCTL_backup;
-  
-  // Wait until high side, low side settled
-  while (((PMMIFG & SVSMLDLYIFG) == 0) && ((PMMIFG & SVSMHDLYIFG) == 0));
-
-  // Clear all Flags
-  PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG);
-
-  PMMRIE = PMMRIE_backup;                   // Restore PMM interrupt enable register
-  PMMCTL0_H = 0x00;                         // Lock PMM registers for write access
-
-  return PMM_STATUS_OK;  
-}
-
-/*******************************************************************************
- * \brief  Decrease Vcore by one level
- *
- * \param  level    Level to which Vcore needs to be decreased
- * \return status   Success/failure
- ******************************************************************************/
-static uint16_t SetVCoreDown(uint8_t level)
-{
-  uint16_t PMMRIE_backup, SVSMHCTL_backup, SVSMLCTL_backup;
-  
-  // The code flow for decreasing the Vcore has been altered to work around
-  // the erratum FLASH37. 
-  // Please refer to the Errata sheet to know if a specific device is affected
-  // DO NOT ALTER THIS FUNCTION
-  
-  // Open PMM registers for write access
-  PMMCTL0_H = 0xA5;
-
-  // Disable dedicated Interrupts 
-  // Backup all registers
-  PMMRIE_backup = PMMRIE;
-  PMMRIE &= ~(SVMHVLRPE | SVSHPE | SVMLVLRPE | SVSLPE | SVMHVLRIE |
-        SVMHIE | SVSMHDLYIE | SVMLVLRIE | SVMLIE | SVSMLDLYIE );
-  SVSMHCTL_backup = SVSMHCTL;
-  SVSMLCTL_backup = SVSMLCTL;
-
-  // Clear flags
-  PMMIFG &= ~(SVMHIFG | SVSMHDLYIFG | SVMLIFG | SVSMLDLYIFG);
-  
-  // Set SVM, SVS high & low side to new settings in normal mode
-  SVSMHCTL = SVMHE | (SVSMHRRL0 * level) | SVSHE | (SVSHRVL0 * level);
-  SVSMLCTL = SVMLE | (SVSMLRRL0 * level) | SVSLE | (SVSLRVL0 * level);
-  
-  // Wait until SVM high side and SVM low side is settled
-  while ((PMMIFG & SVSMHDLYIFG) == 0 || (PMMIFG & SVSMLDLYIFG) == 0);
-  
-  // Clear flags
-  PMMIFG &= ~(SVSMHDLYIFG + SVSMLDLYIFG);
-  // SVS, SVM core and high side are now set to protect for the new core level
-  
-  // Set VCore to new level
-  PMMCTL0_L = PMMCOREV0 * level;
-  
-  // Restore Low side settings
-  // Clear all other bits _except_ level settings
-  SVSMLCTL &= (SVSLRVL0+SVSLRVL1+SVSMLRRL0+SVSMLRRL1+SVSMLRRL2);
-  
-  // Clear level settings in the backup register,keep all other bits
-  SVSMLCTL_backup &= ~(SVSLRVL0+SVSLRVL1+SVSMLRRL0+SVSMLRRL1+SVSMLRRL2);
-  
-  // Restore low-side SVS monitor settings
-  SVSMLCTL |= SVSMLCTL_backup;
-  
-  // Restore High side settings
-  // Clear all other bits except level settings
-  SVSMHCTL &= (SVSHRVL0+SVSHRVL1+SVSMHRRL0+SVSMHRRL1+SVSMHRRL2);
-  
-  // Clear level settings in the backup register, keep all other bits
-  SVSMHCTL_backup &= ~(SVSHRVL0+SVSHRVL1+SVSMHRRL0+SVSMHRRL1+SVSMHRRL2);
-  
-  // Restore backup 
-  SVSMHCTL |= SVSMHCTL_backup;
-  
-  // Wait until high side, low side settled
-  while (((PMMIFG & SVSMLDLYIFG) == 0) && ((PMMIFG & SVSMHDLYIFG) == 0));      
-  
-  // Clear all Flags
-  PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG);
-  
-  PMMRIE = PMMRIE_backup;                   // Restore PMM interrupt enable register
-  PMMCTL0_H = 0x00;                         // Lock PMM registers for write access
-  return PMM_STATUS_OK;                                // Return: OK
-}
-
-uint16_t SetVCore(uint8_t level)
-{
-  uint16_t actlevel;
-  uint16_t status = 0;
-  
-  level &= PMMCOREV_3;                       // Set Mask for Max. level
-  actlevel = (PMMCTL0 & PMMCOREV_3);         // Get actual VCore
-                                             // step by step increase or decrease
-  while (((level != actlevel) && (status == 0)) || (level < actlevel)) {
-    if (level > actlevel) {
-      status = SetVCoreUp(++actlevel);
-    }
-    else {
-      status = SetVCoreDown(--actlevel);
-    }
-  }
-  
-  return status;
-}
diff --git a/F5xx_F6xx_Core_Lib/HAL_PMM.h b/F5xx_F6xx_Core_Lib/HAL_PMM.h
deleted file mode 100644 (file)
index aecb77d..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- *
- * HAL_PMM.h
- * Power Management Module Library for MSP430F5xx/6xx family
- *
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 12/15/2010
- *
- ******************************************************************************/
-
-#ifndef HAL_PMM_H
-#define HAL_PMM_H
-
-#include <stdint.h>
-#include "HAL_MACROS.h"
-
-/*******************************************************************************
- * Macros
- ******************************************************************************/
-#define ENABLE_SVSL()        st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVSL()       st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVSLE; PMMCTL0_H = 0x00;)
-#define ENABLE_SVML()        st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVMLE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVML()       st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVMLE; PMMCTL0_H = 0x00;)
-#define ENABLE_SVSH()        st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVSH()       st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVSHE; PMMCTL0_H = 0x00;)
-#define ENABLE_SVMH()        st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVMHE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVMH()       st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVMHE; PMMCTL0_H = 0x00;)
-#define ENABLE_SVSL_SVML()   st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLE + SVMLE); PMMCTL0_H = 0x00;)
-#define DISABLE_SVSL_SVML()  st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~(SVSLE + SVMLE); PMMCTL0_H = 0x00;)
-#define ENABLE_SVSH_SVMH()   st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHE + SVMHE); PMMCTL0_H = 0x00;)
-#define DISABLE_SVSH_SVMH()  st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~(SVSHE + SVMHE); PMMCTL0_H = 0x00;)
-
-#define ENABLE_SVSL_RESET()       st(PMMCTL0_H = 0xA5; PMMRIE |= SVSLPE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVSL_RESET()      st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSLPE; PMMCTL0_H = 0x00;)
-#define ENABLE_SVML_INTERRUPT()   st(PMMCTL0_H = 0xA5; PMMRIE |= SVMLIE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVML_INTERRUPT()  st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMLIE; PMMCTL0_H = 0x00;)
-#define ENABLE_SVSH_RESET()       st(PMMCTL0_H = 0xA5; PMMRIE |= SVSHPE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVSH_RESET()      st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSHPE; PMMCTL0_H = 0x00;)
-#define ENABLE_SVMH_INTERRUPT()   st(PMMCTL0_H = 0xA5; PMMRIE |= SVMHIE; PMMCTL0_H = 0x00;)
-#define DISABLE_SVMH_INTERRUPT()  st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMHIE; PMMCTL0_H = 0x00;)
-#define CLEAR_PMM_IFGS()          st(PMMCTL0_H = 0xA5; PMMIFG = 0; PMMCTL0_H = 0x00;)
-
-// These settings use SVSH/LACE = 0
-#define SVSL_ENABLED_IN_LPM_FAST_WAKE()  st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLFP+SVSLMD); SVSMLCTL &= ~SVSMLACE; PMMCTL0_H = 0x00;)
-#define SVSL_ENABLED_IN_LPM_SLOW_WAKE()  st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLMD; SVSMLCTL &= ~(SVSLFP+SVSMLACE); PMMCTL0_H = 0x00;)
-
-#define SVSL_DISABLED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLFP; SVSMLCTL &= ~(SVSLMD+SVSMLACE); PMMCTL0_H = 0x00;)
-#define SVSL_DISABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~(SVSLFP+SVSMLACE+SVSLMD); PMMCTL0_H = 0x00;)
-
-#define SVSH_ENABLED_IN_LPM_NORM_PERF()  st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHMD; SVSMHCTL &= ~(SVSMHACE+SVSHFP); PMMCTL0_H = 0x00;)
-#define SVSH_ENABLED_IN_LPM_FULL_PERF()  st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHMD+SVSHFP); SVSMHCTL &= ~SVSMHACE; PMMCTL0_H = 0x00;)
-
-#define SVSH_DISABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~(SVSMHACE+SVSHFP+SVSHMD);PMMCTL0_H = 0x00;)
-#define SVSH_DISABLED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHFP; SVSMHCTL &= ~(SVSMHACE+SVSHMD); PMMCTL0_H = 0x00;)
-
-// These setting use SVSH/LACE = 1
-#define SVSL_OPTIMIZED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLFP+SVSLMD+SVSMLACE); PMMCTL0_H = 0x00;)
-#define SVSH_OPTIMIZED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHMD+SVSHFP+SVSMHACE); PMMCTL0_H = 0x00;)
-
-/*******************************************************************************
- * Defines
- ******************************************************************************/
-#define PMM_STATUS_OK     0
-#define PMM_STATUS_ERROR  1
-
-/*******************************************************************************
- * \brief   Set Vcore to expected level
- *
- * \param level     Level to which Vcore needs to be increased/decreased
- * \return status   Success/failure
- ******************************************************************************/
-extern uint16_t SetVCore(uint8_t level);
-
-#endif /* HAL_PMM_H */
diff --git a/F5xx_F6xx_Core_Lib/HAL_TLV.c b/F5xx_F6xx_Core_Lib/HAL_TLV.c
deleted file mode 100644 (file)
index 431b440..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- *
- * HAL_TLV.c
- * Provides Functions to Read the TLV Data Section of the MSP430 Devices
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Updated: Version 2.0 01/17/2011
- *  
- ******************************************************************************/
-
-#include "msp430.h"
-#include "HAL_TLV.h" 
-
-void Get_TLV_Info(uint8_t tag, uint8_t instance, uint8_t *length, uint16_t **data_address)
-{
-  char *TLV_address = (char *)TLV_START;         // TLV Structure Start Address
-
-  while((TLV_address < (char *)TLV_END)
-        && ((*TLV_address != tag) || instance)   // check for tag and instance
-        && (*TLV_address != TLV_TAGEND))         // do range check first
-  {
-    if (*TLV_address == tag) instance--;         // repeat till requested instance is reached
-    TLV_address += *(TLV_address + 1) + 2;       // add (Current TAG address + LENGTH) + 2
-  }
-  
-  if (*TLV_address == tag)                       // Check if Tag match happened..
-  {
-    *length = *(TLV_address + 1);                  // Return length = Address + 1
-    *data_address = (uint16_t *)(TLV_address + 2); // Return address of first data/value info = Address + 2
-  }
-  else                                           // If there was no tag match and the end of TLV structure was reached..
-  {
-    *length = 0;                                 // Return 0 for TAG not found
-    *data_address = 0;                           // Return 0 for TAG not found
-  }
-}
-
-uint16_t Get_Device_Type(void)
-{
-  uint16_t *pDeviceType = (uint16_t *)DEVICE_ID_0;
-  return pDeviceType[0];                         // Return Value from TLV Table
-}
-
-uint16_t Get_TLV_Memory(uint8_t instance)
-{
-    uint8_t *pPDTAG;
-    uint8_t bPDTAG_bytes;
-    uint16_t count;
-
-    instance *= 2;                               // set tag for word access comparison
-    
-    // TLV access Function Call
-    Get_TLV_Info(TLV_PDTAG, 0, &bPDTAG_bytes, (uint16_t **)&pPDTAG); // Get Peripheral data pointer
-    
-    for (count = 0;count <= instance; count += 2)
-    {
-      if (pPDTAG[count] == 0) return 0;          // Return 0 if end reached
-      if (count == instance) return (pPDTAG[count] | pPDTAG[count+1]<<8);
-    }
-    
-    return 0;                                    // Return 0: not found
-}
-
-uint16_t Get_TLV_Peripheral(uint8_t tag, uint8_t instance)
-{
-    uint8_t *pPDTAG;
-    uint8_t bPDTAG_bytes;
-    uint16_t count = 0;
-    uint16_t pcount = 0;
-
-    Get_TLV_Info(TLV_PDTAG, 0, &bPDTAG_bytes, (uint16_t **)&pPDTAG); // Get Peripheral data pointer
-
-    // read memory configuration from TLV to get offset for Peripherals
-    while (Get_TLV_Memory(count)) {
-      count++;
-    }
-
-    pcount = pPDTAG[count * 2 + 1];              // get number of Peripheral entries
-    count++;                                     // inc count to first Periperal
-    pPDTAG += count*2;                           // adjust point to first address of Peripheral
-    count = 0;                                   // set counter back to 0
-    pcount *= 2;                                 // align pcount for work comparision
-
-    // TLV access Function Call
-    for (count = 0; count <= pcount; count += 2) {
-      if (pPDTAG[count+1] == tag) {              // test if required Peripheral is found
-        if (instance > 0) {                       // test if required instance is found
-          instance--;
-        }
-        else {
-          return (pPDTAG[count] | pPDTAG[count + 1] << 8); // Return found data
-        }
-      }
-    }
-    
-    return 0;                                    // Return 0: not found
-}
-
-uint8_t Get_TLV_Interrupt(uint8_t tag)
-{
-    uint8_t *pPDTAG;
-    uint8_t bPDTAG_bytes;
-    uint16_t count = 0;
-    uint16_t pcount = 0;
-
-    Get_TLV_Info(TLV_PDTAG, 0, &bPDTAG_bytes, (uint16_t **)&pPDTAG); // Get Peripheral data pointer
-    
-    // read memory configuration from TLV to get offset for Peripherals
-    while (Get_TLV_Memory(count))
-    {
-      count++;
-    }
-
-    pcount = pPDTAG[count * 2 + 1];
-    count++;                                     // inc count to first Periperal
-    pPDTAG += (pcount + count) * 2;              // adjust point to first address of Peripheral
-    count = 0;                                   // set counter back to 0
-
-    // TLV access Function Call
-    for (count = 0; count <= tag; count += 2)
-    {
-      if (pPDTAG[count] == 0) return 0;          // Return 0: not found/end of table
-      if (count == tag) return (pPDTAG[count]);  // Return found data
-    }
-    
-    return 0;                                    // Return 0: not found
-}
diff --git a/F5xx_F6xx_Core_Lib/HAL_TLV.h b/F5xx_F6xx_Core_Lib/HAL_TLV.h
deleted file mode 100644 (file)
index 042129a..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- *
- * HAL_TLV.c
- * Provides Functions to Read the TLV Data Section of the MSP430 Devices
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Updated: Version 2.0 01/17/2011
- *  
- ******************************************************************************/
-
-#ifndef HAL_TLV_H
-#define HAL_TLV_H
-
-#include <stdint.h>
-
-/*******************************************************************************
- * Device Descriptors - Fixed Memory Locations
- ******************************************************************************/
-#define DEVICE_ID_0            (0x1A04)
-#define DEVICE_ID_1            (0x1A05)
-
-/*******************************************************************************
- * Data Types
- ******************************************************************************/
-struct s_TLV_Die_Record {
-  uint8_t die_record[10];
-};
-
-struct s_TLV_ADC_Cal_Data {
-  uint16_t adc_gain_factor;
-  uint16_t adc_offset;
-  uint16_t adc_ref15_30_temp;
-  uint16_t adc_ref15_85_temp;
-  uint16_t adc_ref20_30_temp;
-  uint16_t adc_ref20_85_temp;
-  uint16_t adc_ref25_30_temp;
-  uint16_t adc_ref25_85_temp;
-};
-
-struct s_TLV_Timer_D_Cal_Data {
-  uint16_t TDH0CTL1_64;
-  uint16_t TDH0CTL1_128;
-  uint16_t TDH0CTL1_200;
-  uint16_t TDH0CTL1_256;
-};
-
-struct s_TLV_REF_Cal_Data {
-  uint16_t ref_ref15;
-  uint16_t ref_ref20;
-  uint16_t adc_ref25;
-};
-
-/*******************************************************************************
- * Tag Defines
- ******************************************************************************/
-#define TLV_LDTAG             (0x01)      /*  Legacy descriptor (1xx, 2xx,
-                                              4xx families) */
-#define TLV_PDTAG             (0x02)      /*  Peripheral discovery descriptor */
-#define TLV_Reserved3         (0x03)      /*  Future usage */
-#define TLV_Reserved4         (0x04)      /*  Future usage */
-#define TLV_BLANK             (0x05)      /*  Blank descriptor */
-#define TLV_Reserved6         (0x06)      /*  Future usage */
-#define TLV_Reserved7         (0x07)      /*  Serial Number */
-#define TLV_DIERECORD         (0x08)      /*  Die Record  */
-#define TLV_ADCCAL            (0x11)      /*  ADC12 calibration */
-#define TLV_ADC12CAL          (0x11)      /*  ADC12 calibration */
-#define TLV_ADC10CAL          (0x13)      /*  ADC10 calibration */
-#define TLV_REFCAL            (0x12)      /*  REF calibration */
-#define TLV_TIMER_D_CAL       (0x15)      /*  Timer_Dx calibration */
-#define TLV_TAGEXT            (0xFE)      /*  Tag extender */
-#define TLV_TAGEND            (0xFF)      /*  Tag End of Table */
-
-/*******************************************************************************
- * Peripheral Defines
- ******************************************************************************/
-#define TLV_PID_NO_MODULE     (0x00)      /*  No Module */
-#define TLV_PID_PORTMAPPING   (0x10)      /*  Port Mapping */
-#define TLV_PID_MSP430CPUXV2  (0x23)      /*  MSP430CPUXV2 */
-#define TLV_PID_JTAG          (0x09)      /*  JTAG */
-#define TLV_PID_SBW           (0x0F)      /*  SBW */
-#define TLV_PID_EEM_XS        (0x02)      /*  EEM X-Small */
-#define TLV_PID_EEM_S         (0x03)      /*  EEM Small */
-#define TLV_PID_EEM_M         (0x04)      /*  EEM Medium */
-#define TLV_PID_EEM_L         (0x05)      /*  EEM Large */
-#define TLV_PID_PMM           (0x30)      /*  PMM */
-#define TLV_PID_PMM_FR        (0x32)      /*  PMM FRAM */
-#define TLV_PID_FCTL          (0x39)      /*  Flash */
-#define TLV_PID_CRC16         (0x3C)      /*  CRC16 */
-#define TLV_PID_CRC16_RB      (0x3D)      /*  CRC16 Reverse */
-#define TLV_PID_WDT_A         (0x40)      /*  WDT_A */
-#define TLV_PID_SFR           (0x41)      /*  SFR */
-#define TLV_PID_SYS           (0x42)      /*  SYS */
-#define TLV_PID_RAMCTL        (0x44)      /*  RAMCTL */
-#define TLV_PID_DMA_1         (0x46)      /*  DMA 1 */
-#define TLV_PID_DMA_3         (0x47)      /*  DMA 3 */
-#define TLV_PID_UCS           (0x48)      /*  UCS */
-#define TLV_PID_DMA_6         (0x4A)      /*  DMA 6 */
-#define TLV_PID_DMA_2         (0x4B)      /*  DMA 2 */
-#define TLV_PID_PORT1_2       (0x51)      /*  Port 1 + 2 / A */
-#define TLV_PID_PORT3_4       (0x52)      /*  Port 3 + 4 / B */
-#define TLV_PID_PORT5_6       (0x53)      /*  Port 5 + 6 / C */
-#define TLV_PID_PORT7_8       (0x54)      /*  Port 7 + 8 / D */
-#define TLV_PID_PORT9_10      (0x55)      /*  Port 9 + 10 / E */
-#define TLV_PID_PORT11_12     (0x56)      /*  Port 11 + 12 / F */
-#define TLV_PID_PORTU         (0x5E)      /*  Port U */
-#define TLV_PID_PORTJ         (0x5F)      /*  Port J */
-#define TLV_PID_TA2           (0x60)      /*  Timer A2 */
-#define TLV_PID_TA3           (0x61)      /*  Timer A1 */
-#define TLV_PID_TA5           (0x62)      /*  Timer A5 */
-#define TLV_PID_TA7           (0x63)      /*  Timer A7 */
-#define TLV_PID_TB3           (0x65)      /*  Timer B3 */
-#define TLV_PID_TB5           (0x66)      /*  Timer B5 */
-#define TLV_PID_TB7           (0x67)      /*  Timer B7 */
-#define TLV_PID_RTC           (0x68)      /*  RTC */
-#define TLV_PID_BT_RTC        (0x69)      /*  BT + RTC */
-#define TLV_PID_BBS           (0x6A)      /*  Battery Backup Switch */
-#define TLV_PID_RTC_B         (0x6B)      /*  RTC_B */
-#define TLV_PID_TD2           (0x6C)      /*  Timer D2 */
-#define TLV_PID_TD3           (0x6D)      /*  Timer D1 */
-#define TLV_PID_TD5           (0x6E)      /*  Timer D5 */
-#define TLV_PID_TD7           (0x6F)      /*  Timer D7 */
-#define TLV_PID_TEC           (0x70)      /*  Imer Event Control */
-#define TLV_PID_RTC_C         (0x71)      /*  RTC_C */
-#define TLV_PID_AES           (0x80)      /*  AES */
-#define TLV_PID_MPY16         (0x84)      /*  MPY16 */
-#define TLV_PID_MPY32         (0x85)      /*  MPY32 */
-#define TLV_PID_MPU           (0x86)      /*  MPU */
-#define TLV_PID_USCI_AB       (0x90)      /*  USCI_AB */
-#define TLV_PID_USCI_A        (0x91)      /*  USCI_A */
-#define TLV_PID_USCI_B        (0x92)      /*  USCI_B */
-#define TLV_PID_EUSCI_A       (0x94)      /*  eUSCI_A */
-#define TLV_PID_EUSCI_B       (0x95)      /*  eUSCI_B */
-#define TLV_PID_REF           (0xA0)      /*  Shared Reference */
-#define TLV_PID_COMP_B        (0xA8)      /*  COMP_B */
-#define TLV_PID_COMP_D        (0xA9)      /*  COMP_D */
-#define TLV_PID_USB           (0x98)      /*  USB */
-#define TLV_PID_LCD_B         (0xB1)      /*  LCD_B */
-#define TLV_PID_LCD_C         (0xB2)      /*  LCD_C */
-#define TLV_PID_DAC12_A       (0xC0)      /*  DAC12_A */
-#define TLV_PID_SD16_B_1      (0xC8)      /*  SD16_B 1 Channel */
-#define TLV_PID_SD16_B_2      (0xC9)      /*  SD16_B 2 Channel */
-#define TLV_PID_SD16_B_3      (0xCA)      /*  SD16_B 3 Channel */
-#define TLV_PID_SD16_B_4      (0xCB)      /*  SD16_B 4 Channel */
-#define TLV_PID_SD16_B_5      (0xCC)      /*  SD16_B 5 Channel */
-#define TLV_PID_SD16_B_6      (0xCD)      /*  SD16_B 6 Channel */
-#define TLV_PID_SD16_B_7      (0xCE)      /*  SD16_B 7 Channel */
-#define TLV_PID_SD16_B_8      (0xCF)      /*  SD16_B 8 Channel */
-#define TLV_PID_ADC12_A       (0xD1)      /*  ADC12_A */
-#define TLV_PID_ADC10_A       (0xD3)      /*  ADC10_A */
-#define TLV_PID_ADC10_B       (0xD4)      /*  ADC10_B */
-#define TLV_PID_SD16_A        (0xD8)      /*  SD16_A */
-#define TLV_PID_TI_BSL        (0xFC)      /*  BSL */
-
-/*******************************************************************************
- * \brief   Get Information out of the TLV Table
- *
- * \param tag               Tag of the TLV entry
- * \param instance          Instance of the Tag of the TLV entry
- * \param *length           return: Length of the information if found
- * \param **data_address    return: start pointer of Data
- ******************************************************************************/
-void Get_TLV_Info(uint8_t tag, uint8_t instance, uint8_t *length,
-    uint16_t **data_address);
-
-/*******************************************************************************
- * \brief   Get Device Type out of the TLV Table
- *
- * \return  Device dependent value
- ******************************************************************************/
-uint16_t Get_Device_Type(void);
-
-/*******************************************************************************
- * \brief   Get Memory Info out of the TLV Table
- *
- * \param instance  Index of the Instance [0..]
- * \return          Memory Data found
- ******************************************************************************/
-uint16_t Get_TLV_Memory(uint8_t instance);
-
-/*******************************************************************************
- * \brief Get Peripheral Info out of the TLV Table
- *
- * \param tag       Tag of the TLV entry
- * \param instance  Index of the Instance [0..]
- * \return          Peripheral Data found
- ******************************************************************************/
-uint16_t Get_TLV_Peripheral(uint8_t tag, uint8_t instance);
-
-/*******************************************************************************
- * \brief   Get Interrupt Info out of the TLV Table
- *
- * \param tag   Tag of the TLV entry
- * \return      Interrupt Data found
- ******************************************************************************/
-uint8_t Get_TLV_Interrupt(uint8_t tag);
-
-#endif /* HAL_TLV_H */
diff --git a/F5xx_F6xx_Core_Lib/HAL_UCS.c b/F5xx_F6xx_Core_Lib/HAL_UCS.c
deleted file mode 100644 (file)
index 9294fdd..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- *
- * HAL_UCS.c
- * Provides Functions to Initialize the UCS/FLL and clock sources
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 12/15/2010
- *          Added Functions: XT2_Stop() and XT1_Stop()
- *          Modified all functions to preserve drive settings
- *  
- ******************************************************************************/
-
-#include "msp430.h"
-#include "HAL_UCS.h"
-
-/*******************************************************************************
- * Check and define required Defines
- ******************************************************************************/
-#ifndef XT1LFOFFG               // Defines if not available in header file
-#define XT1LFOFFG   0
-#endif
-
-#ifndef XT1HFOFFG               // Defines if not available in header file
-#define XT1HFOFFG   0
-#endif
-
-#ifndef XT2OFFG                 // Defines if not available in header file
-#define XT2OFFG     0
-#endif
-
-#ifndef XTS                     // Defines if not available in header file
-#define XTS         0
-#endif
-
-#ifndef XT2DRIVE_3              // Defines if not available in header file
-#define XT2DRIVE_3  0
-#endif
-
-void LFXT_Start(uint16_t xtdrive)
-{
-  // If the drive setting is not already set to maximum
-  // Set it to max for LFXT startup
-  if ((UCSCTL6 & XT1DRIVE_3)!= XT1DRIVE_3) { 
-    UCSCTL6_L |= XT1DRIVE1_L + XT1DRIVE0_L; // Highest drive setting for XT1startup
-  }
-
-  while (SFRIFG1 & OFIFG) {   // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags
-    SFRIFG1 &= ~OFIFG;        // Clear OFIFG fault flag
-  }
-  
-  UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) | (xtdrive); // set requested Drive mode
-}
-
-uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout)
-{
- // If the drive setting is not already set to maximum
-  // Set it to max for LFXT startup
-  if ((UCSCTL6 & XT1DRIVE_3)!= XT1DRIVE_3) { 
-   UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1startup
-  }
-
-  while ((SFRIFG1 & OFIFG) && timeout--){   // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags
-    SFRIFG1 &= ~OFIFG;        // Clear OFIFG fault flag
-  }
-  
-  UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode
-  
-  if (timeout)
-    return (UCS_STATUS_OK);
-  else
-    return (UCS_STATUS_ERROR);
-}
-
-void XT1_Start(uint16_t xtdrive)
-{
-  // Check if drive value is the expected one
-  if ((UCSCTL6 & XT1DRIVE_3) != xtdrive) {
-    UCSCTL6 &= ~XT1DRIVE_3;                 // Clear XT1drive field
-    UCSCTL6 |= xtdrive;                     // Set requested value
-  }
-  
-  UCSCTL6 &= ~XT1OFF;                       // Enable XT1
-  UCSCTL6 |= XTS;                           // Enable HF mode
-
-  while (SFRIFG1 & OFIFG) {   // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
-    SFRIFG1 &= ~OFIFG;        // Clear OFIFG fault flag
-  }
-}
-
-uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout)
-{
-  // Check if drive value is the expected one
-  if ((UCSCTL6 & XT1DRIVE_3) != xtdrive) {
-    UCSCTL6 &= ~XT1DRIVE_3;                 // Clear XT1drive field
-    UCSCTL6 |= xtdrive;                     // Set requested value
-  }
-  
-  UCSCTL6 &= ~XT1OFF;                       // Enable XT1
-  UCSCTL6 |= XTS;                           // Enable HF mode
-
-  while ((SFRIFG1 & OFIFG) && timeout--) {  // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
-    SFRIFG1 &= ~OFIFG;                      // Clear OFIFG fault flag
-  }
-  
-  if (timeout) {
-    return UCS_STATUS_OK;
-  }
-  else {
-    return UCS_STATUS_ERROR;
-  }
-}
-
-void XT1_Bypass(void)
-{
-  UCSCTL6 |= XT1BYPASS;
-
-  while (SFRIFG1 & OFIFG) {   // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
-    SFRIFG1 &= ~OFIFG;        // Clear OFIFG fault flag
-  }
-}
-
-void XT1_Stop(void)
-{
-  UCSCTL6 |= XT1OFF;                         // Switch off XT1 oscillator
-}
-
-void XT2_Start(uint16_t xtdrive)
-{
-  // Check if drive value is the expected one
-  if ((UCSCTL6 & XT2DRIVE_3) != xtdrive) {
-    UCSCTL6 &= ~XT2DRIVE_3;                 // Clear XT2drive field
-    UCSCTL6 |= xtdrive;                     // Set requested value
-  }
-  
-  UCSCTL6 &= ~XT2OFF; 
-  
-  while (SFRIFG1 & OFIFG) {                 // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
-    SFRIFG1 &= ~OFIFG;                      // Clear OFIFG fault flag
-  }
-}
-
-uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout)
-{
-  // Check if drive value is the expected one
-  if ((UCSCTL6 & XT2DRIVE_3) != xtdrive)  {
-    UCSCTL6 &= ~XT2DRIVE_3;                 // Clear XT2drive field
-    UCSCTL6 |= xtdrive;                     // Set requested value
-  }
-  
-  UCSCTL6 &= ~XT2OFF; 
-
-  while ((SFRIFG1 & OFIFG) && timeout--) {  // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
-    SFRIFG1 &= ~OFIFG;        // Clear OFIFG fault flag
-  }
-  
-  if (timeout) {
-    return UCS_STATUS_OK;
-  }
-  else {
-    return UCS_STATUS_ERROR;
-  }
-}
-
-void XT2_Bypass(void)
-{
-#ifdef XT2BYPASS              // On devices without XT2 this function will be empty
-  UCSCTL6 |= XT2BYPASS;
-
-  while (SFRIFG1 & OFIFG) {   // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags
-    SFRIFG1 &= ~OFIFG;        // Clear OFIFG fault flag
-  }
-#endif
-}
-
-void XT2_Stop(void)
-{
-  UCSCTL6 |= XT2OFF;                         // Switch off XT2 oscillator
-}
-
-void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio)
-{
-  volatile uint16_t x = ratio * 32;       
-
-  Init_FLL(fsystem, ratio);
-  
-  while (x--) {
-   __delay_cycles(30); 
-  }
-}
-
-void Init_FLL(uint16_t fsystem, uint16_t ratio)
-{
-  uint16_t d, dco_div_bits;
-  uint16_t mode = 0;
-
-  // Save actual state of FLL loop control, then disable it. This is needed to
-  // prevent the FLL from acting as we are making fundamental modifications to
-  // the clock setup.
-  uint16_t srRegisterState = __get_SR_register() & SCG0;
-  __bic_SR_register(SCG0);  
-  
-  d = ratio;
-  dco_div_bits = FLLD__2;        // Have at least a divider of 2
-  
-  if (fsystem > 16000) {
-    d >>= 1 ;
-    mode = 1;
-  }
-  else {
-    fsystem <<= 1;               // fsystem = fsystem * 2
-  }
-
-  while (d > 512) {
-    dco_div_bits = dco_div_bits + FLLD0;  // Set next higher div level
-    d >>= 1;
-  }
-
-  UCSCTL0 = 0x0000;              // Set DCO to lowest Tap
-
-  UCSCTL2 &= ~(0x03FF);          // Reset FN bits
-  UCSCTL2 = dco_div_bits | (d - 1);
-
-  if (fsystem <= 630)            //           fsystem < 0.63MHz
-       UCSCTL1 = DCORSEL_0;
-  else if (fsystem <  1250)      // 0.63MHz < fsystem < 1.25MHz
-       UCSCTL1 = DCORSEL_1;
-  else if (fsystem <  2500)      // 1.25MHz < fsystem <  2.5MHz
-       UCSCTL1 = DCORSEL_2;
-  else if (fsystem <  5000)      // 2.5MHz  < fsystem <    5MHz
-       UCSCTL1 = DCORSEL_3;
-  else if (fsystem <  10000)     // 5MHz    < fsystem <   10MHz
-       UCSCTL1 = DCORSEL_4;
-  else if (fsystem <  20000)     // 10MHz   < fsystem <   20MHz
-       UCSCTL1 = DCORSEL_5;
-  else if (fsystem <  40000)     // 20MHz   < fsystem <   40MHz
-       UCSCTL1 = DCORSEL_6;
-  else
-       UCSCTL1 = DCORSEL_7;
-
-  while (SFRIFG1 & OFIFG) {                               // Check OFIFG fault flag
-    UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG);     // Clear OSC flaut Flags
-    SFRIFG1 &= ~OFIFG;                                    // Clear OFIFG fault flag
-  }
-
-  if (mode == 1) {                                               // fsystem > 16000
-    SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK);       // Select DCOCLK
-  }
-  else {
-    SELECT_MCLK_SMCLK(SELM__DCOCLKDIV + SELS__DCOCLKDIV); // Select DCODIVCLK
-  }
-  
-  __bis_SR_register(srRegisterState);                    // Restore previous SCG0
-}
diff --git a/F5xx_F6xx_Core_Lib/HAL_UCS.h b/F5xx_F6xx_Core_Lib/HAL_UCS.h
deleted file mode 100644 (file)
index e72f051..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- *
- * HAL_UCS.h
- * Provides Functions to Initialize the UCS/FLL and clock sources
- * 
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Created: Version 1.0 11/24/2009
- * Updated: Version 2.0 12/15/2010
- *          Added Functions: XT2_Stop() and XT1_Stop()
- *  
- ******************************************************************************/
-
-#ifndef HAL_UCS_H
-#define HAL_UCS_H
-
-#include <stdint.h>
-#include "hal_macros.h"
-
-/*******************************************************************************
- * Macros
- ******************************************************************************/
-
-/* Select source for FLLREF  e.g. SELECT_FLLREF(SELREF__XT1CLK) */
-#define SELECT_FLLREF(source) st(UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (source);) 
-/* Select source for ACLK    e.g. SELECT_ACLK(SELA__XT1CLK) */
-#define SELECT_ACLK(source)   st(UCSCTL4 = (UCSCTL4 & ~(SELA_7))   | (source);) 
-/* Select source for MCLK    e.g. SELECT_MCLK(SELM__XT2CLK) */
-#define SELECT_MCLK(source)   st(UCSCTL4 = (UCSCTL4 & ~(SELM_7))   | (source);) 
-/* Select source for SMCLK   e.g. SELECT_SMCLK(SELS__XT2CLK) */
-#define SELECT_SMCLK(source)  st(UCSCTL4 = (UCSCTL4 & ~(SELS_7))   | (source);) 
-/* Select source for MCLK and SMCLK e.g. SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK) */
-#define SELECT_MCLK_SMCLK(sources) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7 + SELS_7)) | (sources);)
-
-/* set ACLK/x */
-#define ACLK_DIV(x)         st(UCSCTL5 = (UCSCTL5 & ~(DIVA_7)) | (DIVA__##x);)     
-/* set MCLK/x */
-#define MCLK_DIV(x)         st(UCSCTL5 = (UCSCTL5 & ~(DIVM_7)) | (DIVM__##x);)     
-/* set SMCLK/x */
-#define SMCLK_DIV(x)        st(UCSCTL5 = (UCSCTL5 & ~(DIVS_7)) | (DIVS__##x);)     
-/* Select divider for FLLREF  e.g. SELECT_FLLREFDIV(2) */
-#define SELECT_FLLREFDIV(x) st(UCSCTL3 = (UCSCTL3 & ~(FLLREFDIV_7))|(FLLREFDIV__##x);) 
-
-/*******************************************************************************
- * Defines
- ******************************************************************************/
-#define UCS_STATUS_OK     0
-#define UCS_STATUS_ERROR  1
-
-/*******************************************************************************
- * \brief   Startup routine for 32kHz Crystal on LFXT1
- *
- * \param xtdrive   Bits defining the LFXT drive mode after startup
- ******************************************************************************/
-extern void LFXT_Start(uint16_t xtdrive);
-
-/*******************************************************************************
- * \brief   Startup routine for 32kHz Crystal on LFXT1 with timeout counter
- *
- * \param xtdrive   Bits defining the LFXT drive mode after startup
- * \param timeout   Value for the timeout counter
- ******************************************************************************/
-extern uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout);
-
-/*******************************************************************************
- * \brief   Startup routine for XT1
- *
- * \param xtdrive   Bits defining the XT drive mode
- ******************************************************************************/
-extern void XT1_Start(uint16_t xtdrive);
-
-/*******************************************************************************
- * \brief   Startup routine for XT1 with timeout counter
- *
- * \param xtdrive   Bits defining the XT drive mode
- * \param timeout   Value for the timeout counter
- ******************************************************************************/
-extern uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout);
-
-/*******************************************************************************
- * \brief   Use XT1 in Bypasss mode
- ******************************************************************************/
-extern void XT1_Bypass(void);
-
-/*******************************************************************************
- * \brief   Stop XT1 oscillator
- ******************************************************************************/
-extern void XT1_Stop(void);
-
-/*******************************************************************************
- * \brief   Startup routine for XT2
- *
- * \param xtdrive   Bits defining the XT drive mode
- ******************************************************************************/
-extern void XT2_Start(uint16_t xtdrive);
-
-/*******************************************************************************
- * \brief   Startup routine for XT2 with timeout counter
- *
- * \param xtdrive   Bits defining the XT drive mode
- * \param timeout   Value for the timeout counter
- ******************************************************************************/
-extern uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout);
-
-/*******************************************************************************
- * \brief   Use XT2 in Bypasss mode for MCLK
- ******************************************************************************/
-extern void XT2_Bypass(void);
-
-/*******************************************************************************
- * \brief   Stop XT2 oscillator
- ******************************************************************************/
-extern void XT2_Stop(void);
-
-/*******************************************************************************
- * \brief   Initializes FLL of the UCS and wait till settled before allowing
- *          code execution to resume. The use of this function is preferred
- *          over the use of Init_FLL().
- *
- * \param fsystem  Required system frequency (MCLK) in kHz
- * \param ratio    Ratio between fsystem and FLLREFCLK
- ******************************************************************************/
-extern void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio);
-
-/*******************************************************************************
- * \brief   Initializes FLL of the UCS
- *
- * \param fsystem  Required system frequency (MCLK) in kHz
- * \param ratio    Ratio between fsystem and FLLREFCLK
- ******************************************************************************/
-extern void Init_FLL(uint16_t fsystem, uint16_t ratio);
-
-#endif /* HAL_UCS_H */
diff --git a/I2C.c b/I2C.c
deleted file mode 100644 (file)
index 4f4faab..0000000
--- a/I2C.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * I2C.c
- *
- * The I2C communication functions and BSL invoke sequence.
- *
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <stdint.h>
-#include "I2C.h"
-#include "uart.h"
-#include "msp430.h"
-#include "main.h"
-
-unsigned char *PTxData;                     // Pointer to TX data
-int TXByteCtr;
-unsigned char *PRxData;                     // Pointer to RX data
-int RXByteCtr;
-unsigned char RxBuffer[256];
-
-unsigned char ACK = 0;
-unsigned int rxlength = 0;
-
-#define UART_HEADER 0x80
-#define UART_HEADER_LENGTH     1               // length in byte
-#define UART_LENGTH_LENGTH     2               // length in byte
-#define UART_CRC_LENGTH                2               // length in byte
-
-#define TIMEOUT_RECEPTION  1000000
-
-enum
-{
-    I2C_IDLE, 
-    I2C_RECEIVING, 
-    I2C_RECEIVE_COMPLETE,
-    I2C_TRANSMITTING,
-    I2C_TRANSMIT_COMPLETE,
-    I2C_ERROR
-} I2C_Status_e;
-
-void InvokeBSLSequence(void)
-{
-    PJDIR |= (RESET_PIN | TEST_PIN);
-    Delay(INVOKE_DELAY);
-    // invoke BSL, classic
-    //Start: all high
-    PJOUT = RESET_PIN+TEST_PIN+TCK_PIN;
-    Delay(INVOKE_DELAY);
-    Delay(INVOKE_DELAY);
-    //Delay(INVOKE_DELAY);
-
-    //Step 1
-    //RESET LOW
-    //TEST LOW
-    //TCK HIGHT
-    //PJOUT = TCK_PIN;
-    //Delay(INVOKE_DELAY);
-
-    //Step 2
-    //RESET LOW
-    //TEST HIGH
-    //TCK LOW
-    PJOUT = TEST_PIN;
-    Delay(INVOKE_DELAY);
-    Delay(INVOKE_DELAY);
-
-    //Step 3
-    //RESET LOW
-    //TEST LOW
-    //TCK HIGH
-    //PJOUT = 0;
-    //Delay(INVOKE_DELAY);
-    //Delay(20);
-
-    //Step 4
-    //RESET LOW
-    //TEST HIGH
-    //TCK LOW              
-    //PJOUT = TEST_PIN;
-    //Delay(INVOKE_DELAY);
-
-    //Step 5
-    //RESET HIGH
-    //TEST HIGH
-    //TCK LOW              
-    PJOUT = TEST_PIN + RESET_PIN;
-    Delay(INVOKE_DELAY);
-    Delay(INVOKE_DELAY);
-    Delay(INVOKE_DELAY);
-    Delay(INVOKE_DELAY);
-
-    //Step 6
-    //RESET HIGH
-    //TEST LOW
-    //TCK HIGH              
-    PJOUT =  RESET_PIN;
-    Delay(INVOKE_DELAY);
-    Delay(INVOKE_DELAY);
-    Delay(INVOKE_DELAY);
-}
-
-
-//!  Initialization of the USCI Module for I2C
-int8_t InitI2C(unsigned char eeprom_i2c_address, uint32_t bitrate)
-{
-    int8_t ret =1;
-
-    //Simple port mapping 
-    __disable_interrupt();                // Disable Interrupts before altering Port Mapping registers
-    PMAPKEYID = PMAPKEY;
-    P4MAP4 = PM_UCB0SCL;
-    P4MAP5 = PM_UCB0SDA;
-    PMAPKEYID = 0;
-    __enable_interrupt();
-
-    UCB0CTL1 = UCSWRST;                         // Enable SW reset
-
-    UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC;       // I2C Master, synchronous mode
-    UCB0CTL1 = UCSSEL_2 + UCSWRST;              // Use SMCLK, keep SW reset
-
-
-    switch(bitrate)
-    {
-        case 100001:
-            P1OUT ^= (BIT0|BIT1);
-            InvokeBSLSequence();
-            P1OUT |= (BIT0);
-            UCB0BR0 = SCL_CLOCK_DIV(100000);                    // set prescaler
-            break;
-        case 100000:
-            P1OUT |= (BIT0);
-            UCB0BR0 = SCL_CLOCK_DIV(100000);                    // set prescaler
-            break;
-        case 400001:
-            P1OUT ^= (BIT0|BIT1);
-            InvokeBSLSequence();
-            P1OUT |= (BIT1);
-            UCB0BR0 = SCL_CLOCK_DIV(400000);                    // set prescaler
-            break;
-        case 400000:
-            P1OUT |= (BIT1);
-            UCB0BR0 = SCL_CLOCK_DIV(400000);                    // set prescaler
-            break;
-        default:
-            ret = 1;
-    }
-
-    UCB0BR1 = 0;
-    UCB0I2CSA = eeprom_i2c_address;             // Set slave address
-
-    I2C_PORT_SEL |= SDA_PIN + SCL_PIN;          // select module function for the used I2C pins
-
-    UCB0CTL1 &= ~UCSWRST;                       // Clear SW reset, resume operation
-
-    PRxData = RxBuffer;                         // Incase no receive buffer is assigned
-
-    if(UCB0STAT & UCBBUSY)                      // test if bus to be free
-    {                                           // otherwise a manual Clock on is generated
-        I2C_PORT_SEL &= ~SCL_PIN;               // Select Port function for SCL
-        I2C_PORT_OUT &= ~SCL_PIN;               //
-        I2C_PORT_DIR |= SCL_PIN;                // drive SCL low
-        I2C_PORT_SEL |= SDA_PIN + SCL_PIN;      // select module function for the used I2C pins
-    };
-
-    I2C_Status_e = I2C_IDLE;
-
-    return ret;
-}
-
-int16_t i2cSendMessage(unsigned char* I2cMessage, int messageLength)
-{
-    UCB0IE &= ~UCRXIE;                            // disable RX ready interrupt
-    UCB0IFG &= ~(UCTXIFG + UCSTPIFG + UCNACKIFG); // clear TX ready and stop interrupt flag
-    UCB0IE |= UCTXIE | UCNACKIE;                  // enable TX ready interrupt
-
-    PTxData = (unsigned char *)I2cMessage;        // TX array start address
-
-    TXByteCtr = messageLength ;                   // Load TX byte counter
-
-    I2C_Status_e = I2C_TRANSMITTING;
-    UCB0CTL1 |= UCTR + UCTXSTT;                   // I2C TX, start condition
-    // while (UCB0CTL1 & UCTXSTT);                 // Start condition sent?
-    // while (UCB0STAT & UCBBUSY);                 // wait for bus to be free  !!!!!
-    // UCB0IE &= ~UCSTPIE;                         // disable STOP interrupt  
-
-    while(I2C_Status_e == I2C_TRANSMITTING);
-
-    if(I2C_Status_e == I2C_TRANSMIT_COMPLETE)
-    {
-        // check for commands that doesn't require an ack
-        PTxData = (unsigned char *)I2cMessage;        // TX array start address
-
-        if((*(PTxData + UART_HEADER_LENGTH + UART_LENGTH_LENGTH) == 0x1B))
-            return 0;
-        else
-            return 1;  
-    }
-    else if(I2C_Status_e == I2C_ERROR)
-    {
-        return -1;
-    }
-    
-    return -1;
-   
-} 
-
-// returns number of received bytes
-int16_t i2cReceiveMessage(unsigned char* I2cMessage)
-{
-    uint32_t timeout;
-    
-    UCB0CTL1 &= ~UCTR;
-    UCB0IE |= UCRXIE;                         // Enable RX interrupt
-
-    PRxData = (unsigned char *)I2cMessage;    // Start of RX buffer
-    RXByteCtr = 1;                            // Load RX byte counter
-
-    ACK = 0;   
-    I2C_Status_e = I2C_RECEIVING;
-    UCB0CTL1 |= UCTXSTT; 
-    //__bis_SR_register(LPM0_bits + GIE);       // Enter LPM0, enable interrupts
-                                              // Remain in LPM0 until all data
-                                              // is RX'd
-    timeout = TIMEOUT_RECEPTION;
-    while((I2C_Status_e == I2C_RECEIVING) && (timeout-- != 0x00));
-    
-    if((timeout == 0) || (I2C_Status_e == I2C_ERROR))
-    {
-        i2cStopSending();
-        timeout = TIMEOUT_RECEPTION;
-        while((UCB0CTL1 & UCTXSTP) && (timeout-- != 0));
-    }
-    
-    if(I2C_Status_e == I2C_RECEIVE_COMPLETE)
-    {
-        return (rxlength > 0) ? 1 + I2C_HEADER_LENGTH + I2C_LENGTH_LENGTH + rxlength + I2C_CRC_LENGTH : 1 + I2C_HEADER_LENGTH + I2C_LENGTH_LENGTH;                                             
-    }
-    else
-        return -1;
-
-}
-
-void i2cStopSending(void)
-{
-    UCB0CTL1 |= UCTXSTP;
-}
-
-// ISR for I2C
-#pragma vector = USCI_B0_VECTOR
-__interrupt void USCI_B0_ISR(void)
-{
-    switch(__even_in_range(UCB0IV,USCI_I2C_UCTXIFG))
-    {
-        case USCI_NONE:          break; // Vector 0:  No interrupts
-        case USCI_I2C_UCALIFG:   break; // Vector 2:  UCALIFG
-        case USCI_I2C_UCNACKIFG: 
-            I2C_Status_e = I2C_ERROR;
-            break;                      // Vector 4:  NACKIFG
-        case USCI_I2C_UCSTTIFG:  break; // Vector 6:  STTIFG
-        case USCI_I2C_UCSTPIFG:  break; // Vector 8:  STPIFG
-        case USCI_I2C_UCRXIFG:          // Vector 10: RXIFG
-
-            if (ACK == 0)
-            {
-                *PRxData++ = UCB0RXBUF;               // Move RX data to address PRxData
-                if(*(PRxData-1) != BSL_RESPONSE_ACK)
-                {
-                    UCB0CTL1 |= UCTXSTP;              // Generate I2C stop condition
-                }
-                else
-                {
-                    ACK = 1;
-                    RXByteCtr = I2C_HEADER_LENGTH + I2C_LENGTH_LENGTH;  // receives the next three bytes
-                    rxlength = 0;
-                }
-            } 
-            else
-            {
-                RXByteCtr--;                            // Decrement RX byte counter
-                if(RXByteCtr)
-                {
-                    *PRxData++ = UCB0RXBUF;               // Move RX data to address PRxData
-                    if((RXByteCtr == 1) && (rxlength > 0)) // Only one byte left?
-                        UCB0CTL1 |= UCTXSTP;                // Generate I2C stop condition
-                }
-                else if(rxlength == 0)
-                {
-                    *PRxData++ = UCB0RXBUF;               // Move RX data to address PRxData
-                    rxlength = ((unsigned int) *(PRxData-1) << 8) | *(PRxData-2);
-                    if(rxlength == 0) UCB0CTL1 |= UCTXSTP;     // stop receiving if no bytes required
-                        RXByteCtr = rxlength + I2C_CRC_LENGTH;
-                }
-                else
-                {
-                    *PRxData = UCB0RXBUF;                 // Move final RX data to PRxData
-                    I2C_Status_e = I2C_RECEIVE_COMPLETE;
-                    //__bic_SR_register_on_exit(LPM0_bits); // Exit active CPU
-                }
-            }
-            break;        
-        case USCI_I2C_UCTXIFG:                                   // Vector 12: TXIFG
-            if(TXByteCtr)                          // Check TX byte counter
-            {
-                UCB0TXBUF = *PTxData++;               // Load TX buffer
-                TXByteCtr--;                          // Decrement TX byte counter
-            }
-            else
-            {
-                //UCB0CTL1 |= UCTXSTP;                // Generate I2C stop condition
-                I2C_Status_e = I2C_TRANSMIT_COMPLETE;
-                //__bic_SR_register_on_exit(LPM0_bits); // Exit active CPU
-            }
-            break;        
-        default:
-            break;
-    }
-}
diff --git a/I2C.h b/I2C.h
deleted file mode 100644 (file)
index b7f52e2..0000000
--- a/I2C.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * I2C.h
- *
- * The I2C communication functions and BSL invoke sequence.
- *
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef I2C_H_
-#define I2C_H_
-
-#include <stdint.h>
-
-#define BSL_SLAVE_ADDR  0x48
-
-#define I2C_PORT_SEL   P4SEL
-#define I2C_PORT_OUT   P4OUT
-#define I2C_PORT_REN   P4REN
-#define I2C_PORT_DIR   P4DIR
-
-#define SDA_PIN BIT5
-#define SCL_PIN BIT4
-#define SCL_CLOCK_DIV(X)           (USB_MCLK_FREQ/X)             
-
-#define RESET_HIGH {PJOUT |= BIT1;}
-#define RESET_LOW  {PJOUT &= ~BIT1;}
-#define TEST_HIGH  {PJOUT |= BIT2;}
-#define TEST_LOW   {PJOUT &= ~BIT2;}
-#define RESET_PIN BIT1
-#define TEST_PIN  BIT2
-#define TCK_PIN   BIT3
-
-#define INVOKE_DELAY 1000
-
-// Timing for Pin Toggling during BSL Entry Sequence  
-// TEST PIN reset time = 10us (must be less than 15us)
-#define BSL_ENTRY_SEQUENCE_TIME 50
-
-//#define BSL_PORT_DIR    P6DIR                
-//#define BSL_PORT_OUT    P6OUT
-//#define BSL_RESET_PIN   (BIT0 + BIT1) 
-//#define BSL_TEST_PIN    BIT2
-
-#define BSL_RESPONSE_ACK       0x00
-#define BSL_NO_RESPONSE_REQUIRED       0xAE
-
-#define BSL_ERROR_HEADER_INCORRECT     0x51       
-#define BSL_ERROR_INCORRECT_RESPONSE_CRC       0xA0
-#define BSL_ERROR_OK   0x00 
-
-#define I2C_HEADER 0x80
-#define I2C_HEADER_LENGTH      1               // length in byte
-#define I2C_LENGTH_LENGTH      2               // length in byte
-#define I2C_CRC_LENGTH         2               // length in byte
-
-
-// Init I2C module B0 and according port settings
-int8_t InitI2C(unsigned char eeprom_i2c_address, uint32_t bitrate);
-int16_t i2cSendMessage(unsigned char* I2cMessage, int messageLength);
-int16_t i2cReceiveMessage(unsigned char* I2cMessage);
-void i2cBslEntrySequence(void);
-void i2cStopSending(void);
-
-#endif /*I2C_H_*/
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644 (file)
index d5a2a7e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2012, Texas Instruments
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-    * Neither the name of the Texas Instruments Incorporated nor the
-      names of its contributors may be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL TEXAS INSTRUMENTS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
index 73a8d8f4cc84eac2950d132b69c0defa581aa208..f0f1373479043d24feeed8ab2c2aef7402cd6463 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,15 +1,15 @@
-MSPBSL_USB_Tool
-===============
-
-This firmware is designed to allow USB to UART communication for the purpose of programming an MSP430 BootStrapLoader.  It requires special hardware, described below.
-
-This firmware is based on the MSP430 CDC UART Bridge, which can be found in the USB developer package: http://www.ti.com/tool/msp430usbdevpack
-
-Hardware to run this firmware can be found here: https://www.olimex.com/Products/MSP430/BSL/MSP430-BSL/
-
-Schematics are available here: https://www.olimex.com/Products/MSP430/BSL/MSP430-BSL/resources/MSP430-BSL_Rev_B.pdf
-
-Note: When downloading the firmware via ZIP, the linebreaks in the text files might be incompatible with your OS.  This is particularly important if you plan to use the text file output image with a tool to write the firmware onto the Rocket.  Some TI provided tools require windows-format linebreaks, whereas the Zip web download comes in UNIX-style.  This can be worked around in two ways:
-
-- Fetch the source code using GIT running on your host OS, having it automatically change the formatting
-- Manually change the linebreaks in the downloaded TXT  file.
+MSPBSL_USB_Tool\r
+===============\r
+\r
+This firmware is designed to allow USB to UART, I2C and SPI communication for the purpose of programming an MSP430/MSP432 Bootstrap Loader (BSL).  It requires special hardware, described below.\r
+\r
+This firmware is based on the MSP430 CDC UART Bridge, which can be found in the USB developer package: http://www.ti.com/tool/msp430usbdevpack\r
+\r
+Hardware to run this firmware can be found here: https://www.olimex.com/Products/MSP430/BSL/MSP430-BSL/\r
+\r
+Schematics are available here: https://www.olimex.com/Products/MSP430/BSL/MSP430-BSL/resources/MSP430-BSL_Rev_B.pdf\r
+\r
+Note: When downloading the firmware via ZIP, the linebreaks in the text files might be incompatible with your OS.  This is particularly important if you plan to use the text file output image with a tool to write the firmware onto the Rocket.  Some TI provided tools require windows-format linebreaks, whereas the Zip web download comes in UNIX-style.  This can be worked around in two ways:\r
+\r
+- Fetch the source code using GIT running on your host OS, having it automatically change the formatting\r
+- Manually change the linebreaks in the downloaded TXT file.\r
diff --git a/USB_API/USB_CDC_API/UsbCdc.c b/USB_API/USB_CDC_API/UsbCdc.c
deleted file mode 100644 (file)
index 537cf1e..0000000
+++ /dev/null
@@ -1,1015 +0,0 @@
-/*
- * UsbCdc.c
- *
- * CDC specific USB functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC Driver)                    |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: UsbCdc.c, File Version 1.01 2009/12/03                             |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2008/09/03   born                                             |
-|  RSTO         2008/09/19   Changed USBCDC_sendData to send more then 64bytes|
-|  RSTO         2008/12/23   enhancements of CDC API                          |
-|  RSTO         2008/05/19   updated USBCDC_intfStatus()                      |
-|  RSTO         2009/05/26   added USBCDC_bytesInUSBBuffer()                  |
-|  RSTO         2009/05/28   changed USBCDC_sendData()                        |
-|  RSTO         2009/07/17   updated USBCDC_bytesInUSBBuffer()                |
-|  RSTO         2009/10/21   move __disable_interrupt() before                |
-|                            checking for suspend                             |
-|  MSP,Biju     2009/12/28   Fix for the bug "Download speed is slow"         |
-+----------------------------------------------------------------------------*/
-#include <descriptors.h>
-
-#ifdef _CDC_
-
-
-#include "../USB_Common/device.h"
-#include "../USB_Common/types.h"              // Basic Type declarations
-#include "../USB_Common/defMSP430USB.h"
-#include "../USB_Common/usb.h"            // USB-specific Data Structures
-#include "../USB_CDC_API/UsbCdc.h"
-
-#include <string.h>
-#include "uart.h"
-#include "baudrateselect.h"
-
-// Local Macros 
-#define INTFNUM_OFFSET(X)   (X - CDC0_INTFNUM)  // Get the CDC offset
-
-static struct _CdcParams
-{
-    ULONG lBaudrate;              // holds baudrate
-    BYTE bDataBits;               // holds Data Bits
-    BYTE bStopBits;               // holds Stopa Bits
-    BYTE bParity;                 // holds Parity
-}CdcParams[CDC_NUM_INTERFACES];
-
-static struct _CdcWrite
-{
-    WORD nCdcBytesToSend;        // holds counter of bytes to be sent
-    WORD nCdcBytesToSendLeft;    // holds counter how many bytes is still to be sent
-    const BYTE* pUsbBufferToSend;   // holds the buffer with data to be sent
-    BYTE bCurrentBufferXY;       // is 0 if current buffer to write data is X, or 1 if current buffer is Y
-       BYTE bZeroPacketSent; // = FALSE;
-    BYTE last_ByteSend;
-} CdcWriteCtrl[CDC_NUM_INTERFACES];
-
-static struct _CdcRead
-{
-    BYTE *pUserBuffer;     // holds the current position of user's receiving buffer. If NULL- no receiving operation started
-    BYTE *pCurrentEpPos;   // current positon to read of received data from curent EP
-    WORD nBytesToReceive;  // holds how many bytes was requested by receiveData() to receive
-    WORD nBytesToReceiveLeft;        // holds how many bytes is still requested by receiveData() to receive
-    BYTE * pCT1;           // holds current EPBCTxx register
-    BYTE * pCT2;           // holds next EPBCTxx register
-    BYTE * pEP2;           // holds addr of the next EP buffer
-    BYTE nBytesInEp;       // how many received bytes still available in current EP
-    BYTE bCurrentBufferXY; // indicates which buffer is used by host to transmit data via OUT endpoint3
-} CdcReadCtrl[CDC_NUM_INTERFACES];
-
-extern WORD wUsbEventMask;
-
-//function pointers
-extern VOID *(*USB_TX_memcpy)(VOID * dest, const VOID * source, size_t count);
-extern VOID *(*USB_RX_memcpy)(VOID * dest, const VOID * source, size_t count);
-
-
-/*----------------------------------------------------------------------------+
-| Global Variables                                                            |
-+----------------------------------------------------------------------------*/
-
-extern __no_init tEDB __data16 tInputEndPointDescriptorBlock[];
-extern __no_init tEDB __data16 tOutputEndPointDescriptorBlock[];
-
-
-VOID CdcResetData()
-{
-  
-    // indicates which buffer is used by host to transmit data via OUT endpoint3 - X buffer is first
-    //CdcReadCtrl[intfIndex].bCurrentBufferXY = X_BUFFER;
-    
-    memset(&CdcWriteCtrl, 0, sizeof(CdcWriteCtrl));
-    memset(&CdcReadCtrl, 0, sizeof(CdcReadCtrl));
-    
-}
-
-/*
-Sends data over interface intfNum, of size size and starting at address data.
-Returns: kUSBCDC_sendStarted
-         kUSBCDC_sendComplete
-         kUSBCDC_intfBusyError
-*/
-BYTE USBCDC_sendData(const BYTE* data, WORD size, BYTE intfNum)
-{
-    BYTE edbIndex;
-    unsigned short bGIE;
-      
-    edbIndex= stUsbHandle[intfNum].edb_Index;
-    
-    if (size == 0)
-    {
-        return kUSBCDC_generalError;
-    }
-
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    // atomic operation - disable interrupts
-    __disable_interrupt();                   // Disable global interrupts
-    
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-        // data can not be read because of USB suspended
-       __bis_SR_register(bGIE);   //restore interrupt status
-        return kUSBCDC_busNotAvailable;
-    }
-
-    if (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft != 0)
-    {
-        // the USB still sends previous data, we have to wait
-        __bis_SR_register(bGIE);   //restore interrupt status
-        return kUSBCDC_intfBusyError;
-    }
-
-    //This function generate the USB interrupt. The data will be sent out from interrupt
-
-    CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSend = size;
-    CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft = size;
-    CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].pUsbBufferToSend = data;
-
-    //trigger Endpoint Interrupt - to start send operation
-    USBIEPIFG |= 1<<(edbIndex+1);  //IEPIFGx;
-
-    __bis_SR_register(bGIE);       //restore interrupt status
-
-    return kUSBCDC_sendStarted;
-}
-
-#define EP_MAX_PACKET_SIZE_CDC      0x40
-
-//this function is used only by USB interrupt
-BOOL CdcToHostFromBuffer(BYTE intfNum)
-{
-    BYTE byte_count, nTmp2;
-    BYTE * pEP1;
-    BYTE * pEP2;
-    BYTE * pCT1;
-    BYTE * pCT2;
-    BYTE bWakeUp = FALSE; //TRUE for wake up after interrupt
-    BYTE edbIndex;
-   
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    if (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft == 0)           // do we have somtething to send?
-    {
-        if (!CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bZeroPacketSent)               // zero packet was not yet sent
-        {
-            CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bZeroPacketSent = TRUE;
-
-            if(CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].last_ByteSend == EP_MAX_PACKET_SIZE_CDC)
-            {
-                if (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER) 
-                               {
-                    tInputEndPointDescriptorBlock[edbIndex].bEPBCTX = 0;
-                               }
-                else 
-                               {
-                    tInputEndPointDescriptorBlock[edbIndex].bEPBCTY = 0;
-                               }              
-                CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1)&0x01; //switch buffer
-            }
-            
-            CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSend = 0;   // nothing to send
-
-            //call event callback function
-            if (wUsbEventMask & kUSB_sendCompletedEvent)
-            {
-                bWakeUp = USBCDC_handleSendCompleted(intfNum);
-            }
-
-        } // if (!bSentZeroPacket)
-
-        return bWakeUp;
-    }
-
-    CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bZeroPacketSent = FALSE;    // zero packet will be not sent: we have data
-
-    if (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER)
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].iep_X_Buffer;
-        pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-
-        //second EP buffer
-        pEP2 = (BYTE*)stUsbHandle[intfNum].iep_Y_Buffer;
-        pCT2 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-    }
-    else
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].iep_Y_Buffer;
-        pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-
-        //second EP buffer
-        pEP2 = (BYTE*)stUsbHandle[intfNum].iep_X_Buffer;
-        pCT2 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-    }
-
-    // how many byte we can send over one endpoint buffer
-    byte_count = (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft > EP_MAX_PACKET_SIZE_CDC) ? EP_MAX_PACKET_SIZE_CDC : CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft;
-    nTmp2 = *pCT1;
-
-    if(nTmp2 & EPBCNT_NAK)
-    {
-        USB_TX_memcpy(pEP1, CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].pUsbBufferToSend, byte_count); // copy data into IEP3 X or Y buffer
-        *pCT1 = byte_count;                      // Set counter for usb In-Transaction
-        CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1)&0x01; //switch buffer
-        CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft -= byte_count;
-        CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].pUsbBufferToSend += byte_count;             // move buffer pointer
-        CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].last_ByteSend = byte_count;
-        
-        //try to send data over second buffer
-        nTmp2 = *pCT2;
-        if ((CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft > 0) &&                                  // do we have more data to send?
-            (nTmp2 & EPBCNT_NAK)) // if the second buffer is free?
-        {
-            // how many byte we can send over one endpoint buffer
-            byte_count = (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft > EP_MAX_PACKET_SIZE_CDC) ? EP_MAX_PACKET_SIZE_CDC : CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft;
-
-            USB_TX_memcpy(pEP2, CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].pUsbBufferToSend, byte_count); // copy data into IEP3 X or Y buffer
-            *pCT2 = byte_count;                      // Set counter for usb In-Transaction
-            CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1)&0x01; //switch buffer
-            CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft -= byte_count;
-            CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].pUsbBufferToSend += byte_count;            //move buffer pointer
-            CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].last_ByteSend = byte_count;
-        }
-    }
-    return bWakeUp;
-}
-
-/*
-Aborts an active send operation on interface intfNum.
-Returns the number of bytes that were sent prior to the abort, in size.
-*/
-BYTE USBCDC_abortSend(WORD* size, BYTE intfNum)
-{
-    unsigned short bGIE;
-    
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    __disable_interrupt(); //disable interrupts - atomic operation
-
-    *size = (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSend - CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft);
-    CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSend = 0;
-    CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft = 0;
-
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSB_succeed;
-}
-
-// This function copies data from OUT endpoint into user's buffer
-// Arguments:
-//    pEP - pointer to EP to copy from
-//    pCT - pointer to pCT control reg
-//
-VOID CopyUsbToBuff(BYTE* pEP, BYTE* pCT, BYTE intfNum)
-{
-    BYTE nCount;
-
-    // how many byte we can get from one endpoint buffer
-    nCount = (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft > CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp) ? CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp : CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft;
-
-    USB_RX_memcpy(CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer, pEP, nCount); // copy data from OEP3 X or Y buffer
-    CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft -= nCount;
-    CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer += nCount;          // move buffer pointer
-                                                // to read rest of data next time from this place
-
-    if (nCount == CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp)       // all bytes are copied from receive buffer?
-    {
-        //switch current buffer
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1) &0x01;
-
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = 0;
-
-        //clear NAK, EP ready to receive data
-        *pCT = 0x00;
-    }
-    else
-    {
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp -= nCount;
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = pEP + nCount;
-    }
-}
-
-/*
-Receives data over interface intfNum, of size size, into memory starting at address data.
-Returns:
-    kUSBCDC_receiveStarted  if the receiving process started.
-    kUSBCDC_receiveCompleted  all requested date are received.
-    kUSBCDC_receiveInProgress  previous receive opereation is in progress. The requested receive operation can be not started.
-    kUSBCDC_generalError  error occurred.
-*/
-BYTE USBCDC_receiveData(BYTE* data, WORD size, BYTE intfNum)
-{
-    BYTE nTmp1;
-    BYTE edbIndex;
-    unsigned short bGIE;
-     
-    edbIndex=stUsbHandle[intfNum].edb_Index;
-
-    if ((size == 0) ||                          // read size is 0
-        (data == NULL))
-    {
-        return kUSBCDC_generalError;
-    }
-
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    // atomic operation - disable interrupts
-    __disable_interrupt();               // Disable global interrupts
-
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-        // data can not be read because of USB suspended
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBCDC_busNotAvailable;
-    }
-
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer != NULL)        // receive process already started
-    {
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBCDC_intfBusyError;
-    }
-
-    CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceive = size;         // bytes to receive
-    CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft = size;     // left bytes to receive
-    CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = data;             // set user receive buffer
-
-    //read rest of data from buffer, if any
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > 0)
-    {
-        // copy data from pEP-endpoint into User's buffer
-        CopyUsbToBuff(CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos, CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1, intfNum);
-
-        if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)     // the Receive opereation is completed
-        {
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;     // no more receiving pending
-                       if (wUsbEventMask & kUSB_receiveCompletedEvent)
-            {
-                           USBCDC_handleReceiveCompleted(intfNum);      // call event handler in interrupt context
-                       }
-            __bis_SR_register(bGIE); //restore interrupt status
-            return kUSBCDC_receiveCompleted;    // receive completed
-        }
-
-        // check other EP buffer for data - exchange pCT1 with pCT2
-        if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 == &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX)
-        {
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-        }
-        else
-        {
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-        }
-
-        nTmp1 = *CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-        //try read data from second buffer
-        if (nTmp1 & EPBCNT_NAK)                 // if the second buffer has received data?
-        {
-            nTmp1 = nTmp1 &0x7f;                // clear NAK bit
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1;     // holds how many valid bytes in the EP buffer
-            CopyUsbToBuff(CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos, CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1, intfNum);
-        }
-
-        if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)     // the Receive opereation is completed
-        {
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;     // no more receiving pending
-                       if (wUsbEventMask & kUSB_receiveCompletedEvent)
-            {
-                           USBCDC_handleReceiveCompleted(intfNum);      // call event handler in interrupt context
-                       }
-            __bis_SR_register(bGIE); //restore interrupt status
-            return kUSBCDC_receiveCompleted;    // receive completed
-        }
-    } //read rest of data from buffer, if any
-
-    //read 'fresh' data, if available
-    nTmp1 = 0;
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER)  //this is current buffer
-    {
-        if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK) //this buffer has a valid data packet
-        {
-            //this is the active EP buffer
-            //pEP1
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-
-            //second EP buffer
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-            nTmp1 = 1;    //indicate that data is available
-        }
-    }
-    else 
-       {// Y_BUFFER
-               if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK)
-               {
-                       //this is the active EP buffer
-                       CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-                       CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-
-                       //second EP buffer
-                       CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-                       CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-                       nTmp1 = 1;    //indicate that data is available
-               }
-       }
-       
-    if (nTmp1)
-    {
-        // how many byte we can get from one endpoint buffer
-        nTmp1 = *CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-        while(nTmp1 == 0)
-        {
-            nTmp1 = *CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-        }
-
-        if(nTmp1 & EPBCNT_NAK)
-        {
-            nTmp1 = nTmp1 &0x7f;            // clear NAK bit
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1; // holds how many valid bytes in the EP buffer
-
-            CopyUsbToBuff(CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos, CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1, intfNum);
-
-            nTmp1 = *CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-            //try read data from second buffer
-            if ((CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft > 0) &&       // do we have more data to send?
-                (nTmp1 & EPBCNT_NAK))                 // if the second buffer has received data?
-            {
-                nTmp1 = nTmp1 &0x7f;                  // clear NAK bit
-                CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1;       // holds how many valid bytes in the EP buffer
-                CopyUsbToBuff(CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2, CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2, intfNum);
-                CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-            }
-        }
-    }
-
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)     // the Receive opereation is completed
-    {
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;           // no more receiving pending
-               if (wUsbEventMask & kUSB_receiveCompletedEvent)
-        {
-            USBCDC_handleReceiveCompleted(intfNum);         // call event handler in interrupt context
-           }
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBCDC_receiveCompleted;
-    }
-
-    //interrupts enable
-   __bis_SR_register(bGIE); //restore interrupt status
-    return kUSBCDC_receiveStarted;
-}
-
-
-//this function is used only by USB interrupt.
-//It fills user receiving buffer with received data
-BOOL CdcToBufferFromHost(BYTE intfNum)
-{
-    BYTE * pEP1;
-    BYTE nTmp1;
-    BYTE bWakeUp = FALSE; // per default we do not wake up after interrupt
-    
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)       // do we have somtething to receive?
-    {
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;             // no more receiving pending
-        return bWakeUp;
-    }
-
-    // No data to receive...
-    if (!((tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX |
-           tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY)
-           & 0x80))
-    {
-        return bWakeUp;
-    }
-
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER)   //X is current buffer
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-
-        //second EP buffer
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-    }
-    else
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-
-        //second EP buffer
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-    }
-
-    // how many byte we can get from one endpoint buffer
-    nTmp1 = *CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-
-    if(nTmp1 & EPBCNT_NAK)
-    {
-        nTmp1 = nTmp1 &0x7f;            // clear NAK bit
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1; // holds how many valid bytes in the EP buffer
-
-        CopyUsbToBuff(pEP1, CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1, intfNum);
-
-        nTmp1 = *CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-        //try read data from second buffer
-        if ((CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft > 0) &&       // do we have more data to send?
-            (nTmp1 & EPBCNT_NAK))                 // if the second buffer has received data?
-        {
-            nTmp1 = nTmp1 &0x7f;                  // clear NAK bit
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1;       // holds how many valid bytes in the EP buffer
-            CopyUsbToBuff(CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2, CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2, intfNum);
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-        }
-    }
-
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)     // the Receive opereation is completed
-    {
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;   // no more receiving pending
-        if (wUsbEventMask & kUSB_receiveCompletedEvent)
-        {
-            bWakeUp = USBCDC_handleReceiveCompleted(intfNum);
-        }
-
-        if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp)       // Is not read data still available in the EP?
-        {
-            if (wUsbEventMask & kUSB_dataReceivedEvent)
-            {
-                bWakeUp = USBCDC_handleDataReceived(intfNum);
-            }
-        }
-    }
-    return bWakeUp;
-}
-
-// helper for USB interrupt handler
-BOOL CdcIsReceiveInProgress(BYTE intfNum)
-{
-    return (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer != NULL);
-}
-
-
-/*
-Aborts an active receive operation on interface intfNum.
-  Returns the number of bytes that were received and transferred
-  to the data location established for this receive operation.
-*/
-BYTE USBCDC_abortReceive(WORD* size, BYTE intfNum)
-{
-    //interrupts disable
-    unsigned short bGIE;
-    
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    // atomic operation - disable interrupts
-    __disable_interrupt();                   // Disable global interrupts
-       
-    *size = 0; //set received bytes count to 0
-
-    //is receive operation underway?
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer)
-    {
-        //how many bytes are already received?
-        *size = CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceive - CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft;
-
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = 0;
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft = 0;
-    }
-
-     //restore interrupt status
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSB_succeed;
-}
-
-/*
-This function rejects payload data that has been received from the host.
-*/
-BYTE USBCDC_rejectData(BYTE intfNum)
-{
-    BYTE edbIndex;
-    unsigned short bGIE;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-
-    // atomic operation - disable interrupts
-    __disable_interrupt();               // Disable global interrupts
-
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if (bFunctionSuspended)
-    {
-       __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBCDC_busNotAvailable;
-    }
-
-    //Is receive operation underway?
-    // - do not flush buffers if any operation still active.
-    if (!CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer)
-    {
-        BYTE tmp1 = tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK;
-        BYTE tmp2 = tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK;
-
-        if (tmp1 ^ tmp2) // switch current buffer if any and only ONE of buffers is full
-        {
-            //switch current buffer
-            CdcReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1) &0x01;
-        }
-
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX = 0;  //flush buffer X
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY = 0;  //flush buffer Y
-        CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = 0;                     // indicates that no more data available in the EP
-    }
-
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSB_succeed;
-}
-
-/*
-This function indicates the status of the itnerface intfNum.
-  If a send operation is active for this interface,
-  the function also returns the number of bytes that have been transmitted to the host.
-  If a receiver operation is active for this interface, the function also returns
-  the number of bytes that have been received from the host and are waiting at the assigned address.
-
-returns kUSBCDC_waitingForSend (indicates that a call to USBCDC_SendData()
-  has been made, for which data transfer has not been completed)
-
-returns kUSBCDC_waitingForReceive (indicates that a receive operation
-  has been initiated, but not all data has yet been received)
-
-returns kUSBCDC_dataWaiting (indicates that data has been received
-  from the host, waiting in the USB receive buffers)
-*/
-BYTE USBCDC_intfStatus(BYTE intfNum, WORD* bytesSent, WORD* bytesReceived)
-{
-    BYTE ret = 0;      
-    unsigned short bGIE;
-    BYTE edbIndex;
-               
-    *bytesSent = 0;
-    *bytesReceived = 0;
-    
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    __disable_interrupt(); //disable interrupts - atomic operation
-
-    // Is send operation underway?
-    if (CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft != 0)
-    {
-        ret |= kUSBCDC_waitingForSend;
-        *bytesSent = CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSend - CdcWriteCtrl[INTFNUM_OFFSET(intfNum)].nCdcBytesToSendLeft;
-    }
-
-    //Is receive operation underway?
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer != NULL)
-    {
-        ret |= kUSBCDC_waitingForReceive;
-        *bytesReceived = CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceive - CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft;
-    }
-    else // receive operation not started
-    {
-        // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-        if (!bFunctionSuspended)
-        {
-            if((tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK)  | //any of buffers has a valid data packet
-               (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK))
-            {
-                ret |= kUSBCDC_dataWaiting;
-            }
-        }
-    }
-
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-        // if suspended or not enumerated - report no other tasks pending
-        ret = kUSBCDC_busNotAvailable;
-    }
-
-     //restore interrupt status
-    __bis_SR_register(bGIE); //restore interrupt status
-
-    __no_operation();
-    return ret;
-}
-
-/*
-Returns how many bytes are in the buffer are received and ready to be read.
-*/
-BYTE USBCDC_bytesInUSBBuffer(BYTE intfNum)
-{
-    BYTE bTmp1 = 0;
-    unsigned short bGIE;
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    // atomic operation - disable interrupts
-    __disable_interrupt();               // Disable global interrupts
-
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-       __bis_SR_register(bGIE); //restore interrupt status
-        // if suspended or not enumerated - report 0 bytes available
-        return 0;
-    }
-
-    if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > 0)         // If a RX operation is underway, part of data may was read of the OEP buffer
-    {
-        bTmp1 = CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp;
-        if (*CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 & EPBCNT_NAK) // the next buffer has a valid data packet
-        {
-            bTmp1 += *CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 & 0x7F;
-        }
-    }
-    else
-    {
-        if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK) //this buffer has a valid data packet
-        {
-            bTmp1 = tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & 0x7F;
-        }
-        if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK) //this buffer has a valid data packet
-        {
-            bTmp1 += tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & 0x7F;
-        }
-    }
-
-    __bis_SR_register(bGIE); //restore interrupt status
-    return bTmp1;
-}
-
-
-//----------------------------------------------------------------------------
-//  Line Coding Structure
-//  dwDTERate     | 4 | Data terminal rate, in bits per second
-//  bCharFormat   | 1 | Stop bits, 0 = 1 Stop bit, 1 = 1,5 Stop bits, 2 = 2 Stop bits
-//  bParityType   | 1 | Parity, 0 = None, 1 = Odd, 2 = Even, 3= Mark, 4 = Space
-//  bDataBits     | 1 | Data bits (5,6,7,8,16)
-//----------------------------------------------------------------------------
-VOID usbGetLineCoding0(VOID)
-{
-    abUsbRequestReturnData[6] = CdcParams[CDC0_INTFNUM].bDataBits;  // Data bits = 8
-    abUsbRequestReturnData[5] = CdcParams[CDC0_INTFNUM].bParity;    // No Parity
-    abUsbRequestReturnData[4] = CdcParams[CDC0_INTFNUM].bStopBits;  // Stop bits = 1
-
-    abUsbRequestReturnData[3] = CdcParams[CDC0_INTFNUM].lBaudrate >> 24;
-    abUsbRequestReturnData[2] = CdcParams[CDC0_INTFNUM].lBaudrate >> 16;
-    abUsbRequestReturnData[1] = CdcParams[CDC0_INTFNUM].lBaudrate >> 8;
-    abUsbRequestReturnData[0] = CdcParams[CDC0_INTFNUM].lBaudrate;
-
-    wBytesRemainingOnIEP0 = 0x07;                   // amount of data to be send over EP0 to host
-    usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);  // send data to host
-}
-
-#if CDC_NUM_INTERFACES >= 2
-//----------------------------------------------------------------------------
-VOID usbGetLineCoding1(VOID)
-{
-    abUsbRequestReturnData[6] = CdcParams[CDC1_INTFNUM].bDataBits;  // Data bits = 8
-    abUsbRequestReturnData[5] = CdcParams[CDC1_INTFNUM].bParity;    // No Parity
-    abUsbRequestReturnData[4] = CdcParams[CDC1_INTFNUM].bStopBits;  // Stop bits = 1
-
-    abUsbRequestReturnData[3] = CdcParams[CDC1_INTFNUM].lBaudrate >> 24;
-    abUsbRequestReturnData[2] = CdcParams[CDC1_INTFNUM].lBaudrate >> 16;
-    abUsbRequestReturnData[1] = CdcParams[CDC1_INTFNUM].lBaudrate >> 8;
-    abUsbRequestReturnData[0] = CdcParams[CDC1_INTFNUM].lBaudrate;
-
-    wBytesRemainingOnIEP0 = 0x07;                   // amount of data to be send over EP0 to host
-    usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);  // send data to host
-}
-#endif
-
-#if CDC_NUM_INTERFACES >= 3
-//----------------------------------------------------------------------------
-VOID usbGetLineCoding2(VOID)
-{
-    abUsbRequestReturnData[6] = CdcParams[CDC2_INTFNUM].bDataBits;  // Data bits = 8
-    abUsbRequestReturnData[5] = CdcParams[CDC2_INTFNUM].bParity;    // No Parity
-    abUsbRequestReturnData[4] = CdcParams[CDC2_INTFNUM].bStopBits;  // Stop bits = 1
-
-    abUsbRequestReturnData[3] = CdcParams[CDC2_INTFNUM].lBaudrate >> 24;
-    abUsbRequestReturnData[2] = CdcParams[CDC2_INTFNUM].lBaudrate >> 16;
-    abUsbRequestReturnData[1] = CdcParams[CDC2_INTFNUM].lBaudrate >> 8;
-    abUsbRequestReturnData[0] = CdcParams[CDC2_INTFNUM].lBaudrate;
-
-    wBytesRemainingOnIEP0 = 0x07;                   // amount of data to be send over EP0 to host
-    usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);  // send data to host
-}
-#endif
-//----------------------------------------------------------------------------
-
-VOID usbSetLineCoding0(VOID)
-{
-    usbReceiveDataPacketOnEP0((PBYTE) &abUsbRequestIncomingData);     // receive data over EP0 from Host
-}
-
-//----------------------------------------------------------------------------
-#if CDC_NUM_INTERFACES >= 2
-VOID usbSetLineCoding1(VOID)
-{
-    usbReceiveDataPacketOnEP0((PBYTE) &abUsbRequestIncomingData);     // receive data over EP0 from Host
-}
-#endif
-//----------------------------------------------------------------------------
-#if CDC_NUM_INTERFACES >= 3
-VOID usbSetLineCoding2(VOID)
-{
-    usbReceiveDataPacketOnEP0((PBYTE) &abUsbRequestIncomingData);     // receive data over EP0 from Host
-}
-#endif
-//----------------------------------------------------------------------------
-#define SET_DTR0 P4OUT |= 0x08
-#define CLR_DTR0 P4OUT &= ~0x08
-#define CLR_RTS0 {P4OUT |= 0x04 ;P2OUT &= ~0x01;}
-#define SET_RTS0 {P4OUT &= ~0x04;P2OUT |= 0x01;}
-
-VOID usbSetControlLineState0(VOID)
-{
-#ifdef UART_BASED
-    if ((tSetupPacket.wValue  & 0x03) == 0x03)
-        {
-          CLR_RTS0;
-          SET_RTS0;
-          CLR_RTS0;
-          SET_DTR0;
-          __delay_cycles(50);
-          SET_RTS0;
-        }
-    else
-        {
-          SET_RTS0;
-          CLR_DTR0;
-          __delay_cycles(50);
-        }
-#endif
-    usbSendZeroLengthPacketOnIEP0();    // Send ZLP for status stage
-}
-#if CDC_NUM_INTERFACES >= 2
-VOID usbSetControlLineState1(VOID)
-{
-    if (tSetupPacket.wValue  & 0x01)
-        {SET_DTR1;}
-    else
-        {CLR_DTR1;}
-    if (tSetupPacket.wValue  & 0x02)
-        {SET_RTS1;}
-    else
-        {CLR_RTS1;}
-    usbSendZeroLengthPacketOnIEP0();    // Send ZLP for status stage
-}
-#endif
-#if CDC_NUM_INTERFACES >= 3
-VOID usbSetControlLineState2(VOID)
-{
-    if (tSetupPacket.wValue  & 0x01)
-      SET_DTR2;
-        else
-      CLR_DTR2;
-    if (tSetupPacket.wValue  & 0x02)
-      SET_RTS2;
-        else
-      CLR_RTS2;
-    usbSendZeroLengthPacketOnIEP0();    // Send ZLP for status stage
-}
-#endif
-//----------------------------------------------------------------------------
-
-VOID Handler_SetLineCoding0(VOID)
-{
-    // Baudrate Settings
-    CdcParams[CDC0_INTFNUM].lBaudrate = (ULONG)abUsbRequestIncomingData[3] << 24 |
-      (ULONG)abUsbRequestIncomingData[2]<<16 | (ULONG)abUsbRequestIncomingData[1]<<8 |
-        abUsbRequestIncomingData[0];
-
-    // Stop bits
-    CdcParams[CDC0_INTFNUM].bStopBits = abUsbRequestIncomingData[4];
-    // Parit
-    CdcParams[CDC0_INTFNUM].bParity = abUsbRequestIncomingData[5];
-    // Data bits
-    CdcParams[CDC0_INTFNUM].bDataBits = abUsbRequestIncomingData[6];
-    #ifdef UART0_INTFNUM
-      if(!InitUart0(CdcParams[CDC0_INTFNUM].lBaudrate))
-        CdcParams[CDC0_INTFNUM].lBaudrate = 0;
-    #elif defined (I2C_BASED)
-      if (!BaudrateSelect(CdcParams[CDC0_INTFNUM].lBaudrate))
-          CdcParams[CDC0_INTFNUM].lBaudrate = 0;
-    #else
-      CdcParams[CDC0_INTFNUM].lBaudrate = 0;
-    #endif
-}
-
-//----------------------------------------------------------------------------
-VOID Handler_SetLineCoding1(VOID)
-{
-#if CDC_NUM_INTERFACES >= 2
-    // Baudrate Settings
-    CdcParams[CDC1_INTFNUM].lBaudrate = (ULONG)abUsbRequestIncomingData[3] << 24 |
-      (ULONG)abUsbRequestIncomingData[2]<<16 | (ULONG)abUsbRequestIncomingData[1]<<8 |
-        abUsbRequestIncomingData[0];
-
-    // Stop bits
-    CdcParams[CDC1_INTFNUM].bStopBits = abUsbRequestIncomingData[4];
-    // Parit
-    CdcParams[CDC1_INTFNUM].bParity = abUsbRequestIncomingData[5];
-    // Data bits
-    CdcParams[CDC1_INTFNUM].bDataBits = abUsbRequestIncomingData[6];
-    
-    #ifdef UART1_INTFNUM
-      if(!InitUart1(CdcParams[CDC1_INTFNUM].lBaudrate))
-        CdcParams[CDC1_INTFNUM].lBaudrate = 0;
-    #else
-      CdcParams[CDC1_INTFNUM].lBaudrate = 0;
-    #endif
-#endif
-}
-//----------------------------------------------------------------------------
-VOID Handler_SetLineCoding2(VOID)
-{
-#if CDC_NUM_INTERFACES >= 3
-    // Baudrate Settings
-    CdcParams[CDC2_INTFNUM].lBaudrate = (ULONG)abUsbRequestIncomingData[3] << 24 |
-      (ULONG)abUsbRequestIncomingData[2]<<16 |(ULONG)abUsbRequestIncomingData[1]<<8 | 
-      abUsbRequestIncomingData[0];
-
-    // Stop bits
-    CdcParams[CDC2_INTFNUM].bStopBits = abUsbRequestIncomingData[4];
-    // Parit
-    CdcParams[CDC2_INTFNUM].bParity = abUsbRequestIncomingData[5];
-    // Data bits
-    CdcParams[CDC2_INTFNUM].bDataBits = abUsbRequestIncomingData[6];
-    
-    #ifdef UART1_INTFNUM
-      if(!InitUart1(CdcParams[CDC2_INTFNUM].lBaudrate))
-        CdcParams[CDC2_INTFNUM].lBaudrate = 0;
-    #else
-      CdcParams[CDC2_INTFNUM].lBaudrate = 0;  
-    #endif
-#endif
-}
-#endif //ifdef _CDC_
-
-/*----------------------------------------------------------------------------+
-| End of source file                                                          |
-+----------------------------------------------------------------------------*/
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_CDC_API/UsbCdc.h b/USB_API/USB_CDC_API/UsbCdc.h
deleted file mode 100644 (file)
index c9fe4d7..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * UsbCdc.h
- *
- * CDC specific USB functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC Driver)                    |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: UsbCdc.h, File Version 1.00 2009/12/03                             |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2008/09/03   born                                             |
-|  RSTO         2008/12/23   enhancements of CDC API                          |
-|  RSTO         2009/05/15   added param to USBCDC_rejectData()               |
-|  RSTO         2009/05/26   added USBCDC_bytesInUSBBuffer()                  |
-|  MSP,Biju     2009/12/03   file versioning started                          |
-|                                                                             |
-+----------------------------------------------------------------------------*/
-#ifndef _UsbCdc_H_
-#define _UsbCdc_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#define kUSBCDC_sendStarted         0x01
-#define kUSBCDC_sendComplete        0x02
-#define kUSBCDC_intfBusyError       0x03
-#define kUSBCDC_receiveStarted      0x04
-#define kUSBCDC_receiveCompleted    0x05
-#define kUSBCDC_receiveInProgress   0x06
-#define kUSBCDC_generalError        0x07
-#define kUSBCDC_busNotAvailable     0x08
-
-
-/*----------------------------------------------------------------------------
-These functions can be used in application
-+----------------------------------------------------------------------------*/
-
-/*
-Sends data over interface intfNum, of size size and starting at address data.
-  Returns:  kUSBCDC_sendStarted
-            kUSBCDC_sendComplete
-            kUSBCDC_intfBusyError
-*/
-BYTE USBCDC_sendData(const BYTE* data, WORD size, BYTE intfNum);
-
-/*
-Receives data over interface intfNum, of size size, into memory starting at address data.
-*/
-BYTE USBCDC_receiveData(BYTE* data, WORD size, BYTE intfNum);
-
-/*
-Aborts an active receive operation on interface intfNum.
-  size: the number of bytes that were received and transferred
-  to the data location established for this receive operation.
-*/
-BYTE USBCDC_abortReceive(WORD* size, BYTE intfNum);
-
-
-#define kUSBCDC_noDataWaiting 1 //returned by USBCDC_rejectData() if no data pending
-
-/*
-This function rejects payload data that has been received from the host.
-*/
-BYTE USBCDC_rejectData(BYTE intfNum);
-
-/*
-Aborts an active send operation on interface intfNum.  Returns the number of bytes that were sent prior to the abort, in size.
-*/
-BYTE USBCDC_abortSend(WORD* size, BYTE intfNum);
-
-
-#define kUSBCDC_waitingForSend      0x01
-#define kUSBCDC_waitingForReceive   0x02
-#define kUSBCDC_dataWaiting         0x04
-#define kUSBCDC_busNotAvailable     0x08
-#define kUSB_allCdcEvents           0xFF
-
-/*
-This function indicates the status of the interface intfNum.
-  If a send operation is active for this interface,
-  the function also returns the number of bytes that have been transmitted to the host.
-  If a receiver operation is active for this interface, the function also returns
-  the number of bytes that have been received from the host and are waiting at the assigned address.
-
-returns kUSBCDC_waitingForSend (indicates that a call to USBCDC_SendData()
-  has been made, for which data transfer has not been completed)
-
-returns kUSBCDC_waitingForReceive (indicates that a receive operation
-  has been initiated, but not all data has yet been received)
-
-returns kUSBCDC_dataWaiting (indicates that data has been received
-  from the host, waiting in the USB receive buffers)
-*/
-BYTE USBCDC_intfStatus(BYTE intfNum, WORD* bytesSent, WORD* bytesReceived);
-
-/*
-Returns how many bytes are in the buffer are received and ready to be read.
-*/
-BYTE USBCDC_bytesInUSBBuffer(BYTE intfNum);
-
-
-/*----------------------------------------------------------------------------
-Event-Handling routines
-+----------------------------------------------------------------------------*/
-
-/*
-This event indicates that data has been received for interface intfNum, but no data receive operation is underway.
-returns TRUE to keep CPU awake
-*/
-BYTE USBCDC_handleDataReceived(BYTE intfNum);
-
-/*
-This event indicates that a send operation on interface intfNum has just been completed.
-returns TRUE to keep CPU awake
-*/
-BYTE USBCDC_handleSendCompleted(BYTE intfNum);
-
-/*
-This event indicates that a receive operation on interface intfNum has just been completed.
-returns TRUE to keep CPU awake
-*/
-BYTE USBCDC_handleReceiveCompleted(BYTE intfNum);
-
-
-/*----------------------------------------------------------------------------
-These functions is to be used ONLY by USB stack, and not by application
-+----------------------------------------------------------------------------*/
-
-/**
-Send a packet with the settings of the second uart back to the usb host
-*/
-VOID usbGetLineCoding0(VOID);
-VOID usbGetLineCoding1(VOID);
-VOID usbGetLineCoding2(VOID);
-
-/**
-Prepare EP0 to receive a packet with the settings for the second uart
-*/
-VOID usbSetLineCoding0(VOID);
-VOID usbSetLineCoding1(VOID);
-VOID usbSetLineCoding2(VOID);
-
-/**
-Function set or reset RTS
-*/
-VOID usbSetControlLineState0(VOID);
-VOID usbSetControlLineState1(VOID);
-VOID usbSetControlLineState2(VOID);
-
-/**
-Readout the settings (send from usb host) for the second uart
-*/
-VOID Handler_SetLineCoding0(VOID);
-VOID Handler_SetLineCoding1(VOID);
-VOID Handler_SetLineCoding2(VOID);
-
-#ifdef __cplusplus
-}
-#endif
-#endif //_UsbCdc_H_
diff --git a/USB_API/USB_Common/UsbIsr.h b/USB_API/USB_Common/UsbIsr.h
deleted file mode 100644 (file)
index ad1bf66..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * UsbIsr.h
- *
- * USB ISR routines
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC/HID Driver)                |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: UsbIsr.h, File Version 1.00 2009/12/03                             |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2008/09/03   born                                             |
-|  RSTO         2008/12/23   enhancements of CDC API                          |
-+----------------------------------------------------------------------------*/
-
-#ifndef _ISR_H_
-#define _ISR_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/**
-Handle incoming setup packet.
-returns TRUE to keep CPU awake
-*/
-BYTE SetupPacketInterruptHandler(VOID);
-
-/**
-Handle VBuss on signal.
-*/
-VOID PWRVBUSonHandler(VOID);
-
-/**
-Handle VBuss off signal.
-*/
-VOID PWRVBUSoffHandler(VOID);
-
-/**
-Handle In-requests from control pipe.
-*/
-VOID IEP0InterruptHandler(VOID);
-
-/**
-Handle Out-requests from control pipe.
-*/
-VOID OEP0InterruptHandler(VOID);
-
-/*----------------------------------------------------------------------------+
-| End of header file                                                          |
-+----------------------------------------------------------------------------*/
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _ISR_H_ */
-
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_Common/defMSP430USB.h b/USB_API/USB_Common/defMSP430USB.h
deleted file mode 100644 (file)
index e3364f7..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * defMSP430USB.h
- *
- * Contains USB Constants, Type Definitions & Macros
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC/HID Driver)                |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: defMSP430USB.h, File Version 1.00 2009/12/03                       |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  Description:                                                               |
-|  Contains USB Constants, Type Definitions & Macros                          |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2008/09/03   born                                             |
-|  MSP,Biju     2009/10/21   Changes for composite support                    |
-|  MSP,Biju     2009/12/03   file versioning started                          |
-+----------------------------------------------------------------------------*/
-
-#ifndef _defMSP430USB_H
-#define _defMSP430USB_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*----------------------------------------------------------------------------+
-| Constant Definitions                                                        |
-+----------------------------------------------------------------------------*/
-#define YES         1
-#define NO          0
-
-#define TRUE        1
-#define FALSE       0
-
-#define NOERR       0
-#define ERR         1
-
-#define NO_ERROR    0
-#define ERROR       1
-
-#define DISABLE     0
-#define ENABLE      1
-
-
-/*----------------------------------------------------------------------------+
-| USB Constants, Type Definition & Macro                                      |
-+----------------------------------------------------------------------------*/
-
-// USB related Constant
-#define MAX_ENDPOINT_NUMBER     0x07    // A maximum of 7 endpoints is available
-#define EP0_MAX_PACKET_SIZE     0x08
-#define EP0_PACKET_SIZE         0x08
-#define EP_MAX_PACKET_SIZE      0x40
-
-// Base addresses of transmit and receive buffers
-#define OEP1_X_BUFFER_ADDRESS   0x1C00  // Input  Endpoint 1 X Buffer Base-address
-#define OEP1_Y_BUFFER_ADDRESS   0x1C40  // Input  Endpoint 1 Y Buffer Base-address
-#define IEP1_X_BUFFER_ADDRESS   0x1C80  // Output Endpoint 1 X Buffer Base-address
-#define IEP1_Y_BUFFER_ADDRESS   0x1CC0  // Output Endpoint 1 Y Buffer Base-address
-
-#define OEP2_X_BUFFER_ADDRESS   0x1D00  // Input  Endpoint 2 X Buffer Base-address
-#define OEP2_Y_BUFFER_ADDRESS   0x1D40  // Input  Endpoint 2 Y Buffer Base-address
-#define IEP2_X_BUFFER_ADDRESS   0x1D80  // Output Endpoint 2 X Buffer Base-address
-#define IEP2_Y_BUFFER_ADDRESS   0x1DC0  // Output Endpoint 2 Y Buffer Base-address
-
-#define OEP3_X_BUFFER_ADDRESS   0x1E00  // Input  Endpoint 2 X Buffer Base-address
-#define OEP3_Y_BUFFER_ADDRESS   0x1E40  // Input  Endpoint 2 Y Buffer Base-address
-#define IEP3_X_BUFFER_ADDRESS   0x1E80  // Output Endpoint 2 X Buffer Base-address
-#define IEP3_Y_BUFFER_ADDRESS   0x1EC0  // Output Endpoint 2 Y Buffer Base-address
-
-#define OEP4_X_BUFFER_ADDRESS   0x1F00  // Input  Endpoint 2 X Buffer Base-address
-#define OEP4_Y_BUFFER_ADDRESS   0x1F40  // Input  Endpoint 2 Y Buffer Base-address
-#define IEP4_X_BUFFER_ADDRESS   0x1F80  // Output Endpoint 2 X Buffer Base-address
-#define IEP4_Y_BUFFER_ADDRESS   0x1FC0  // Output Endpoint 2 Y Buffer Base-address
-
-#define OEP5_X_BUFFER_ADDRESS   0x2000  // Input  Endpoint 2 X Buffer Base-address
-#define OEP5_Y_BUFFER_ADDRESS   0x2040  // Input  Endpoint 2 Y Buffer Base-address
-#define IEP5_X_BUFFER_ADDRESS   0x2080  // Output Endpoint 2 X Buffer Base-address
-#define IEP5_Y_BUFFER_ADDRESS   0x20C0  // Output Endpoint 2 Y Buffer Base-address
-
-#define OEP6_X_BUFFER_ADDRESS   0x2100  // Input  Endpoint 2 X Buffer Base-address
-#define OEP6_Y_BUFFER_ADDRESS   0x2140  // Input  Endpoint 2 Y Buffer Base-address
-#define IEP6_X_BUFFER_ADDRESS   0x2180  // Output Endpoint 2 X Buffer Base-address
-#define IEP6_Y_BUFFER_ADDRESS   0x21C0  // Output Endpoint 2 Y Buffer Base-address
-
-#define OEP7_X_BUFFER_ADDRESS   0x2200  // Input  Endpoint 2 X Buffer Base-address
-#define OEP7_Y_BUFFER_ADDRESS   0x2240  // Input  Endpoint 2 Y Buffer Base-address
-#define IEP7_X_BUFFER_ADDRESS   0x2280  // Output Endpoint 2 X Buffer Base-address
-#define IEP7_Y_BUFFER_ADDRESS   0x22C0  // Output Endpoint 2 Y Buffer Base-address
-
-#define X_BUFFER 0
-#define Y_BUFFER 1
-
-//Macros for end point numbers
-#define EP1 1
-#define EP2 2
-#define EP3 3
-#define EP4 4
-#define EP5 5
-#define EP6 6
-#define EP7 7
-
-// addresses of pipes for endpoints
-#define EP1_OUT_ADDR          0x01    //address for endpoint 1
-#define EP2_OUT_ADDR          0x02    //address for endpoint 2
-#define EP3_OUT_ADDR          0x03    //address for endpoint 3
-#define EP4_OUT_ADDR          0x04    //address for endpoint 4
-#define EP5_OUT_ADDR          0x05    //address for endpoint 5
-#define EP6_OUT_ADDR          0x06    //address for endpoint 6
-#define EP7_OUT_ADDR          0x07    //address for endpoint 7
-
-//Input end points
-#define EP1_IN_ADDR          0x81    //address for endpoint 1
-#define EP2_IN_ADDR          0x82    //address for endpoint 2
-#define EP3_IN_ADDR          0x83    //address for endpoint 3
-#define EP4_IN_ADDR          0x84    //address for endpoint 4
-#define EP5_IN_ADDR          0x85    //address for endpoint 5
-#define EP6_IN_ADDR          0x86    //address for endpoint 6
-#define EP7_IN_ADDR          0x87    //address for endpoint 7
-
-
-// EDB Data Structure
-typedef struct _tEDB
-{
-    BYTE    bEPCNF;             // Endpoint Configuration
-    BYTE    bEPBBAX;            // Endpoint X Buffer Base Address
-    BYTE    bEPBCTX;            // Endpoint X Buffer byte Count
-    BYTE    bSPARE0;            // no used
-    BYTE    bSPARE1;            // no used
-    BYTE    bEPBBAY;            // Endpoint Y Buffer Base Address
-    BYTE    bEPBCTY;            // Endpoint Y Buffer byte Count
-    BYTE    bEPSIZXY;           // Endpoint XY Buffer Size
-} tEDB, *tpEDB;
-
-typedef struct _tEDB0
-{
-    BYTE    bIEPCNFG;           // Input Endpoint 0 Configuration Register
-    BYTE    bIEPBCNT;           // Input Endpoint 0 Buffer Byte Count
-    BYTE    bOEPCNFG;           // Output Endpoint 0 Configuration Register
-    BYTE    bOEPBCNT;           // Output Endpoint 0 Buffer Byte Count
-} tEDB0, *tpEDB0;
-
-// EndPoint Desciptor Block Bits
-#define EPCNF_USBIE     0x04    // USB Interrupt on Transaction Completion. Set By MCU
-                                // 0:No Interrupt, 1:Interrupt on completion
-#define EPCNF_STALL     0x08    // USB Stall Condition Indication. Set by UBM
-                                // 0: No Stall, 1:USB Install Condition
-#define EPCNF_DBUF      0x10    // Double Buffer Enable. Set by MCU
-                                // 0: Primary Buffer Only(x-buffer only), 1:Toggle Bit Selects Buffer
-
-#define EPCNF_TOGGLE     0x20   // USB Toggle bit. This bit reflects the toggle sequence bit of DATA0 and DATA1.
-
-#define EPCNF_UBME      0x80    // UBM Enable or Disable bit. Set or Clear by MCU.
-                                // 0:UBM can't use this endpoint
-                                // 1:UBM can use this endpoint
-#define EPBCNT_BYTECNT_MASK 0x7F // MASK for Buffer Byte Count
-#define EPBCNT_NAK       0x80    // NAK, 0:No Valid in buffer, 1:Valid packet in buffer
-
-//definitions for MSP430 USB-module
-#define START_OF_USB_BUFFER   0x1C00
-
-// input and output buffers for EP0
-#define USBIEP0BUF 0x2378
-#define USBOEP0BUF 0x2370
-
-#ifdef __cplusplus
-}
-#endif
-#endif    /*_defMSP430USB_H    */
diff --git a/USB_API/USB_Common/device.h b/USB_API/USB_Common/device.h
deleted file mode 100644 (file)
index 498e025..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * device.h
- *
- * Device family definitions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC/HID Driver)                |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: device.h, File Version 1.00 2009/12/03                             |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  Description:                                                               |
-|  This file is included in other source code files                           |
-|  and this only one place to change the included device header               |
-+----------------------------------------------------------------------------*/
-
-#include <msp430.h>
-
-#if defined (__MSP430F6638__) || defined (__MSP430F6637__) || defined (__MSP430F6636__) || \
-       defined (__MSP430F6635__) || defined (__MSP430F6634__) || defined (__MSP430F6633__) || \
-       defined (__MSP430F6632__) || defined (__MSP430F6631__) || defined (__MSP430F6630__) || \
-       defined (__MSP430F5638__) || defined (__MSP430F5637__) || defined (__MSP430F5636__) || \
-       defined (__MSP430F5635__) || defined (__MSP430F5634__) || defined (__MSP430F5633__) || \
-       defined (__MSP430F5632__) || defined (__MSP430F5631__) || defined (__MSP430F5630__) 
-       #define __MSP430F563x_F663x
-#elif defined (__MSP430F5510__) || defined (__MSP430F5509__) || defined (__MSP430F5508__) || \
-       defined (__MSP430F5507__) || defined (__MSP430F5506__) || defined (__MSP430F5505__) || \
-       defined (__MSP430F5504__) || defined (__MSP430F5503__) || defined (__MSP430F5502__) || \
-       defined (__MSP430F5501__) || defined (__MSP430F5500__)
-    #define __MSP430F550x
-#elif defined (__MSP430F5529) || defined (__MSP430F5528__) || defined (__MSP430F5527__) || \
-       defined (__MSP430F5526__) || defined (__MSP430F5525__) || defined (__MSP430F5524__) || \
-       defined (__MSP430F5522__) || defined (__MSP430F5521__) || defined (__MSP430F5519__) || \
-       defined (__MSP430F5517__) || defined (__MSP430F5515__) || defined (__MSP430F5514__) || \
-       defined (__MSP430F5513__)
-    #define __MSP430F552x
-#else
-    #error Define a constant of format __MSP430Fxxxx__ within the projects preprocessor settings,
-    according to the device being used.
-#endif
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_Common/dma.c b/USB_API/USB_Common/dma.c
deleted file mode 100644 (file)
index 3f9c8d0..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * dma.c
- *
- * DMA transfer functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (HID/CDC Driver)                |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: dma.c, File Version 1.02 2009/12/03                                |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2009/03/03   born                                             |
-|  RSTO         2009/04/08   Redefine memcpy()                                |
-|  RSTO         2009/04/16   use 16 bit access to DMA regs                    |
-|  RSTO         2009/09/18   fixed trigger selection for DMA with bit set     |
-|  RSTO         2009/11/03   do not transfer via DMA if length is zero        |
-|  MSP,Biju     2009/12/03   Review comments addressed, file versioning       |
-|                            started                                          |
-|  RSTO         2010/01/08   added support for large mem model                |
-+----------------------------------------------------------------------------*/
-
-#include "../USB_Common/device.h"
-#include "../USB_Common/types.h"              // Basic Type declarations
-#include "../USB_Common/defMSP430USB.h"
-#include <descriptors.h>
-#include <string.h>
-
-#ifdef __REGISTER_MODEL__
-/* for IAR */
-#      if __REGISTER_MODEL__ == __REGISTER_MODEL_REG20__
-#              define __DMA_ACCESS_REG__ (void __data20 *)
-#      else
-#              define __DMA_ACCESS_REG__ (unsigned short)
-#      endif
-#else
-/* for CCS */
-#      define __DMA_ACCESS_REG__ (__SFR_FARPTR)(unsigned long)
-#endif
-
-//function pointers
-VOID *(*USB_TX_memcpy)(VOID * dest, const VOID * source, size_t count);
-VOID *(*USB_RX_memcpy)(VOID * dest, const VOID * source, size_t count);
-
-VOID * memcpyDMA0(VOID * dest, const VOID * source, size_t count);
-VOID * memcpyDMA1(VOID * dest, const VOID * source, size_t count);
-VOID * memcpyDMA2(VOID * dest, const VOID * source, size_t count);
-
-// NOTE: this functin works only with data in the area <64k (small memory model)
-VOID * memcpyV(VOID * dest, const VOID * source, size_t count)
-{
-    WORD i;
-    volatile BYTE bTmp;
-    for (i=0; i<count; i++)
-    {
-        bTmp = *((BYTE*)source +i);
-        *((BYTE*)dest  +i) = bTmp;
-    }
-    return dest;
-}
-
-//this function inits the DMA
-VOID USB_initMemcpy(VOID)
-{
-    USB_TX_memcpy = memcpyV;
-    USB_RX_memcpy = memcpyV;
-
-    switch (USB_DMA_CHAN)
-    {
-    case 0:
-        DMACTL0 &= ~DMA0TSEL_31;         // DMA0 is triggered by DMAREQ
-        DMACTL0 |= DMA0TSEL_0;           // DMA0 is triggered by DMAREQ
-        DMA0CTL = (DMADT_1 + DMASBDB + DMASRCINCR_3 +   // configure block transfer (byte-wise) with increasing source
-                       DMADSTINCR_3 );                  // and destination address
-        DMACTL4 |= ENNMI;               // enable NMI interrupt
-        USB_TX_memcpy = memcpyDMA0;
-        USB_RX_memcpy = memcpyDMA0;
-        break;
-    case 1:
-        DMACTL0 &= ~DMA1TSEL_31;         // DMA1 is triggered by DMAREQ
-        DMACTL0 |= DMA1TSEL_0;           // DMA1 is triggered by DMAREQ
-        DMA1CTL = (DMADT_1 + DMASBDB + DMASRCINCR_3 +   // configure block transfer (byte-wise) with increasing source
-                       DMADSTINCR_3 );                  // and destination address
-        DMACTL4 |= ENNMI;               // enable NMI interrupt
-        USB_TX_memcpy = memcpyDMA1;
-        USB_RX_memcpy = memcpyDMA1;
-        break;
-    case 2:
-       DMACTL0 &= ~DMA2TSEL_31;         // DMA2 is triggered by DMAREQ
-       DMACTL0 |= DMA2TSEL_0;           // DMA2 is triggered by DMAREQ
-       DMA2CTL = (DMADT_1 + DMASBDB + DMASRCINCR_3 +   // configure block transfer (byte-wise) with increasing source
-                       DMADSTINCR_3 );                 // and destination address
-       DMACTL4 |= ENNMI;               // enable NMI interrupt
-       USB_TX_memcpy = memcpyDMA2;
-       USB_RX_memcpy = memcpyDMA2;
-       break;
-    }
-}
-
-// this functions starts DMA transfer to/from USB memory into/from RAM
-// Using DMA0
-// Support only for data in <64k memory area.
-VOID * memcpyDMA0(VOID * dest, const VOID *  source, size_t count)
-{
-    if (count == 0)         // do nothing if zero bytes to transfer
-    {
-        return dest;
-    }
-
-    DMA0DA = __DMA_ACCESS_REG__ dest;   // set destination for DMAx
-    DMA0SA = __DMA_ACCESS_REG__ source; // set source for DMAx
-    DMA0SZ = count;         // how many bytes to transfer
-
-    DMA0CTL |= DMAEN;       // enable DMAx
-    DMA0CTL |= DMAREQ;      // trigger DMAx
-
-    //wait for DMA transfer finished
-    while (!(DMA0CTL & DMAIFG));
-
-    DMA0CTL &= ~DMAEN;      // disable DMAx
-    return dest;
-}
-
-// this functions starts DMA transfer to/from USB memory into/from RAM
-// Using DMA1
-// Support only for data in <64k memory area.
-VOID * memcpyDMA1(VOID * dest, const VOID * source, size_t count)
-{
-    if (count == 0)         // do nothing if zero bytes to transfer
-    {
-        return dest;
-    }
-
-    DMA1DA = __DMA_ACCESS_REG__ dest;   // set destination for DMAx
-    DMA1SA = __DMA_ACCESS_REG__ source; // set source for DMAx
-    DMA1SZ = count;         // how many bytes to transfer
-
-    DMA1CTL |= DMAEN;       // enable DMAx
-    DMA1CTL |= DMAREQ;      // trigger DMAx
-
-    //wait for DMA transfer finished
-    while (!(DMA1CTL & DMAIFG));
-
-    DMA1CTL &= ~DMAEN;      // disable DMAx
-    return dest;
-}
-
-// this functions starts DMA transfer to/from USB memory into/from RAM
-// Using DMA2
-// Support only for data in <64k memory area.
-VOID * memcpyDMA2(VOID * dest, const VOID * source, size_t count)
-{
-    if (count == 0)         // do nothing if zero bytes to transfer
-    {
-        return dest;
-    }
-
-    DMA2DA = __DMA_ACCESS_REG__ dest;   // set destination for DMAx
-    DMA2SA = __DMA_ACCESS_REG__ source; // set source for DMAx
-    DMA2SZ = count;         // how many bytes to transfer
-
-    DMA2CTL |= DMAEN;       // enable DMAx
-    DMA2CTL |= DMAREQ;      // trigger DMAx
-
-    //wait for DMA transfer finished
-    while (!(DMA2CTL & DMAIFG));
-
-    DMA2CTL &= ~DMAEN;      // disable DMAx
-    return dest;
-}
-
-/*----------------------------------------------------------------------------+
-| End of source file                                                          |
-+----------------------------------------------------------------------------*/
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_Common/types.h b/USB_API/USB_Common/types.h
deleted file mode 100644 (file)
index 9feec5c..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * types.h
- *
- * Type definitions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
- /*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC/HID Driver)                |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: types.h, File Version 1.00 2009/12/03                              |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2008/09/03   born                                             |
-|  RSTO         2009/07/17   Define __data16 for CCS                          |
-|                                                                             |
-+----------------------------------------------------------------------------*/
-#ifndef _TYPES_H_
-#define _TYPES_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#ifdef __TI_COMPILER_VERSION__
-#define __no_init
-#define __data16
-#endif
-
-/*----------------------------------------------------------------------------+
-| Include files                                                               |
-+----------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------+
-| Function Prototype                                                          |
-+----------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------+
-| Type Definition & Macro                                                     |
-+----------------------------------------------------------------------------*/
-typedef char            CHAR;
-typedef unsigned char   UCHAR;
-typedef int             INT;
-typedef unsigned int    UINT;
-typedef short           SHORT;
-typedef unsigned short  USHORT;
-typedef long            LONG;
-typedef unsigned long   ULONG;
-typedef void            VOID;
-typedef unsigned long   HANDLE;
-typedef char *          PSTR;
-typedef int             BOOL;
-typedef double          DOUBLE;
-typedef unsigned char   BYTE;
-typedef unsigned char*  PBYTE;
-typedef unsigned int    WORD;
-typedef unsigned long   DWORD;
-typedef unsigned long*  PDWORD;
-
-#define SUCCESS 0
-#define FAILURE 1
-#define VOID void
-
-// DEVICE_REQUEST Structure
-typedef struct _tDEVICE_REQUEST
-{
-    BYTE    bmRequestType;              // See bit definitions below
-    BYTE    bRequest;                   // See value definitions below
-    WORD    wValue;                     // Meaning varies with request type
-    WORD    wIndex;                     // Meaning varies with request type
-    WORD    wLength;                    // Number of bytes of data to transfer
-} tDEVICE_REQUEST, *ptDEVICE_REQUEST;
-
-typedef struct _tDEVICE_REQUEST_COMPARE
-{
-    BYTE    bmRequestType;              // See bit definitions below
-    BYTE    bRequest;                   // See value definitions below
-    BYTE    bValueL;                    // Meaning varies with request type
-    BYTE    bValueH;                    // Meaning varies with request type
-    BYTE    bIndexL;                    // Meaning varies with request type
-    BYTE    bIndexH;                    // Meaning varies with request type
-    BYTE    bLengthL;                   // Number of bytes of data to transfer (LSByte)
-    BYTE    bLengthH;                   // Number of bytes of data to transfer (MSByte)
-    BYTE    bCompareMask;               // MSB is bRequest, if set 1, bRequest should be matched
-    VOID    (*pUsbFunction)(VOID);      // function pointer
-} tDEVICE_REQUEST_COMPARE, *ptDEVICE_REQUEST_COMPARE;
-
-//----------------------------------------------------------------------------
-typedef enum
-{
-    STATUS_ACTION_NOTHING,
-    STATUS_ACTION_DATA_IN,
-    STATUS_ACTION_DATA_OUT
-} tSTATUS_ACTION_LIST;
-
-typedef enum
-{
-    DISABLE,
-    ENABLE
-} tSTATUS_EN_DISABLED;
-
-typedef enum
-{
-    FALSE,
-    TRUE
-} tBOOL;
-
-/*----------------------------------------------------------------------------+
-| Constant Definition                                                         |
-+----------------------------------------------------------------------------*/
-
-
-/*----------------------------------------------------------------------------+
-| End of header file                                                          |
-+----------------------------------------------------------------------------*/
-#ifdef __cplusplus
-}
-#endif
-#endif /* _TYPES_H_ */
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_Common/usb.c b/USB_API/USB_Common/usb.c
deleted file mode 100644 (file)
index eb00906..0000000
+++ /dev/null
@@ -1,1323 +0,0 @@
-/*
- * usb.c
- *
- * Common USB functions
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC/HID Driver)                |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: usb.c, File Version 1.02 2010/06/17                                |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2008/09/03   born                                             |
-|  RSTO         2008/12/23   enhancements of CDC API                          |
-|  RSTO         2009/01/12   enhancements for USB serial number               |
-|  RSTO         2009/05/15   added USB_connectionState()                      |
-|  RSTO         2009/07/17   added __data16 qualifier for USB buffers         |
-|  RSTO         2009/08/04   workaround for PLL start up problem              |
-|  MSP,Biju     2009/10/20   Changes for composite support                    |
-|  RSTO         2009/10/21   updated USB_InitSerialStringDescriptor()         |
-|  RSTO         2009/11/05   updated USB_connectionState()                    |
-|  MSP,Biju     2010/07/15   Updated for MSC                                  |
-+----------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------+
-| Include files                                                               |
-+----------------------------------------------------------------------------*/
-
-#include "../USB_Common/device.h"
-#include "../USB_Common/types.h"              // Basic Type declarations
-#include "../USB_Common/defMSP430USB.h"
-#include "../USB_Common/usb.h"  // USB-specific Data Structures
-#include "../USB_CDC_API/UsbCdc.h"
-#include "../USB_HID_API/UsbHidReq.h"
-#include "../USB_MSC_API/UsbMscScsi.h"
-#include <descriptors.h>
-
-#include <HAL_UCS.h>
-#include <HAL_TLV.h>
-#include <string.h>
-
-/*----------------------------------------------------------------------------+
- | Internal Constant Definition                                               |
- +----------------------------------------------------------------------------*/
-#define NO_MORE_DATA    0xFFFF
-#define EPBCT_NAK       0x80 
-#define EPCNF_TOGLE     0x20
-
-#define DIRECTION_IN   0x80
-#define DIRECTION_OUT  0x00
-
-/*----------------------------------------------------------------------------+
-| Internal Variables                                                          |
-+----------------------------------------------------------------------------*/
-
-static BYTE bConfigurationNumber;      // Set to 1 when USB device has been
-                                // configured, set to 0 when unconfigured
-
-static BYTE bInterfaceNumber;   // interface number
-
-WORD wBytesRemainingOnIEP0;     // For endpoint zero transmitter only
-                                // Holds count of bytes remaining to be
-                                // transmitted by endpoint 0.  A value
-                                // of 0 means that a 0-length data packet
-                                // A value of 0xFFFF means that transfer
-                                // is complete.
-
-WORD wBytesRemainingOnOEP0;     // For endpoint zero transmitter only
-                                // Holds count of bytes remaining to be
-                                // received by endpoint 0.  A value
-                                // of 0 means that a 0-length data packet
-                                // A value of 0xFFFF means that transfer
-                                // is complete.
-
-static PBYTE pbIEP0Buffer;      // A buffer pointer to input end point 0
-                                // Data sent back to host is copied from
-                                // this pointed memory location
-
-static PBYTE pbOEP0Buffer;      // A buffer pointer to output end point 0
-                                // Data sent from host is copied to
-                                // this pointed memory location
-
-static BYTE bHostAskMoreDataThanAvailable=0;
-
-BYTE abUsbRequestReturnData[USB_RETURN_DATA_LENGTH];
-BYTE abUsbRequestIncomingData[USB_RETURN_DATA_LENGTH];
-
-__no_init BYTE abramSerialStringDescriptor[34];
-
-BYTE bStatusAction;
-BYTE bFunctionSuspended=FALSE;  // TRUE if function is suspended
-BYTE bEnumerationStatus = 0;    //is 0 if not enumerated
-
-static BYTE bRemoteWakeup;
-
-WORD wUsbEventMask;             //used by USB_getEnabledEvents() and USB_setEnabledEvents()
-
-#ifdef _MSC_
-extern void USBMSC_reset(void);
-void MscResetData();
-extern BOOL bMcsCommandSupported;  
-extern BOOL isMSCConfigured;
-
-extern BYTE bMscResetRequired;
-#endif
-
-/*----------------------------------------------------------------------------+
-| Global Variables                                                            |
-+----------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------+
-| Hardware Related Structure Definition                                       |
-+----------------------------------------------------------------------------*/
-
-#ifdef __IAR_SYSTEMS_ICC__
-
-#pragma location = 0x2380
-__no_init tDEVICE_REQUEST __data16 tSetupPacket;
-
-#pragma location = 0x0920
-__no_init tEDB0 __data16 tEndPoint0DescriptorBlock;
-
-#pragma location = 0x23C8
-__no_init tEDB __data16 tInputEndPointDescriptorBlock[7];
-
-#pragma location = 0x2388
-__no_init tEDB __data16 tOutputEndPointDescriptorBlock[7];
-
-#pragma location = 0x2378
-__no_init BYTE __data16 abIEP0Buffer[EP0_MAX_PACKET_SIZE];
-
-#pragma location = 0x2370
-__no_init BYTE __data16 abOEP0Buffer[EP0_MAX_PACKET_SIZE];
-
-#pragma location = OEP1_X_BUFFER_ADDRESS
- __no_init BYTE __data16 pbXBufferAddressEp1[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP1_Y_BUFFER_ADDRESS
- __no_init BYTE __data16 pbYBufferAddressEp1[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP1_X_BUFFER_ADDRESS
- __no_init BYTE __data16 pbXBufferAddressEp81[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP1_Y_BUFFER_ADDRESS
- __no_init BYTE __data16 pbYBufferAddressEp81[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP2_X_BUFFER_ADDRESS
- __no_init BYTE __data16 pbXBufferAddressEp2[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP2_Y_BUFFER_ADDRESS
- __no_init BYTE __data16 pbYBufferAddressEp2[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP2_X_BUFFER_ADDRESS
- __no_init BYTE __data16 pbXBufferAddressEp82[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP2_Y_BUFFER_ADDRESS
- __no_init BYTE __data16 pbYBufferAddressEp82[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP3_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp3[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP3_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp3[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP3_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp83[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP3_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp83[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP4_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp4[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP4_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp4[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP4_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp84[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP4_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp84[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP5_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp5[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP5_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp5[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP5_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp85[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP5_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp85[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP6_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp6[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP6_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp6[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP6_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp86[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP6_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp86[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP7_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp7[EP_MAX_PACKET_SIZE];
-
-#pragma location = OEP7_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp7[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP7_X_BUFFER_ADDRESS
-__no_init BYTE __data16 pbXBufferAddressEp87[EP_MAX_PACKET_SIZE];
-
-#pragma location = IEP7_Y_BUFFER_ADDRESS
-__no_init BYTE __data16 pbYBufferAddressEp87[EP_MAX_PACKET_SIZE];
-
-
-
-#endif
-
-#ifdef __TI_COMPILER_VERSION__
-extern __no_init tDEVICE_REQUEST tSetupPacket;
-extern __no_init tEDB0 tEndPoint0DescriptorBlock;
-extern __no_init tEDB tInputEndPointDescriptorBlock[7];
-extern __no_init tEDB tOutputEndPointDescriptorBlock[7];
-extern __no_init BYTE abIEP0Buffer[EP0_MAX_PACKET_SIZE];
-extern __no_init BYTE abOEP0Buffer[EP0_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp1[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp1[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp81[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp81[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp2[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp2[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp82[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp82[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp3[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp3[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp83[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp83[EP_MAX_PACKET_SIZE];
-
-extern __no_init BYTE pbXBufferAddressEp4[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp4[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp84[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp84[EP_MAX_PACKET_SIZE];
-
-extern __no_init BYTE pbXBufferAddressEp5[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp5[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbXBufferAddressEp85[EP_MAX_PACKET_SIZE];
-extern __no_init BYTE pbYBufferAddressEp85[EP_MAX_PACKET_SIZE];
-
-#endif
-
-VOID CdcResetData();
-VOID HidResetData();
-
-VOID USB_InitSerialStringDescriptor(VOID);
-VOID USB_initMemcpy(VOID);
-
-//----------------------------------------------------------------------------
-BYTE USB_init(VOID)
-{
-    WORD bGIE  = __get_SR_register() &GIE;  //save interrupt status
-    // atomic operation - disable interrupts
-    __disable_interrupt();               // Disable global interrupts
-
-    // configuration of USB module
-    USBKEYPID   =     0x9628;            // set KEY and PID to 0x9628 -> access to configuration registers enabled
-
-    USBPHYCTL   =     PUSEL;             // use DP and DM as USB terminals (not needed because an external PHY is connected to port 9)
-
-    USBPWRCTL   =     VUSBEN + SLDOAON; // enable primary and secondary LDO (3.3 and 1.8 V)
-    {
-       volatile unsigned int i;
-       for (i =0; i < USB_MCLK_FREQ/1000*2/10; i++);      // wait some time for LDOs (1ms delay)
-    }
-
-    USBPWRCTL   =   VUSBEN + SLDOAON + VBONIE;  // enable interrupt VBUSon
-    USBKEYPID   =    0x9600;            // access to configuration registers disabled
-
-    //reset events mask
-    wUsbEventMask = 0;
-
-    //init Serial Number
-#if (USB_STR_INDEX_SERNUM != 0)
-    USB_InitSerialStringDescriptor();
-#endif
-
-    // init memcpy() function: DMA or non-DMA
-    USB_initMemcpy();
-#ifdef _MSC_
-    MscResetCtrlLun();
-#endif
-    
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSB_succeed;
-}
-
-//----------------------------------------------------------------------------
-// This function will be compiled only if
-#if (USB_STR_INDEX_SERNUM != 0)
-VOID USB_InitSerialStringDescriptor(VOID)
-{
-    BYTE i,j,hexValue;
-    PBYTE pbSerNum;
-    BYTE bBytes;
-
-    j=1;                   // we start with second byte, first byte (lenght) will be filled later
-    pbSerNum=0;
-    abramSerialStringDescriptor[j++] = DESC_TYPE_STRING;
-
-    // TLV access Function Call
-    Get_TLV_Info(TLV_DIERECORD, 0, (uint8_t *)&bBytes, (uint16_t **)&pbSerNum); //The die record used for serial number
-    if (bBytes == 0)    // no serial number available
-    {
-        // use 00 as serial number = no serial number available
-        abramSerialStringDescriptor[0] = 4;      //length
-        abramSerialStringDescriptor[j++] = 0;    // no serial number available
-        abramSerialStringDescriptor[j++] = 0;    // no serial number available
-    }
-    else
-    {
-        for(i=0; (i<bBytes)&&(i<8); i++,pbSerNum++)
-        {
-            hexValue = (*pbSerNum & 0xF0)>> 4;
-            if(hexValue < 10 ) abramSerialStringDescriptor[j++] = (hexValue + '0');
-            else abramSerialStringDescriptor[j++] = (hexValue + 55);
-            abramSerialStringDescriptor[j++] = 0x00;  // needed for UNI-Code
-
-            hexValue = (*pbSerNum & 0x0F);
-            if(hexValue < 10 ) abramSerialStringDescriptor[j++] = (hexValue + '0');
-            else abramSerialStringDescriptor[j++] = (hexValue + 55);
-            abramSerialStringDescriptor[j++] = 0x00;    // needed for UNI-Code
-        }
-        abramSerialStringDescriptor[0] = i*4 +2;        // calculate the length
-    }
-}
-#endif
-
-//----------------------------------------------------------------------------
-
-BYTE USB_enable()
-{
-    volatile unsigned int i;
-    volatile unsigned int j = 0;
-
-    if (!(USBPWRCTL & USBBGVBV))            // check USB Bandgap and VBUS valid
-    {
-        return kUSB_generalError;
-    }
-
-    if ((USBCNF & USB_EN) &&
-        (USBPLLCTL & UPLLEN))
-    {
-        return kUSB_succeed;                // exit if PLL is already enalbed
-    }    
-    
-    USBKEYPID = 0x9628;                     // set KEY and PID to 0x9628 -> access to configuration registers enabled
-    XT2_Start(XT2DRIVE_3); 
-    USBPLLDIVB = USB_XT_FREQ;               // Settings desired frequency
-
-    USBPLLCTL = UPFDEN + UPLLEN;        // Select XT1 as Ref / Select PLL for USB / Discrim. on, enable PLL
-  
-    //Wait some time till PLL is settled
-    do 
-    {
-        USBPLLIR    =     0x0000;           // make sure no interrupts can occur on PLL-module
-
-#ifdef __MSP430F6638 
-        //wait 1 ms till enable USB
-        for (i =0; i < USB_MCLK_FREQ/1000*1/10; i++);
-#else
-        //wait 1/2 ms till enable USB
-        for (i =0; i < USB_MCLK_FREQ/1000* 1/2 /10; i++);
-#endif
-        
-        if (j++ > 10)
-        {
-            USBKEYPID   =    0x9600;        // access to configuration registers disabled
-            return kUSB_generalError;
-        }
-    }while (USBPLLIR != 0);
-         
-    USBCNF     |=    USB_EN;                // enable USB module
-    USBKEYPID   =    0x9600;                // access to configuration registers disabled
-    return kUSB_succeed;
-}
-
-/*
-Disables the USB module and PLL.
-*/
-BYTE USB_disable(VOID)
-{
-    USBKEYPID = 0x9628;        // set KEY and PID to 0x9628 -> access to configuration registers enabled
-    USBCNF    = 0;             // disable USB module
-    USBPLLCTL &= ~UPLLEN;      // disable PLL
-    USBKEYPID = 0x9600;        // access to configuration registers disabled
-    bEnumerationStatus = 0x00; // device is not enumerated
-    bFunctionSuspended = FALSE;// device is not suspended
-    return kUSB_succeed;
-}
-
-/*
-Enables/disables various USB events.
-*/
-BYTE USB_setEnabledEvents(WORD events)
-{
-    wUsbEventMask = events;
-    return kUSB_succeed;
-}
-
-/*
-Returns which events are enabled and which are disabled.
-*/
-WORD USB_getEnabledEvents()
-{
-    return wUsbEventMask;
-}
-
-/*
-Reset USB-SIE and global variables.
-*/
-BYTE USB_reset()
-{
-    int i;
-    USBKEYPID = 0x9628;                   // set KEY and PID to 0x9628 -> access to configuration registers enabled
-    
-    //reset should be on the bus after this!
-    bEnumerationStatus = 0x00;            // Device not enumerated yet
-    bFunctionSuspended = FALSE;           // Device is not in suspend mode
-    
-    bRemoteWakeup = DISABLE;
-    
-    bConfigurationNumber    = 0x00;       // device unconfigured
-    bInterfaceNumber        = 0x00;
-    
-    // FRSTE handling:
-    // Clear FRSTE in the RESRIFG interrupt service routine before re-configuring USB control registers.
-    // Set FRSTE at the beginning of SUSRIFG, SETUP, IEPIFG.EP0 and OEPIFG.EP0 interrupt service routines. 
-    USBCTL = 0;                           // Function Reset Connection disable (FRSTE)
-    
-    wBytesRemainingOnIEP0   = NO_MORE_DATA;
-    wBytesRemainingOnOEP0   = NO_MORE_DATA;
-    bStatusAction           = STATUS_ACTION_NOTHING;
-    
-    //The address reset normally will be done automatically during bus function reset
-    USBFUNADR   =     0x00;               // reset address of USB device (unconfigured)
-    
-    /* Set settings for EP0 */
-    // NAK both 0 endpoints and enable endpoint 0 interrupt
-    tEndPoint0DescriptorBlock.bIEPBCNT = EPBCNT_NAK;
-    tEndPoint0DescriptorBlock.bOEPBCNT = EPBCNT_NAK;
-    tEndPoint0DescriptorBlock.bIEPCNFG = EPCNF_USBIE | EPCNF_UBME | EPCNF_STALL;    // 8 byte data packet
-    tEndPoint0DescriptorBlock.bOEPCNFG = EPCNF_USBIE | EPCNF_UBME | EPCNF_STALL;    // 8 byte data packet
-    
-    USBOEPIE = USB_OUTEP_INT_EN;
-    USBIEPIE = USB_INEP_INT_EN;    
-        
-    // loop for initialization all of used enpoints
-    for(i=0; i < (CDC_NUM_INTERFACES + HID_NUM_INTERFACES + MSC_NUM_INTERFACES); i++)
-    {               
-        BYTE edbIndex = stUsbHandle[i].edb_Index;
-
-        /* Set settings for IEPx */
-        tInputEndPointDescriptorBlock[edbIndex].bEPCNF   = EPCNF_USBIE | EPCNF_UBME | EPCNF_DBUF; //double buffering
-        tInputEndPointDescriptorBlock[edbIndex].bEPBBAX  = (BYTE)(((stUsbHandle[i].iep_X_Buffer - START_OF_USB_BUFFER) >> 3) & 0x00ff);
-        tInputEndPointDescriptorBlock[edbIndex].bEPBBAY  = (BYTE)(((stUsbHandle[i].iep_Y_Buffer - START_OF_USB_BUFFER) >> 3) & 0x00ff);
-        tInputEndPointDescriptorBlock[edbIndex].bEPBCTX  = EPBCNT_NAK;
-        tInputEndPointDescriptorBlock[edbIndex].bEPBCTY  = EPBCNT_NAK;
-        tInputEndPointDescriptorBlock[edbIndex].bEPSIZXY = MAX_PACKET_SIZE;
-        
-        /* Set settings for OEPx */
-        tOutputEndPointDescriptorBlock[edbIndex].bEPCNF   = EPCNF_USBIE | EPCNF_UBME | EPCNF_DBUF ; //double buffering
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBBAX  = (BYTE)(((stUsbHandle[i].oep_X_Buffer - START_OF_USB_BUFFER) >> 3) & 0x00ff);
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBBAY  = (BYTE)(((stUsbHandle[i].oep_Y_Buffer - START_OF_USB_BUFFER) >> 3) & 0x00ff);
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX  = 0x00;
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY  = 0x00; 
-        tOutputEndPointDescriptorBlock[edbIndex].bEPSIZXY = MAX_PACKET_SIZE; 
-        
-#       ifdef _CDC_        
-        /* Additional interrupt end point for CDC */
-        if(stUsbHandle[i].dev_Class == CDC_CLASS)
-        {
-            // The decriptor tool always generates the managemnet endpoint before the data endpoint  
-            tInputEndPointDescriptorBlock[edbIndex-1].bEPCNF   = EPCNF_USBIE | EPCNF_UBME | EPCNF_DBUF; //double buffering
-            tInputEndPointDescriptorBlock[edbIndex-1].bEPBBAX  = (BYTE)(((stUsbHandle[i].intepEP_X_Buffer - START_OF_USB_BUFFER) >> 3) & 0x00ff);
-            tInputEndPointDescriptorBlock[edbIndex-1].bEPBBAY  = (BYTE)(((stUsbHandle[i].intepEP_Y_Buffer - START_OF_USB_BUFFER) >> 3) & 0x00ff);
-            tInputEndPointDescriptorBlock[edbIndex-1].bEPBCTX  = EPBCNT_NAK;
-            tInputEndPointDescriptorBlock[edbIndex-1].bEPBCTY  = EPBCNT_NAK;
-            tInputEndPointDescriptorBlock[edbIndex-1].bEPSIZXY = MAX_PACKET_SIZE;
-        }
-#       endif        
-    }
-    
-#   ifdef _HID_
-        HidResetData();                     // reset HID specific data structures
-#   endif // _HID_
-
-#   ifdef _MSC_
-        isMSCConfigured = FALSE;
-        USBMSC_reset();
-        MscResetData();
-#   endif
-
-#   ifdef _CDC_
-        CdcResetData();                     // reset CDC specific data structures
-#   endif // _CDC_
-
-    USBCTL = FEN;                       // enable function
-    USBIFG = 0;                         // make sure no interrupts are pending
-
-    USBIE = SETUPIE | RSTRIE | SUSRIE;  // enable USB specific interrupts (setup, reset, suspend)
-    USBKEYPID = 0x9600;                 // access to configuration registers disabled
-    return kUSB_succeed;
-}
-
-/*
-Instruct USB module to make itself available to the PC for connection, by pulling PUR high.
-*/
-BYTE USB_connect()
-{
-    USBKEYPID = 0x9628;   // set KEY and PID to 0x9628 -> access to configuration registers enabled
-    USBCNF |= PUR_EN;     // generate rising edge on DP -> the host enumerates our device as full speed device
-    USBPWRCTL |= VBOFFIE; // enable interrupt VUSBoff
-    USBKEYPID = 0x9600;   // access to configuration registers disabled
-
-    // after this the enumeration may take place
-    __no_operation();
-    __no_operation();
-    __no_operation();
-    __no_operation();
-    __no_operation();
-    __no_operation();
-    __no_operation();
-
-    return kUSB_succeed;
-}
-
-/*
-Force a disconnect from the PC by pulling PUR low.
-*/
-BYTE USB_disconnect()
-{
-    USBKEYPID = 0x9628;     // set KEY and PID to 0x9628 -> access to configuration registers enabled
-    USBCNF &= ~PUR_EN;      // disconnect pull up resistor - logical disconnect from HOST
-    USBPWRCTL &= ~VBOFFIE;  // disable interrupt VUSBoff
-    USBKEYPID = 0x9600;     // access to configuration registers disabled
-    bEnumerationStatus = 0; // not enumerated
-    bFunctionSuspended = FALSE;     // device is not suspended
-    return kUSB_succeed;
-}
-
-/*
-Force a remote wakeup of the USB host.
-*/
-BYTE USB_forceRemoteWakeup()
-{
-    if (bFunctionSuspended == FALSE) // device is not suspended
-    {
-        return kUSB_NotSuspended;
-    }
-    if(bRemoteWakeup == ENABLE)
-    {
-       volatile unsigned int i;
-        USBCTL |= RWUP;             // USB - Device Remote Wakeup Request - this bit is self-cleaned
-        return kUSB_succeed;
-    }
-    return kUSB_generalError;
-}
-
-/*
-Returns the status of the USB connection.
-*/
-BYTE USB_connectionInfo()
-{
-    BYTE retVal = 0;
-    if (USBPWRCTL & USBBGVBV)
-    {
-        retVal |= kUSB_vbusPresent;
-    }
-
-    if (bEnumerationStatus == ENUMERATION_COMPLETE)
-    {
-        retVal |= kUSB_Enumerated;
-    }
-
-    if (USBCNF & PUR_EN)
-    {
-        retVal |= kUSB_purHigh;
-    }
-
-    if (bFunctionSuspended == TRUE)
-    {
-        retVal |= kUSB_suspended;
-    }
-    else
-    {
-        retVal |= kUSB_NotSuspended;
-    }
-    return retVal;
-}
-
-/*
-Returns the state of the USB connection.
-*/
-BYTE USB_connectionState()
-{
-    // If no VBUS present
-    if (!(USBPWRCTL & USBBGVBV))
-    {
-        return ST_USB_DISCONNECTED;
-    }
-
-    // If VBUS present, but PUR is low
-    if ((USBPWRCTL & USBBGVBV)&&(!(USBCNF & PUR_EN)))
-    {
-        return ST_USB_CONNECTED_NO_ENUM;
-    }
-
-    // If VBUS present, PUR is high, and enumeration is complete, and not suspended
-    if ((USBPWRCTL & USBBGVBV) && (USBCNF & PUR_EN)
-        && (bEnumerationStatus == ENUMERATION_COMPLETE)
-        && (!(bFunctionSuspended == TRUE)))
-    {
-        return ST_ENUM_ACTIVE;
-    }
-
-    // If VBUS present, PUR is high, and enumeration is NOT complete, and  suspended
-    if ((USBPWRCTL & USBBGVBV) && (USBCNF & PUR_EN)
-        && (!(bEnumerationStatus == ENUMERATION_COMPLETE))
-        && (bFunctionSuspended == TRUE))
-    {
-        return ST_NOENUM_SUSPENDED;
-    }
-        
-    // If VBUS present, PUR is high, and enumeration is complete, and  suspended
-    if ((USBPWRCTL & USBBGVBV) && (USBCNF & PUR_EN)
-        && (bEnumerationStatus == ENUMERATION_COMPLETE)
-        && (bFunctionSuspended == TRUE))
-    {
-        return ST_ENUM_SUSPENDED;
-    }
-    
-    // If VBUS present, PUR is high, but no enumeration yet
-    if ((USBPWRCTL & USBBGVBV) && (USBCNF & PUR_EN)
-        && (!(bEnumerationStatus == ENUMERATION_COMPLETE)))
-    {
-        return ST_ENUM_IN_PROGRESS;
-    }
-    
-    return ST_ERROR;
-}
-
-//----------------------------------------------------------------------------
-
-BYTE USB_suspend(VOID)
-{
-
-    bFunctionSuspended  = TRUE;
-    USBKEYPID = 0x9628;         // set KEY and PID to 0x9628 -> access to configuration registers enabled
-    USBCTL |= FRSTE;            // Function Reset Connection Enable
-    USBIFG &= ~SUSRIFG;         // clear interrupt flag
-
-    if(USB_DISABLE_XT_SUSPEND)
-    {
-        if (USB_PLL_XT == 2)
-        {
-            USBPLLCTL &= ~UPLLEN;         // disable PLL
-            UCSCTL6   |= XT2OFF;         // disable XT2
-        }
-        else
-        {
-            USBPLLCTL &= ~UPLLEN;           // disable PLL
-            UCSCTL6 |= XT1OFF;
-        }
-    }
-
-    USBIE = RESRIE;             // disable USB specific interrupts (setup, suspend, reset), enable resume.
-                                // If the reset occured during device in suspend, the resume-interrupt will come, after - reset interrupt
-    USBKEYPID = 0x9600;         // access to configuration registers disabled
-
-    return kUSB_succeed;
-}
-
-//----------------------------------------------------------------------------
-
-BYTE USB_resume(VOID)
-{
-    USB_enable();                       // enable PLL
-
-    USBIFG &= ~(RESRIFG | SUSRIFG);     // clear interrupt flags
-    USBIE = SETUPIE | RSTRIE | SUSRIE;  // enable USB specific interrupts (setup, reset, suspend)
-
-    bFunctionSuspended  = FALSE;
-    return kUSB_succeed;
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbStallEndpoint0(VOID)
-{
-    tEndPoint0DescriptorBlock.bIEPCNFG |= EPCNF_STALL;
-    tEndPoint0DescriptorBlock.bOEPCNFG |= EPCNF_STALL;
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbClearOEP0ByteCount(VOID)
-{
-    tEndPoint0DescriptorBlock.bOEPBCNT = 0x00;
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbStallOEP0(VOID)
-{
-    // in standard USB request, there is not control write request with data stage
-    // control write, stall output endpoint 0
-    // wLength should be 0 in all cases
-    tEndPoint0DescriptorBlock.bOEPCNFG |= EPCNF_STALL;
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSendNextPacketOnIEP0(VOID)
-{
-    BYTE bPacketSize,bIndex;
-
-    // First check if there are bytes remaining to be transferred
-    if(wBytesRemainingOnIEP0 != NO_MORE_DATA)
-    {
-        if(wBytesRemainingOnIEP0 > EP0_PACKET_SIZE)
-        {
-            // More bytes are remaining than will fit in one packet
-            // there will be More IN Stage
-            bPacketSize = EP0_PACKET_SIZE;
-            wBytesRemainingOnIEP0 -= EP0_PACKET_SIZE;
-            bStatusAction = STATUS_ACTION_DATA_IN;
-        }
-        else if (wBytesRemainingOnIEP0 < EP0_PACKET_SIZE)
-        {
-            // The remaining data will fit in one packet.
-            // This case will properly handle wBytesRemainingOnIEP0 == 0
-            bPacketSize = (BYTE)wBytesRemainingOnIEP0;
-            wBytesRemainingOnIEP0 = NO_MORE_DATA;        // No more data need to be Txed
-            bStatusAction = STATUS_ACTION_NOTHING;
-        }
-        else
-        {
-            bPacketSize = EP0_PACKET_SIZE;
-            if(bHostAskMoreDataThanAvailable == TRUE)
-            {
-                wBytesRemainingOnIEP0 = 0;
-                bStatusAction = STATUS_ACTION_DATA_IN;
-            }
-            else
-            {
-                wBytesRemainingOnIEP0 = NO_MORE_DATA;
-                bStatusAction = STATUS_ACTION_NOTHING;
-            }
-        }
-
-        for(bIndex=0; bIndex<bPacketSize; bIndex++)
-        {
-            abIEP0Buffer[bIndex] = *pbIEP0Buffer;
-            pbIEP0Buffer++;
-        }
-        tEndPoint0DescriptorBlock.bIEPBCNT = bPacketSize;
-    }
-    else 
-    {
-        bStatusAction = STATUS_ACTION_NOTHING;
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSendDataPacketOnEP0(PBYTE pbBuffer)
-{
-    WORD wTemp;
-
-    pbIEP0Buffer = pbBuffer;
-    wTemp = tSetupPacket.wLength;
-
-    // Limit transfer size to wLength if needed
-    // this prevent USB device sending 'more than require' data back to host
-    if(wBytesRemainingOnIEP0 >= wTemp)
-    {
-        wBytesRemainingOnIEP0 = wTemp;
-        bHostAskMoreDataThanAvailable = FALSE;
-    }
-    else 
-    {
-        bHostAskMoreDataThanAvailable = TRUE;
-    }
-    usbSendNextPacketOnIEP0();
-}
-
-//----------------------------------------------------------------------------
-VOID usbReceiveNextPacketOnOEP0(VOID)
-{
-    BYTE bIndex,bByte;
-
-    bByte = tEndPoint0DescriptorBlock.bOEPBCNT & EPBCNT_BYTECNT_MASK;
-
-    if(wBytesRemainingOnOEP0 >= (WORD)bByte)
-    {
-        for(bIndex=0;bIndex<bByte;bIndex++)
-        {
-            *pbOEP0Buffer = abOEP0Buffer[bIndex];
-            pbOEP0Buffer++;
-        }
-        wBytesRemainingOnOEP0 -= (WORD)bByte;
-
-        // clear the NAK bit for next packet
-        if(wBytesRemainingOnOEP0 > 0)
-        {
-            usbClearOEP0ByteCount();
-            bStatusAction = STATUS_ACTION_DATA_OUT;
-        }
-        else
-        {
-            usbStallOEP0();
-            bStatusAction = STATUS_ACTION_NOTHING;
-        }
-    }
-    else
-    {
-        usbStallOEP0();
-        bStatusAction = STATUS_ACTION_NOTHING;
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbReceiveDataPacketOnEP0(PBYTE pbBuffer)
-{
-
-    pbOEP0Buffer = pbBuffer;
-
-    wBytesRemainingOnOEP0 = tSetupPacket.wLength;
-    bStatusAction = STATUS_ACTION_DATA_OUT;
-
-    usbClearOEP0ByteCount();
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSendZeroLengthPacketOnIEP0(VOID)
-{
-    wBytesRemainingOnIEP0 = NO_MORE_DATA;
-    bStatusAction = STATUS_ACTION_NOTHING;
-    tEndPoint0DescriptorBlock.bIEPBCNT = 0x00;
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbClearEndpointFeature(VOID)
-{
-    BYTE bEndpointNumber;
-
-    // EP is from EP1 to EP7 while C language start from 0
-    bEndpointNumber = (tSetupPacket.wIndex & EP_DESC_ADDR_EP_NUM);
-    if(bEndpointNumber == 0x00) usbSendZeroLengthPacketOnIEP0();
-    else
-    {
-        bEndpointNumber--;   
-        if(bEndpointNumber < MAX_ENDPOINT_NUMBER)
-        {
-            if((tSetupPacket.wIndex & EP_DESC_ADDR_DIR_IN) == EP_DESC_ADDR_DIR_IN)
-            {
-#ifdef _MSC_ 
-                if (!bMscResetRequired) {
-#endif                  
-                  tInputEndPointDescriptorBlock[bEndpointNumber].bEPCNF &= ~(EPCNF_STALL | EPCNF_TOGGLE ); 
-#ifdef _MSC_                  
-                }
-#endif                
-#               ifdef _MSC_                
-                    if (stUsbHandle[MSC0_INTFNUM].edb_Index == bEndpointNumber)
-                    {
-                        MscReadControl.bCurrentBufferXY = 0; //Set current buffer to X
-                        bMcsCommandSupported = TRUE;
-                    }
-#               endif
-            }
-            else
-            {
-#ifdef _MSC_    
-                if (!bMscResetRequired) {
-#endif              
-                    tOutputEndPointDescriptorBlock[bEndpointNumber].bEPCNF &= ~(EPCNF_STALL | EPCNF_TOGGLE );
-#ifdef _MSC_                  
-                }
-#endif 
-#               ifdef _MSC_                                
-                    if (stUsbHandle[MSC0_INTFNUM].edb_Index == bEndpointNumber)
-                    {    
-                        MscWriteControl.bCurrentBufferXY = 0; //Set current buffer to X
-                        bMcsCommandSupported = TRUE;
-                    }
-#               endif                
-            }
-            usbSendZeroLengthPacketOnIEP0();
-        }
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetConfiguration(VOID)
-{
-    usbClearOEP0ByteCount();                    // for status stage
-    wBytesRemainingOnIEP0 = 1;
-    usbSendDataPacketOnEP0((PBYTE)&bConfigurationNumber);
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetDeviceDescriptor(VOID)
-{
-    usbClearOEP0ByteCount();
-    wBytesRemainingOnIEP0 = SIZEOF_DEVICE_DESCRIPTOR;
-    usbSendDataPacketOnEP0((PBYTE) &abromDeviceDescriptor);
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetConfigurationDescriptor(VOID)
-{
-    usbClearOEP0ByteCount();
-    wBytesRemainingOnIEP0 = sizeof(abromConfigurationDescriptorGroup);
-    usbSendDataPacketOnEP0((PBYTE)&abromConfigurationDescriptorGroup);
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetStringDescriptor(VOID)
-{
-    WORD bIndex;
-    BYTE bVal = (BYTE)tSetupPacket.wValue;
-
-    usbClearOEP0ByteCount();                    // for status stage
-#if (USB_STR_INDEX_SERNUM != 0)
-
-    if(bVal == 0x03)
-    {
-        wBytesRemainingOnIEP0 = abramSerialStringDescriptor[0];
-        usbSendDataPacketOnEP0((PBYTE)&abramSerialStringDescriptor);
-    }
-    else
-#endif
-    {
-        bIndex = 0x00;
-        while(bVal-- >  0x00) bIndex += abromStringDescriptor[bIndex];
-        wBytesRemainingOnIEP0 = abromStringDescriptor[bIndex];
-        usbSendDataPacketOnEP0((PBYTE)&abromStringDescriptor[bIndex]);
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetInterface(VOID)
-{
-
-    // not fully supported, return one byte, zero
-    usbClearOEP0ByteCount();                    // for status stage
-    wBytesRemainingOnIEP0 = 0x02;
-    abUsbRequestReturnData[0] = 0x00;           // changed to report alternative setting byte
-    abUsbRequestReturnData[1] = bInterfaceNumber;
-    usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetDeviceStatus(VOID)
-{
-    if((abromConfigurationDescriptorGroup.abromConfigurationDescriptorGenric.mattributes &
-        CFG_DESC_ATTR_SELF_POWERED) == CFG_DESC_ATTR_SELF_POWERED)
-    {
-        abUsbRequestReturnData[0] = DEVICE_STATUS_SELF_POWER;
-    }
-    if(bRemoteWakeup == ENABLE)
-    {
-        abUsbRequestReturnData[0] |= DEVICE_STATUS_REMOTE_WAKEUP;
-    }
-    usbClearOEP0ByteCount();                    // for status stage
-
-    // Return self power status and remote wakeup status
-    wBytesRemainingOnIEP0 = 2;
-    usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetInterfaceStatus(VOID)
-{
-    // check bIndexL for index number (not supported)
-    usbClearOEP0ByteCount();                    // for status stage
-
-    // Return two zero bytes
-    wBytesRemainingOnIEP0 = 2;
-    abUsbRequestReturnData[0] = 0x00;           // changed to support multiple interfaces
-    abUsbRequestReturnData[1] = bInterfaceNumber;
-    usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetEndpointStatus(VOID)
-{
-    BYTE bEndpointNumber;
-
-    // Endpoint number is bIndexL
-    bEndpointNumber = tSetupPacket.wIndex & EP_DESC_ADDR_EP_NUM;
-    if(bEndpointNumber == 0x00)
-    {
-        if((tSetupPacket.wIndex & EP_DESC_ADDR_DIR_IN) == EP_DESC_ADDR_DIR_IN)
-        {
-            // input endpoint 0
-            abUsbRequestReturnData[0] = (BYTE)(tEndPoint0DescriptorBlock.bIEPCNFG & EPCNF_STALL);
-        }
-        else
-        {
-            // output endpoint 0
-            abUsbRequestReturnData[0] = (BYTE)(tEndPoint0DescriptorBlock.bOEPCNFG & EPCNF_STALL);
-        }
-        abUsbRequestReturnData[0] = abUsbRequestReturnData[0] >> 3; // STALL is on bit 3
-        usbClearOEP0ByteCount();                    // for status stage
-        wBytesRemainingOnIEP0 = 0x02;
-        usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);
-    }
-    else
-    {
-        bEndpointNumber--;
-        // EP is from EP1 to EP7 while C language start from 0
-        // Firmware should NOT response if specified endpoint is not supported. (charpter 8)
-        if(bEndpointNumber < MAX_ENDPOINT_NUMBER)
-        {
-            if(tSetupPacket.wIndex & EP_DESC_ADDR_DIR_IN)
-            {
-                // input endpoint
-                abUsbRequestReturnData[0] = (BYTE)(tInputEndPointDescriptorBlock[bEndpointNumber].bEPCNF & EPCNF_STALL);
-            }else
-            {
-                // output endpoint
-                abUsbRequestReturnData[0] = (BYTE)(tOutputEndPointDescriptorBlock[bEndpointNumber].bEPCNF & EPCNF_STALL);
-            }
-        }   // no response if endpoint is not supported.
-        abUsbRequestReturnData[0] = abUsbRequestReturnData[0] >> 3; // STALL is on bit 3
-        usbClearOEP0ByteCount();
-        wBytesRemainingOnIEP0 = 0x02;
-        usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData[0]);
-    }
-}
-
-//----------------------------------------------------------------------------
-VOID usbSetAddress(VOID)
-{
-    usbStallOEP0();                             // control write without data stage
-
-    // bValueL contains device address
-    if(tSetupPacket.wValue < 128)
-    {
-        // hardware will update the address after status stage
-        // therefore, firmware can set the address now.
-        USBFUNADR = tSetupPacket.wValue;
-        usbSendZeroLengthPacketOnIEP0();
-    }
-    else 
-    {
-        usbStallEndpoint0();
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSetConfiguration(VOID)
-{
-    usbStallOEP0();                             // control write without data stage
-
-    // configuration number is in bValueL
-    // change the code if more than one configuration is supported
-    bConfigurationNumber = tSetupPacket.wValue;
-    usbSendZeroLengthPacketOnIEP0();
-
-    if (bConfigurationNumber == 1)
-    {
-        bEnumerationStatus = ENUMERATION_COMPLETE;      // set device as enumerated
-    }
-    else
-    {
-        bEnumerationStatus = 0; //device is not configured == config # is zero
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbClearDeviceFeature(VOID)
-{
-    // bValueL contains feature selector
-    if(tSetupPacket.wValue == FEATURE_REMOTE_WAKEUP)
-    {
-        bRemoteWakeup = DISABLE;
-        usbSendZeroLengthPacketOnIEP0();
-    }
-    else 
-    {
-        usbStallEndpoint0();
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSetDeviceFeature(VOID)
-{
-    // bValueL contains feature selector
-    if(tSetupPacket.wValue == FEATURE_REMOTE_WAKEUP)
-    {
-        bRemoteWakeup = ENABLE;
-        usbSendZeroLengthPacketOnIEP0();
-    }
-    else 
-    {
-        usbStallEndpoint0();
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSetEndpointFeature(VOID)
-{
-    BYTE bEndpointNumber;
-
-    // wValue contains feature selector
-    // bIndexL contains endpoint number
-    // Endpoint number is in low byte of wIndex
-    if(tSetupPacket.wValue == FEATURE_ENDPOINT_STALL)
-    {
-        bEndpointNumber = tSetupPacket.wIndex & EP_DESC_ADDR_EP_NUM;
-        if(bEndpointNumber == 0x00) usbSendZeroLengthPacketOnIEP0();  // do nothing for endpoint 0
-        else
-        {
-            bEndpointNumber--;
-            // Firmware should NOT response if specified endpoint is not supported. (charpter 8)
-            if(bEndpointNumber < MAX_ENDPOINT_NUMBER)
-            {
-                if(tSetupPacket.wIndex & EP_DESC_ADDR_DIR_IN)
-                {
-                    // input endpoint
-                    tInputEndPointDescriptorBlock[bEndpointNumber].bEPCNF |= EPCNF_STALL;
-                }
-                else
-                {
-                    // output endpoint
-                    tOutputEndPointDescriptorBlock[bEndpointNumber].bEPCNF |= EPCNF_STALL;
-                }
-                usbSendZeroLengthPacketOnIEP0();
-            } // no response if endpoint is not supported.
-        }
-    }
-    else 
-    {
-        usbStallEndpoint0();
-    }
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSetInterface(VOID)
-{
-    // bValueL contains alternative setting
-    // bIndexL contains interface number
-    // change code if more than one interface is supported
-    usbStallOEP0();                             // control write without data stage
-    bInterfaceNumber = tSetupPacket.wIndex;
-#ifdef _MSC_
-    tInputEndPointDescriptorBlock[stUsbHandle[MSC0_INTFNUM].edb_Index].bEPCNF &= ~(EPCNF_TOGGLE);
-    tOutputEndPointDescriptorBlock[stUsbHandle[MSC0_INTFNUM].edb_Index].bEPCNF &= ~(EPCNF_TOGGLE);
-    MscReadControl.bCurrentBufferXY = 0; //Set current buffer to X
-    MscWriteControl.bCurrentBufferXY = 0; //Set current buffer to X
-#endif
-    usbSendZeroLengthPacketOnIEP0();
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbInvalidRequest(VOID)
-{
-    // check if setup overwrite is set
-    // if set, do nothing since we might decode it wrong
-    // setup packet buffer could be modified by hardware if another setup packet
-    // was sent while we are deocding setup packet
-    if ((USBIFG & STPOWIFG) == 0x00)
-    {
-      usbStallEndpoint0();
-    }
-}
-
-typedef VOID (*tpF)(VOID);
-
-BYTE usbDecodeAndProcessUsbRequest(VOID)
-{
-    BYTE  bMask,bResult,bTemp;
-    const BYTE* pbUsbRequestList;
-    BYTE bWakeUp = FALSE;
-    ptDEVICE_REQUEST ptSetupPacket = &tSetupPacket;
-    BYTE  bRequestType,bRequest;
-    tpF lAddrOfFunction;
-
-    // point to beginning of the matrix
-    pbUsbRequestList = (PBYTE)&tUsbRequestList[0];
-
-    while(1)
-    {
-        bRequestType = *pbUsbRequestList++;
-        bRequest     = *pbUsbRequestList++;
-
-        if(((bRequestType == 0xff) && (bRequest == 0xff)) ||
-            (tSetupPacket.bmRequestType == (USB_REQ_TYPE_INPUT | USB_REQ_TYPE_VENDOR | USB_REQ_TYPE_DEVICE)) ||
-            (tSetupPacket.bmRequestType == (USB_REQ_TYPE_OUTPUT | USB_REQ_TYPE_VENDOR | USB_REQ_TYPE_DEVICE)))
-        {
-            pbUsbRequestList -= 2;
-            break;
-        }
-
-        if((bRequestType == tSetupPacket.bmRequestType) && (bRequest == tSetupPacket.bRequest))
-        {
-            // compare the first two
-            bResult = 0xc0;
-            bMask   = 0x20;
-            // first two bytes matched, compare the rest
-            for(bTemp = 2; bTemp < 8; bTemp++)
-            {
-                if (*((BYTE*)ptSetupPacket + bTemp) == *pbUsbRequestList)
-                {
-                    bResult |= bMask;
-                }
-                pbUsbRequestList++;
-                bMask = bMask >> 1;
-            }
-            // now we have the result
-            if((*pbUsbRequestList & bResult) == *pbUsbRequestList)
-            {
-                pbUsbRequestList -= 8;
-                break;
-            }
-            else
-            {
-                pbUsbRequestList += (sizeof(tDEVICE_REQUEST_COMPARE)-8);
-            }
-        }
-        else
-        {
-            pbUsbRequestList += (sizeof(tDEVICE_REQUEST_COMPARE)-2);
-        }
-    }
-
-    // if another setup packet comes before we have the chance to process current
-    // setup request, we return here without processing the request
-    // this check is not necessary but still kept here to reduce response(or simulation) time
-
-    if((USBIFG & STPOWIFG) != 0x00)
-    {
-        return bWakeUp;
-    }
-
-    // now we found the match and jump to the function accordingly.
-    lAddrOfFunction = ((tDEVICE_REQUEST_COMPARE*)pbUsbRequestList)->pUsbFunction;
-
-    // call function
-    (*lAddrOfFunction)();
-    
-    // perform enumeration complete event:
-    // when SetAddress was called and USBADDR is not zero
-    if ((lAddrOfFunction == &usbSetAddress) && (USBFUNADR != 0))
-    {
-        bWakeUp = USB_handleEnumCompleteEvent();
-    }
-    return bWakeUp;
-}
-
-/*----------------------------------------------------------------------------+
-| End of source file                                                          |
-+----------------------------------------------------------------------------*/
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_Common/usb.h b/USB_API/USB_Common/usb.h
deleted file mode 100644 (file)
index 68e50e7..0000000
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * usb.h
- *
- * Common USB functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (CDC/HID/MSC Driver)            |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: Usb.h, File Version 1.04 2010/10/30                                |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2008/09/03   born                                             |
-|  RSTO         2008/12/23   enhancements of CDC API                          |
-|  RSTO         2009/05/15   changed USB_connectionStatus()                   |
-|                            to USB_connectionInfo()                          |
-|  RSTO         2009/05/26   remove kUSB_failedEnumEvent                      |
-|  RSTO         2009/07/17   added __data16 qualifier for USB buffers         |
-|  MSP,Biju     2009/10/20   Composite support changes                        |
-|  RSTO         2009/11/05   added event ST_NOENUM_SUSPENDED                  |
-|  MSP,Biju     2009/12/28   macros DESC_TYPE_IAD added due to IAD            |
-|                            support                                          |
-|  RSTO         2010/10/30   added kUSB_allXXXEvents                          |
-+----------------------------------------------------------------------------*/
-
-#ifndef _USB_H_
-#define _USB_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*----------------------------------------------------------------------------+
-| Constant Definition                                                         |
-+----------------------------------------------------------------------------*/
-#define USB_RETURN_DATA_LENGTH  8
-#define SIZEOF_DEVICE_REQUEST   0x08
-
-//  Bit definitions for DEVICE_REQUEST.bmRequestType
-//  Bit 7:   Data direction
-#define USB_REQ_TYPE_OUTPUT     0x00    // 0 = Host sending data to device
-#define USB_REQ_TYPE_INPUT      0x80    // 1 = Device sending data to host
-
-//  Bit 6-5: Type
-#define USB_REQ_TYPE_MASK       0x60    // Mask value for bits 6-5
-#define USB_REQ_TYPE_STANDARD   0x00    // 00 = Standard USB request
-#define USB_REQ_TYPE_CLASS      0x20    // 01 = Class specific
-#define USB_REQ_TYPE_VENDOR     0x40    // 10 = Vendor specific
-
-//  Bit 4-0: Recipient
-#define USB_REQ_TYPE_RECIP_MASK 0x1F    // Mask value for bits 4-0
-#define USB_REQ_TYPE_DEVICE     0x00    // 00000 = Device
-#define USB_REQ_TYPE_INTERFACE  0x01    // 00001 = Interface
-#define USB_REQ_TYPE_ENDPOINT   0x02    // 00010 = Endpoint
-#define USB_REQ_TYPE_OTHER      0x03    // 00011 = Other
-
-//  Values for DEVICE_REQUEST.bRequest
-// Standard Device Requests
-#define USB_REQ_GET_STATUS              0
-#define USB_REQ_CLEAR_FEATURE           1
-#define USB_REQ_SET_FEATURE             3
-#define USB_REQ_SET_ADDRESS             5
-#define USB_REQ_GET_DESCRIPTOR          6
-#define USB_REQ_SET_DESCRIPTOR          7
-#define USB_REQ_GET_CONFIGURATION       8
-#define USB_REQ_SET_CONFIGURATION       9
-#define USB_REQ_GET_INTERFACE           10
-#define USB_REQ_SET_INTERFACE           11
-#define USB_REQ_SYNCH_FRAME             12
-
-// CDC CLASS Requests
-#define USB_CDC_GET_LINE_CODING         0x21
-#define USB_CDC_SET_LINE_CODING         0x20
-#define USB_CDC_SET_CONTROL_LINE_STATE  0x22
-
-// HID CLASS Requests
-#define USB_HID_REQ                     0x81
-#define USB_REQ_GET_REPORT                     0x01
-#define USB_REQ_GET_IDLE                       0x02
-#define USB_REQ_SET_REPORT                     0x09
-#define USB_REQ_SET_IDLE                       0x0A
-#define USB_REQ_SET_PROTOCOL            0x0B
-#define USB_REQ_GET_PROTOCOL            0x03
-
-// MSC CLASS Requests
-#define USB_MSC_RESET_BULK              0xFF
-#define USB_MSC_GET_MAX_LUN             0xFE
-
-//HID Values for HID Report Types (tSetup.bValueH)
-#define USB_REQ_HID_INPUT               0x01
-#define USB_REQ_HID_OUTPUT              0x02
-#define USB_REQ_HID_FEATURE             0x03
-
-
-//  Descriptor Type Values
-#define DESC_TYPE_DEVICE                1       // Device Descriptor (Type 1)
-#define DESC_TYPE_CONFIG                2       // Configuration Descriptor (Type 2)
-#define DESC_TYPE_STRING                3       // String Descriptor (Type 3)
-#define DESC_TYPE_INTERFACE             4       // Interface Descriptor (Type 4)
-#define DESC_TYPE_ENDPOINT              5       // Endpoint Descriptor (Type 5)
-#define DESC_TYPE_DEVICE_QUALIFIER      6       // Endpoint Descriptor (Type 6)
-#define DESC_TYPE_IAD                   0x0B
-#define DESC_TYPE_HUB                   0x29    // Hub Descriptor (Type 6)
-#define DESC_TYPE_HID                          0x21    // HID Descriptor
-#define DESC_TYPE_REPORT                       0x22    // Report Descriptor
-#define DESC_TYPE_PHYSICAL                     0x23    // Physical Descriptor
-
-//  Feature Selector Values
-#define FEATURE_REMOTE_WAKEUP           1       // Remote wakeup (Type 1)
-#define FEATURE_ENDPOINT_STALL          0       // Endpoint stall (Type 0)
-
-// Device Status Values
-#define DEVICE_STATUS_REMOTE_WAKEUP     0x02
-#define DEVICE_STATUS_SELF_POWER        0x01
-
-//  Maximum descriptor size
-#define MAX_DESC_SIZE                   256
-
-//  DEVICE_DESCRIPTOR structure
-#define SIZEOF_DEVICE_DESCRIPTOR        0x12
-#define OFFSET_DEVICE_DESCRIPTOR_VID_L  0x08
-#define OFFSET_DEVICE_DESCRIPTOR_VID_H  0x09
-#define OFFSET_DEVICE_DESCRIPTOR_PID_L  0x0A
-#define OFFSET_DEVICE_DESCRIPTOR_PID_H  0x0B
-#define OFFSET_CONFIG_DESCRIPTOR_POWER  0x07
-#define OFFSET_CONFIG_DESCRIPTOR_CURT   0x08
-
-//  CONFIG_DESCRIPTOR structure
-#define SIZEOF_CONFIG_DESCRIPTOR 0x09
-
-//  HID DESCRIPTOR structure
-//#define SIZEOF_HID_DESCRIPTOR 0x09
-
-//  Bit definitions for CONFIG_DESCRIPTOR.bmAttributes
-#define CFG_DESC_ATTR_SELF_POWERED  0x40    // Bit 6: If set, device is self powered
-#define CFG_DESC_ATTR_BUS_POWERED   0x80    // Bit 7: If set, device is bus powered
-#define CFG_DESC_ATTR_REMOTE_WAKE   0x20    // Bit 5: If set, device supports remote wakeup
-
-//  INTERFACE_DESCRIPTOR structure
-#define SIZEOF_INTERFACE_DESCRIPTOR 0x09
-
-//  ENDPOINT_DESCRIPTOR structure
-#define SIZEOF_ENDPOINT_DESCRIPTOR 0x07
-
-//  Bit definitions for EndpointDescriptor.EndpointAddr
-#define EP_DESC_ADDR_EP_NUM     0x0F    // Bit 3-0: Endpoint number
-#define EP_DESC_ADDR_DIR_IN     0x80    // Bit 7: Direction of endpoint, 1/0 = In/Out
-
-//  Bit definitions for EndpointDescriptor.EndpointFlags
-#define EP_DESC_ATTR_TYPE_MASK  0x03    // Mask value for bits 1-0
-#define EP_DESC_ATTR_TYPE_CONT  0x00    // Bit 1-0: 00 = Endpoint does control transfers
-#define EP_DESC_ATTR_TYPE_ISOC  0x01    // Bit 1-0: 01 = Endpoint does isochronous transfers
-#define EP_DESC_ATTR_TYPE_BULK  0x02    // Bit 1-0: 10 = Endpoint does bulk transfers
-#define EP_DESC_ATTR_TYPE_INT   0x03    // Bit 1-0: 11 = Endpoint does interrupt transfers
-
-// Definition to indicate valid/invalid data
-#define DATA_VALID      1
-#define DATA_INVALID    0
-
-extern __no_init tDEVICE_REQUEST __data16 tSetupPacket;
-extern __no_init BYTE __data16 abIEP0Buffer[];
-extern __no_init BYTE __data16 abOEP0Buffer[];
-extern __no_init BYTE __data16 pbXBufferAddressEp1[];
-extern __no_init BYTE __data16 pbYBufferAddressEp1[];
-extern __no_init BYTE __data16 pbXBufferAddressEp81[];
-extern __no_init BYTE __data16 pbYBufferAddressEp81[];
-extern __no_init BYTE __data16 pbXBufferAddressEp2[];
-extern __no_init BYTE __data16 pbYBufferAddressEp2[];
-extern __no_init BYTE __data16 pbXBufferAddressEp82[];
-extern __no_init BYTE __data16 pbYBufferAddressEp82[];
-
-extern __no_init BYTE __data16 pbXBufferAddressEp3[];
-extern __no_init BYTE __data16 pbYBufferAddressEp3[];
-extern __no_init BYTE __data16 pbXBufferAddressEp83[];
-extern __no_init BYTE __data16 pbYBufferAddressEp83[];
-
-extern __no_init BYTE __data16 pbXBufferAddressEp4[];
-extern __no_init BYTE __data16 pbYBufferAddressEp4[];
-extern __no_init BYTE __data16 pbXBufferAddressEp84[];
-extern __no_init BYTE __data16 pbYBufferAddressEp84[];
-
-extern __no_init BYTE __data16 pbXBufferAddressEp5[];
-extern __no_init BYTE __data16 pbYBufferAddressEp5[];
-extern __no_init BYTE __data16 pbXBufferAddressEp85[];
-extern __no_init BYTE __data16 pbYBufferAddressEp85[];
-
-
-extern __no_init BYTE __data16 pbXBufferAddressEp6[];
-extern __no_init BYTE __data16 pbYBufferAddressEp6[];
-extern __no_init BYTE __data16 pbXBufferAddressEp86[];
-extern __no_init BYTE __data16 pbYBufferAddressEp86[];
-
-extern __no_init BYTE __data16 pbXBufferAddressEp7[];
-extern __no_init BYTE __data16 pbYBufferAddressEp7[];
-extern __no_init BYTE __data16 pbXBufferAddressEp87[];
-extern __no_init BYTE __data16 pbYBufferAddressEp87[];
-
-extern WORD wBytesRemainingOnIEP0;
-extern WORD wBytesRemainingOnOEP0;
-extern BYTE abUsbRequestReturnData[];
-extern BYTE abUsbRequestIncomingData[];
-extern BYTE bEnumerationStatus;
-extern BYTE bFunctionSuspended;
-
-//Function return values
-#define kUSB_succeed        0x00
-#define kUSB_generalError   0x01
-#define kUSB_notEnabled     0x02
-//#define kUSB_VbusNotPresent 0x03
-
-//return values USB_connectionInfo(), USB_connect()
-#define kUSB_vbusPresent    0x01
-#define kUSB_busActive      0x02    // frame sync packets are being received
-#define kUSB_ConnectNoVBUS  0x04
-#define kUSB_suspended      0x08
-#define kUSB_NotSuspended   0x10
-#define kUSB_Enumerated     0x20
-#define kUSB_purHigh        0x40
-
-// Parameters for function USB_setEnabledEvents()
-#define kUSB_clockFaultEvent        0x0001
-#define kUSB_VbusOnEvent            0x0002
-#define kUSB_VbusOffEvent           0x0004
-#define kUSB_UsbResetEvent          0x0008
-#define kUSB_UsbSuspendEvent        0x0010
-#define kUSB_UsbResumeEvent         0x0020
-#define kUSB_dataReceivedEvent      0x0040
-#define kUSB_sendCompletedEvent     0x0080
-#define kUSB_receiveCompletedEvent  0x0100
-#define kUSB_allUsbEvents           0x01FF
-
-// USB connection states
-#define ST_USB_DISCONNECTED         0x80
-#define ST_USB_CONNECTED_NO_ENUM    0x81
-#define ST_ENUM_IN_PROGRESS         0x82
-#define ST_ENUM_ACTIVE              0x83
-#define ST_ENUM_SUSPENDED           0x84
-//#define ST_FAILED_ENUM              0x85
-#define ST_ERROR                    0x86
-#define ST_NOENUM_SUSPENDED         0x87
-
-VOID usbStallInEndpoint(BYTE);
-VOID usbStallOutEndpoint(BYTE);
-VOID usbStallEndpoint(BYTE);
-VOID usbClearOEPByteCount(BYTE);
-
-
-/*----------------------------------------------------------------------------
-These functions can be used in application
-+----------------------------------------------------------------------------*/
-
-/*
-MSP430 USB Module Management functions
-*/
-
-/**
-Init the USB HW interface.
-*/
-BYTE USB_init(VOID);
-
-/**
-Init and start the USB PLL.
-*/
-BYTE USB_enable();
-
-/**
-Disables the USB module and PLL.
-*/
-BYTE USB_disable(VOID);
-
-/*
-Enables/disables various USB events.
-*/
-BYTE USB_setEnabledEvents(WORD events);
-
-/*
-Returns which events are enabled and which are disabled.
-*/
-WORD USB_getEnabledEvents();
-
-/*
-Instruct USB module to make itself available to the PC for connection, by pulling PUR high.
-*/
-BYTE USB_connect();
-
-/*
-Force a disconnect from the PC by pulling PUR low.
-*/
-BYTE USB_disconnect();
-
-/**
-Reset USB-SIE and global variables.
-*/
-BYTE USB_reset();
-
-/**
-Suspend USB.
-*/
-BYTE USB_suspend(VOID);
-
-/**
-Resume USB.
-*/
-BYTE USB_resume(VOID);
-
-/*
-Force a remote wakeup of the USB host.
-       This method can be generated only if device supports
-       remote wake-up feature in some of its configurations.
-       The method wakes-up the USB bus only if wake-up feature is enabled by the host.
-*/
-BYTE USB_forceRemoteWakeup();
-
-/*
-Returns the status of the USB connection.
-*/
-BYTE USB_connectionInfo();
-
-/*
-Returns the state of the USB connection.
-*/
-BYTE USB_connectionState();
-
-/*
-Event-Handling routines
-*/
-
-/*
-If this function gets executed, it's a sign that the output of the USB PLL has failed.
-returns TRUE to keep CPU awake
-*/
-BYTE USB_handleClockEvent();
-
-/*
-If this function gets executed, it indicates that a valid voltage has just been applied to the VBUS pin.
-returns TRUE to keep CPU awake
-*/
-BYTE USB_handleVbusOnEvent();
-
-/*
-If this function gets executed, it indicates that a valid voltage has just been removed from the VBUS pin.
-returns TRUE to keep CPU awake
-*/
-BYTE USB_handleVbusOffEvent();
-
-/*
-If this function gets executed, it indicates that the USB host has issued a USB reset event to the device.
-returns TRUE to keep CPU awake
-*/
-BYTE USB_handleResetEvent();
-
-/*
-If this function gets executed, it indicates that the USB host has chosen to suspend this device after a period of active operation.
-returns TRUE to keep CPU awake
-*/
-BYTE USB_handleSuspendEvent();
-
-/*
-If this function gets executed, it indicates that the USB host has chosen to resume this device after a period of suspended operation.
-returns TRUE to keep CPU awake
-*/
-BYTE USB_handleResumeEvent();
-
-/*
-If this function gets executed, it indicates that the USB host has enumerated this device :
-after host assigned the address to the device. 
-returns TRUE to keep CPU awake
-*/
-BYTE USB_handleEnumCompleteEvent();
-
-/**
-Send stall handshake for in- and out-endpoint0 (control pipe)
-*/
-VOID usbStallEndpoint0(VOID);
-
-/**
-Clear byte counter for endpoint0 (control pipe)
-*/
-VOID usbClearOEP0ByteCount(VOID);
-
-/**
-Send stall handshake for out-endpoint0 (control pipe)
-*/
-VOID usbStallOEP0(VOID);
-
-/**
-Send further data over control pipe if needed.
-       Function is called from control-in IRQ. Do not call from user application
-*/
-VOID usbSendNextPacketOnIEP0(VOID);
-
-/**
-Send data over control pipe to host.
-       Number of bytes to transmit should be set with
-       global varible "wBytesRemainingOnIEP0" before function is called.
-*/
-VOID usbSendDataPacketOnEP0(PBYTE pbBuffer);
-
-/**
-Receive further data from control pipe if needed.
-       Function is called from control-out IRQ. Do not call from user application
-*/
-VOID usbReceiveNextPacketOnOEP0(VOID);
-
-/**
-Receive data from control pipe.
-       Number of bytes to receive should be set with
-       global varible "wBytesRemainingOnOEP0" before function is called.
-*/
-VOID usbReceiveDataPacketOnEP0(PBYTE pbBuffer);
-
-/**
-Send zero length packet on control pipe.
-*/
-VOID usbSendZeroLengthPacketOnIEP0(VOID);
-
-/*Send data to host.*/
-BYTE MscSendData(const BYTE* data, WORD size);
-
-/**
-Decode incoming usb setup packet and call corresponding function
-       usbDecodeAndProcessUsbRequest is called from IRQ. Do not call from user application
-*/
-BYTE usbDecodeAndProcessUsbRequest(VOID);
-VOID usbClearEndpointFeature(VOID);
-VOID usbGetConfiguration(VOID);
-VOID usbGetDeviceDescriptor(VOID);
-VOID usbGetConfigurationDescriptor(VOID);
-VOID usbGetStringDescriptor(VOID);
-VOID usbGetInterface(VOID);
-VOID usbGetDeviceStatus(VOID);
-VOID usbGetEndpointStatus(VOID);
-VOID usbGetInterfaceStatus(VOID);
-VOID usbSetAddress(VOID);
-VOID usbSetConfiguration(VOID);
-VOID usbClearDeviceFeature(VOID);
-VOID usbSetDeviceFeature(VOID);
-VOID usbSetEndpointFeature(VOID);
-VOID usbSetInterface(VOID);
-VOID usbInvalidRequest(VOID);
-
-
-#define ENUMERATION_COMPLETE 0x01
-
-/*----------------------------------------------------------------------------+
-| End of header file                                                          |
-+----------------------------------------------------------------------------*/
-#ifdef __cplusplus
-}
-#endif
-#endif /* _USB_H */
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_HID_API/UsbHid.c b/USB_API/USB_HID_API/UsbHid.c
deleted file mode 100644 (file)
index 0282afb..0000000
+++ /dev/null
@@ -1,932 +0,0 @@
-/*
- * UsbHid.c
- *
- * USB HID send and receive functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (HID Driver)                    |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: UsbHid.c, File Version 1.00 2009/12/03                             |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2009/02/20   ported from CdcHid                               |
-|  RSTO         2009/05/19   updated USBHID_intfStatus()                      |
-|  RSTO         2009/05/26   added USBHID_bytesInUSBBuffer()                  |
-|  RSTO         2009/05/28   changed USBHID_sendData()                        |
-|  RSTO         2009/06/09   updated USBHID_bytesInUSBBuffer()                |
-|  MSP/Biju     2009/10/21   Changes for composite support                    |
-|  RSTO         2009/10/21   move __disable_interrupt() before                |
-|                            checking for suspend                             |
-+----------------------------------------------------------------------------*/
-
-#include "../USB_Common/device.h"
-#include "../USB_Common/types.h"              // Basic Type declarations
-#include "../USB_Common/defMSP430USB.h"
-#include "../USB_Common/usb.h"            // USB-specific Data Structures
-#include "UsbHid.h"
-#include <descriptors.h>
-#include <string.h>
-
-#ifdef _HID_
-
-//function pointers
-extern VOID *(*USB_TX_memcpy)(VOID * dest, const VOID * source, size_t count);
-extern VOID *(*USB_RX_memcpy)(VOID * dest, const VOID * source, size_t count);
-
-// Local Macros 
-#define INTFNUM_OFFSET(X)   (X - HID0_INTFNUM)  // Get the HID offset
-
-static struct _HidWrite
-{
-    WORD nHidBytesToSend;            // holds counter of bytes to be sent
-    WORD nHidBytesToSendLeft;        // holds counter how many bytes is still to be sent
-    const BYTE* pHidBufferToSend;    // holds the buffer with data to be sent
-    BYTE bCurrentBufferXY;           // indicates which buffer is to use next for for write into IN OUT endpoint
-} HidWriteCtrl[HID_NUM_INTERFACES];
-
-static struct _HidRead
-{
-    BYTE *pUserBuffer;     // holds the current position of user's receiving buffer. If NULL- no receiving operation started
-    BYTE *pCurrentEpPos;   // current positon to read of received data from curent EP
-    WORD nBytesToReceive;  // holds how many bytes was requested by receiveData() to receive
-    WORD nBytesToReceiveLeft;        // holds how many bytes is still requested by receiveData() to receive
-    BYTE * pCT1;           // holds current EPBCTxx register
-    BYTE * pCT2;           // holds next EPBCTxx register
-    BYTE * pEP2;           // holds addr of the next EP buffer
-    BYTE nBytesInEp;       // how many received bytes still available in current EP
-    BYTE bCurrentBufferXY; // indicates which buffer is used by host to transmit data via OUT endpoint
-} HidReadCtrl[HID_NUM_INTERFACES];
-
-extern WORD wUsbEventMask;
-
-/*----------------------------------------------------------------------------+
-| Global Variables                                                            |
-+----------------------------------------------------------------------------*/
-
-extern __no_init tEDB __data16 tInputEndPointDescriptorBlock[];
-extern __no_init tEDB __data16 tOutputEndPointDescriptorBlock[];
-
-
-VOID HidCopyUsbToBuff(BYTE* pEP, BYTE* pCT, BYTE);
-
-/*----------------------------------------------------------------------------+
-| Functions' implementatin                                                    |
-+----------------------------------------------------------------------------*/
-
-//resets internal HID data structure
-VOID HidResetData()
-{
-    // indicates which buffer is used by host to transmit data via OUT endpoint3 - X buffer is first
-    //HidReadCtrl[intfIndex].bCurrentBufferXY = X_BUFFER;
-
-    memset(&HidReadCtrl, 0, sizeof(HidReadCtrl));
-    memset(&HidWriteCtrl, 0, sizeof(HidWriteCtrl));
-}
-
-
-/*
-Sends a pre-built report reportData to the host.
-  Returns:  kUSBHID_sendComplete
-            kUSBHID_intfBusyError
-            kUSBCDC_busNotAvailable
-*/
-BYTE USBHID_sendReport(const BYTE * reportData, BYTE intfNum)
-{
-    BYTE byte_count;
-    BYTE * pEP1;
-    BYTE * pCT1;
-    
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-        return kUSBHID_busNotAvailable;
-    }
-
-    if (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER)
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].iep_X_Buffer;
-        pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-    }
-    else
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].iep_Y_Buffer;
-        pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-    }
-
-    byte_count = USBHID_REPORT_LENGTH;  // we support only one length of report
-
-    if(*pCT1 & EPBCNT_NAK)              // if this EP is empty
-    {
-        USB_TX_memcpy(pEP1, reportData, byte_count);  // copy data into IEP X or Y buffer
-        *pCT1 = byte_count;                           // Set counter for usb In-Transaction
-        HidWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1)&0x01; //switch buffer
-        return kUSBHID_sendComplete;
-    }
-    return kUSBHID_intfBusyError;
-}
-
-/*
-Receives report reportData from the host.
-Return:     kUSBHID_receiveCompleted
-            kUSBHID_generalError
-            kUSBCDC_busNotAvailable
-*/
-BYTE USBHID_receiveReport(BYTE * reportData, BYTE intfNum)
-{
-    BYTE ret = kUSBHID_generalError;
-    BYTE nTmp1 = 0;
-
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-        return kUSBHID_busNotAvailable;
-    }
-
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER)  //this is current buffer
-    {
-        if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK) //this buffer has a valid data packet
-        {
-            //this is the active EP buffer
-            //pEP1
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-
-            //second EP buffer
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-            nTmp1 = 1;    //indicate that data is available
-        }
-    }
-    else // Y_BUFFER
-       {
-               if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK)
-               {
-                       //this is the active EP buffer
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-
-                       //second EP buffer
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-                       nTmp1 = 1;    //indicate that data is available
-               }
-       }
-
-    if (nTmp1)
-    {
-        // how many byte we can get from one endpoint buffer
-        nTmp1 = *HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-
-        if(nTmp1 & EPBCNT_NAK)
-        {
-            nTmp1 = nTmp1 &0x7f;            // clear NAK bit
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1; // holds how many valid bytes in the EP buffer
-
-            USB_RX_memcpy(reportData, HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos, nTmp1);
-            //memcpy(reportData, HidReadCtrl.pEP1, nTmp1);
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1) &0x01;
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = 0;
-            *HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = 0;          // clear NAK, EP ready to receive data
-
-            ret = kUSBHID_receiveCompleted;
-        }
-    }
-    return ret;
-}
-
-
-/*
-Sends data over interface intfNum, of size size and starting at address data.
-Returns: kUSBHID_sendStarted
-         kUSBHID_sendComplete
-         kUSBHID_intBusyError
-*/
-BYTE USBHID_sendData(const BYTE* data, WORD size, BYTE intfNum)
-{
-    unsigned short bGIE;
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    if (size == 0)
-    {
-        return kUSBHID_generalError;
-    }
-
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-
-    // atomic operation - disable interrupts
-    __disable_interrupt();               // Disable global interrupts
-
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {        
-        // data can not be read because of USB suspended
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBHID_busNotAvailable;
-    }
-
-    if (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft != 0)
-    {
-        // the USB still sends previous data, we have to wait
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBHID_intfBusyError;
-    }
-
-    //This function generate the USB interrupt. The data will be sent out from interrupt
-
-    HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSend = size;
-    HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft = size;
-    HidWriteCtrl[INTFNUM_OFFSET(intfNum)].pHidBufferToSend = data;
-
-    //trigger Endpoint Interrupt - to start send operation
-    USBIEPIFG |= 1<<(edbIndex+1);   //IEPIFGx;
-
-    __bis_SR_register(bGIE); //restore interrupt status
-
-    return kUSBHID_sendStarted;
-}
-
-//this function is used only by USB interrupt
-BOOL HidToHostFromBuffer(BYTE intfNum)
-{
-    BYTE byte_count, nTmp2;
-    BYTE * pEP1;
-    BYTE * pEP2;
-    BYTE * pCT1;
-    BYTE * pCT2;
-    BYTE bWakeUp = FALSE; // per default we do not wake up after interrupt
-    
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    if (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft == 0)           // do we have somtething to send?
-    {
-
-        HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSend = 0;
-
-        //call event callback function
-        if (wUsbEventMask & kUSB_sendCompletedEvent)
-        {
-            bWakeUp = USBHID_handleSendCompleted(intfNum);
-        }
-        return bWakeUp;
-    }
-
-    if(!(tInputEndPointDescriptorBlock[edbIndex].bEPCNF & EPCNF_TOGGLE))
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].iep_X_Buffer;
-        pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-
-        //second EP buffer
-        pEP2 = (BYTE*)stUsbHandle[intfNum].iep_Y_Buffer;
-        pCT2 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-    }
-    else
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].iep_Y_Buffer;
-        pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-
-        //second EP buffer
-        pEP2 = (BYTE*)stUsbHandle[intfNum].iep_X_Buffer;
-        pCT2 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-    }
-
-    // how many byte we can send over one endpoint buffer
-    //  2 bytes a reserved: [0] - HID Report Descriptor, [1] - count of valid bytes
-    byte_count = (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft > EP_MAX_PACKET_SIZE-2) ? EP_MAX_PACKET_SIZE-2 : HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft;
-    nTmp2 = *pCT1;
-
-    if(nTmp2 & EPBCNT_NAK)
-    {
-        USB_TX_memcpy(pEP1+2, HidWriteCtrl[INTFNUM_OFFSET(intfNum)].pHidBufferToSend, byte_count);  // copy data into IEP3 X or Y buffer
-        pEP1[0] = 0x3F;                                     // set HID report descriptor: 0x3F
-        pEP1[1] = byte_count;                               // set HID report descriptor
-
-        // 64 bytes will be send: we use only one HID report descriptor
-        *pCT1 = 0x40;                                       // Set counter for usb In-Transaction
-
-        HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft -= byte_count;
-        HidWriteCtrl[INTFNUM_OFFSET(intfNum)].pHidBufferToSend += byte_count;        // move buffer pointer
-
-        //try to send data over second buffer
-        nTmp2 = *pCT2;
-        if ((HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft > 0) &&       // do we have more data to send?
-            (nTmp2 & EPBCNT_NAK)) // if the second buffer is free?
-        {
-            // how many byte we can send over one endpoint buffer
-            byte_count = (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft > EP_MAX_PACKET_SIZE-2) ? EP_MAX_PACKET_SIZE-2 : HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft;
-
-            USB_TX_memcpy(pEP2+2, HidWriteCtrl[INTFNUM_OFFSET(intfNum)].pHidBufferToSend, byte_count); // copy data into IEP3 X or Y buffer
-            pEP2[0] = 0x3F;                                 // set HID report descriptor: 0x3F
-            pEP2[1] = byte_count;                           // set byte count of valid data
-
-            // 64 bytes will be send: we use only one HID report descriptor
-            *pCT2 = 0x40;                                   // Set counter for usb In-Transaction
-
-            HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft -= byte_count;
-            HidWriteCtrl[INTFNUM_OFFSET(intfNum)].pHidBufferToSend += byte_count;    // move buffer pointer
-        }
-    }
-    return bWakeUp;
-}
-
-/*
-Aborts an active send operation on interface intfNum.
-Returns the number of bytes that were sent prior to the abort, in size.
-*/
-BYTE USBHID_abortSend(WORD* size, BYTE intfNum)
-{
-    unsigned short bGIE;
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-
-    __disable_interrupt(); //disable interrupts - atomic operation
-
-    *size = (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSend - HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft);
-    HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSend = 0;
-    HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft = 0;
-
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSB_succeed;
-}
-
-// This function copies data from OUT endpoint into user's buffer
-// Arguments:
-//    pEP - pointer to EP to copy from
-//    pCT - pointer to pCT control reg
-//
-VOID HidCopyUsbToBuff(BYTE* pEP, BYTE* pCT,BYTE intfNum)
-{
-    BYTE nCount;
-
-    // how many byte we can get from one endpoint buffer
-    nCount = (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft > HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp) ? HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp : HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft;
-
-    USB_RX_memcpy(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer, pEP, nCount); // copy data from OEPx X or Y buffer
-    HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft -= nCount;
-    HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer += nCount;          // move buffer pointer
-                                                // to read rest of data next time from this place
-
-    if (nCount == HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp)       // all bytes are copied from receive buffer?
-    {
-        //switch current buffer
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1) &0x01;
-
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = 0;
-
-        //clear NAK, EP ready to receive data
-        *pCT = 0;
-    }
-    else
-    {
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp -= nCount;
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = pEP + nCount;
-    }
-}
-
-
-/*
-Receives data over interface intfNum, of size size, into memory starting at address data.
-Returns:
-    kUSBHID_receiveStarted  if the receiving process started.
-    kUSBHID_receiveCompleted  all requested date are received.
-    kUSBHID_receiveInProgress  previous receive opereation is in progress. The requested receive operation can be not started.
-    kUSBHID_generalError  error occurred.
-*/
-BYTE USBHID_receiveData(BYTE* data, WORD size, BYTE intfNum)
-{
-    BYTE nTmp1;
-    unsigned short bGIE;
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-
-    if ((size == 0) ||                          // read size is 0
-        (data == NULL))
-    {
-        return kUSBHID_generalError;
-    }
-
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-
-    // atomic operation - disable interrupts
-    __disable_interrupt();               // Disable global interrupts
-    
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-         __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBHID_busNotAvailable;
-    }
-
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer != NULL)        // receive process already started
-    {
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBHID_receiveInProgress;
-    }
-
-    HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceive = size;         // bytes to receive
-    HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft = size;     // left bytes to receive
-    HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = data;             // set user receive buffer
-
-    //read rest of data from buffer, if any
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > 0)
-    {
-        // copy data from pEP-endpoint into User's buffer
-        HidCopyUsbToBuff(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos, HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1,intfNum);
-
-        if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)     // the Receive opereation is completed
-        {
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;     // no more receiving pending
-            USBHID_handleReceiveCompleted(intfNum);      // call event handler in interrupt context
-            __bis_SR_register(bGIE); //restore interrupt status
-            return kUSBHID_receiveCompleted;    // receive completed
-        }
-
-        // check other EP buffer for data - exchange pCT1 with pCT2
-        if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 == &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX)
-        {
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-        }
-        else
-        {
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-        }
-        nTmp1 = *HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-        //try read data from second buffer
-        if (nTmp1 & EPBCNT_NAK)                 // if the second buffer has received data?
-        {
-            nTmp1 = nTmp1 &0x7f;                // clear NAK bit
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = *(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos+1); // holds how many valid bytes in the EP buffer
-            if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > nTmp1-2)
-            {
-                HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1-2;
-            }
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos += 2;           // here starts user data
-            HidCopyUsbToBuff(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos, HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1,intfNum);
-        }
-
-        if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)     // the Receive opereation is completed
-        {
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;     // no more receiving pending
-            USBHID_handleReceiveCompleted(intfNum);   // call event handler in interrupt context
-            __bis_SR_register(bGIE); //restore interrupt status
-            return kUSBHID_receiveCompleted;    // receive completed
-        }
-    } //read rest of data from buffer, if any
-
-    //read 'fresh' data, if available
-    nTmp1 = 0;
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER)  //this is current buffer
-    {
-        if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK) //this buffer has a valid data packet
-        {
-            //this is the active EP buffer
-            //pEP1
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-
-            //second EP buffer
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-            nTmp1 = 1;    //indicate that data is available
-        }
-    }
-    else // Y_BUFFER
-       {
-               if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK)
-               {
-                       //this is the active EP buffer
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-
-                       //second EP buffer
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-                       HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-                       nTmp1 = 1;    //indicate that data is available
-               }
-       }
-
-    if (nTmp1)
-    {
-        // how many byte we can get from one endpoint buffer
-        nTmp1 = *HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-
-        if(nTmp1 & EPBCNT_NAK)
-        {
-            nTmp1 = nTmp1 &0x7f;                      // clear NAK bit
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = *(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos+1); // holds how many valid bytes in the EP buffer
-            if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > nTmp1-2)
-            {
-                HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1-2;
-            }
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos += 2;           // here starts user data
-            HidCopyUsbToBuff(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCurrentEpPos, HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1,intfNum);
-
-            nTmp1 = *HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-            //try read data from second buffer
-            if ((HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft > 0) &&       // do we have more data to receive?
-                (nTmp1 & EPBCNT_NAK))                 // if the second buffer has received data?
-            {
-                nTmp1 = nTmp1 &0x7f;                  // clear NAK bit
-                HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = *(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2+1); // holds how many valid bytes in the EP buffer
-                if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > nTmp1-2)
-                {
-                    HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1-2;
-                }
-                HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 += 2;                  // here starts user data
-                HidCopyUsbToBuff(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2, HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2,intfNum);
-                HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-            }
-        }
-    }
-
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)     // the Receive opereation is completed
-    {
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;           // no more receiving pending
-        USBHID_handleReceiveCompleted(intfNum);            // call event handler in interrupt context
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBHID_receiveCompleted;
-    }
-
-    //interrupts enable
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSBHID_receiveStarted;
-}
-
-//this function is used only by USB interrupt.
-//It fills user receiving buffer with received data
-BOOL HidToBufferFromHost(BYTE intfNum)
-{
-    BYTE * pEP1;
-    BYTE nTmp1;
-    BYTE bWakeUp = FALSE; // per default we do not wake up after interrupt
-    
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)       // do we have somtething to receive?
-    {
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;             // no more receiving pending
-        return bWakeUp;
-    }
-
-    // No data to receive...
-    if (!((tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX |
-           tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY)
-           & 0x80))
-    {
-        return bWakeUp;
-    }
-
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY == X_BUFFER)   //X is current buffer
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-
-        //second EP buffer
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-    }
-    else
-    {
-        //this is the active EP buffer
-        pEP1 = (BYTE*)stUsbHandle[intfNum].oep_Y_Buffer;
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
-
-        //second EP buffer
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 = (BYTE*)stUsbHandle[intfNum].oep_X_Buffer;
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
-    }
-
-    // how many byte we can get from one endpoint buffer
-    nTmp1 = *HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1;
-
-    if(nTmp1 & EPBCNT_NAK)
-    {
-        nTmp1 = nTmp1 &0x7f;                // clear NAK bit
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = *(pEP1+1); // holds how many valid bytes in the EP buffer
-        if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > nTmp1-2)
-        {
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1-2;
-        }
-        pEP1 += 2;                      // here starts user data
-        HidCopyUsbToBuff(pEP1, HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1,intfNum);
-
-        nTmp1 = *HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-        //try read data from second buffer
-        if ((HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft > 0) &&       // do we have more data to send?
-            (nTmp1 & EPBCNT_NAK))                   // if the second buffer has received data?
-        {
-            nTmp1 = nTmp1 &0x7f;                    // clear NAK bit
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = *(pEP1+1);     // holds how many valid bytes in the EP buffer
-            if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > nTmp1-2) 
-            {
-                HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = nTmp1-2;
-            }
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2 += 2;                              // here starts user data
-            HidCopyUsbToBuff(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2, HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2,intfNum);
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT1 = HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2;
-        }
-    }
-
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0)       // the Receive opereation is completed
-    {
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;             // no more receiving pending
-        if (wUsbEventMask & kUSB_receiveCompletedEvent)
-        {
-            bWakeUp = USBHID_handleReceiveCompleted(intfNum);
-        }
-
-        if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp)                 // Is not read data still available in the EP?
-        {
-            if (wUsbEventMask & kUSB_dataReceivedEvent)
-            {
-                bWakeUp = USBHID_handleDataReceived(intfNum);
-            }
-        }
-    }
-    return bWakeUp;
-}
-
-// helper for USB interrupt handler
-BOOL HidIsReceiveInProgress(BYTE intfNum)
-{
-    return (HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer != NULL);
-}
-
-
-/*
-Aborts an active receive operation on interface intfNum.
-  Returns the number of bytes that were received and transferred
-  to the data location established for this receive operation.
-*/
-BYTE USBHID_abortReceive(WORD* size, BYTE intfNum)
-{
-    unsigned short bGIE;
-    
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    __disable_interrupt(); //disable interrupts - atomic operation
-
-    *size = 0;    //set received bytes count to 0
-
-    //is receive operation underway?
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer)
-    {
-        //how many bytes are already received?
-        *size = HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceive - HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft;
-
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = 0;
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft = 0;
-    }
-
-     //restore interrupt status
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSB_succeed;
-}
-
-/*
-This function rejects payload data that has been received from the host.
-*/
-BYTE USBHID_rejectData(BYTE intfNum)
-{
-    unsigned short bGIE;
-    BYTE edbIndex;
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-
-    //interrupts disable
-    __disable_interrupt();  
-  
-    // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-    if (bFunctionSuspended)
-    {
-        __bis_SR_register(bGIE); //restore interrupt status
-        return kUSBHID_busNotAvailable;
-    }
-
-    //Is receive operation underway?
-    // - do not flush buffers if any operation still active.
-    if (!HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer)
-    {
-        BYTE tmp1 = tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK;
-        BYTE tmp2 = tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK;
-
-        if (tmp1 ^ tmp2) // switch current buffer if any and only ONE of the buffers is full
-        {
-            //switch current buffer
-            HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY = (HidReadCtrl[INTFNUM_OFFSET(intfNum)].bCurrentBufferXY+1) &0x01;
-        }
-
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX = 0;  //flush buffer X
-        tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY = 0;  //flush buffer Y
-        HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp = 0;                     // indicates that no more data available in the EP
-    }
-
-    __bis_SR_register(bGIE); //restore interrupt status
-    return kUSB_succeed;
-}
-
-/*
-This function indicates the status of the interface intfNum.
-  If a send operation is active for this interface,
-  the function also returns the number of bytes that have been transmitted to the host.
-  If a receiver operation is active for this interface, the function also returns
-  the number of bytes that have been received from the host and are waiting at the assigned address.
-
-returns kUSBHID_waitingForSend (indicates that a call to USBHID_SendData()
-  has been made, for which data transfer has not been completed)
-
-returns kUSBHID_waitingForReceive (indicates that a receive operation
-  has been initiated, but not all data has yet been received)
-
-returns kUSBHID_dataWaiting (indicates that data has been received
-  from the host, waiting in the USB receive buffers)
-*/
-BYTE USBHID_intfStatus(BYTE intfNum, WORD* bytesSent, WORD* bytesReceived)
-{
-    BYTE ret = 0;
-       unsigned short bGIE;
-    BYTE edbIndex;
-               
-    *bytesSent = 0;
-    *bytesReceived = 0;
-    
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    __disable_interrupt(); //disable interrupts - atomic operation
-
-    // Is send operation underway?
-    if (HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft != 0)
-    {
-        ret |= kUSBHID_waitingForSend;
-        *bytesSent = HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSend - HidWriteCtrl[INTFNUM_OFFSET(intfNum)].nHidBytesToSendLeft;
-    }
-
-    //Is receive operation underway?
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer != NULL)
-    {
-        ret |= kUSBHID_waitingForReceive;
-        *bytesReceived = HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceive - HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft;
-    }
-    else // not receive operation started
-    {
-        // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
-        if (!bFunctionSuspended)
-        {
-            if((tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK)  | //any of buffers has a valid data packet
-               (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK))
-            {
-                ret |= kUSBHID_dataWaiting;
-            }
-        }
-    }
-
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-        // if suspended or not enumerated  - report no other tasks pending
-        ret = kUSBHID_busNotAvailable;
-    }
-
-     //restore interrupt status
-    __bis_SR_register(bGIE); //restore interrupt status
-
-    return ret;
-}
-
-/*
-Returns how many bytes are in the buffer are received and ready to be read.
-*/
-BYTE USBHID_bytesInUSBBuffer(BYTE intfNum)
-{
-    BYTE bTmp1 = 0;
-    BYTE bTmp2;
-
-    BYTE edbIndex;
-    unsigned short bGIE;
-    
-    bGIE  = (__get_SR_register() &GIE);  //save interrupt status
-    
-    edbIndex = stUsbHandle[intfNum].edb_Index;
-    
-    //interrupts disable
-    __disable_interrupt();
-
-    if ((bFunctionSuspended) ||
-        (bEnumerationStatus != ENUMERATION_COMPLETE))
-    {
-        // if suspended or not enumerated - report 0 bytes available
-       __bis_SR_register(bGIE); //restore interrupt status
-        return 0;
-    }
-
-    if (HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp > 0)         // If a RX operation is underway, part of data may was read of the OEP buffer
-    {
-        bTmp1 = HidReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesInEp;
-        if (*HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 & EPBCNT_NAK) // the next buffer has a valid data packet
-        {
-            bTmp2 = *(HidReadCtrl[INTFNUM_OFFSET(intfNum)].pEP2+1);  // holds how many valid bytes in the EP buffer
-            if (bTmp2 > (*HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 & 0x7F) -2) // check if all data received correctly
-            {
-                bTmp1 += (*HidReadCtrl[INTFNUM_OFFSET(intfNum)].pCT2 & 0x7F) -2;
-            }
-            else
-            {
-                bTmp1 += bTmp2;
-            }
-        }
-    }
-    else
-    {
-        if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & EPBCNT_NAK) //this buffer has a valid data packet
-        {
-            bTmp2 = tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX & 0x7F;
-            bTmp1 = *((BYTE*)stUsbHandle[intfNum].oep_X_Buffer+1);
-            if (bTmp2-2 < bTmp1)       // check if the count (second byte) is valid
-            {
-                bTmp1 = bTmp2 - 2;
-            }
-        }
-        if (tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & EPBCNT_NAK) //this buffer has a valid data packet
-        {
-            bTmp2 = tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY & 0x7F;
-            if (bTmp2-2 > *((BYTE*)stUsbHandle[intfNum].oep_Y_Buffer+1)) // check if the count (second byte) is valid
-            {
-                bTmp1 += *((BYTE*)stUsbHandle[intfNum].oep_Y_Buffer+1);
-            }
-            else
-            {
-                bTmp1 += bTmp2 - 2;
-            }
-        }
-    }
-
-    //interrupts enable
-   __bis_SR_register(bGIE); //restore interrupt status
-    return bTmp1;
-}
-
-#endif //ifdef _HID_
-
-/*----------------------------------------------------------------------------+
-| End of source file                                                          |
-+----------------------------------------------------------------------------*/
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_HID_API/UsbHid.h b/USB_API/USB_HID_API/UsbHid.h
deleted file mode 100644 (file)
index c3de0d8..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * UsbHid.h
- *
- * USB HID send and receive functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (HID Driver)                    |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: UsbHid.h, File Version 1.00 2009/12/03                             |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2009/02/20   portet from UsbCdc.h                             |
-|  RSTO         2009/05/15   added param to USBHID_rejectData()               |
-|  RSTO         2009/05/26   added USBHID_bytesInUSBBuffer()                  |
-+----------------------------------------------------------------------------*/
-#ifndef _UsbHid_H_
-#define _UsbHid_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#define kUSBHID_sendStarted         0x01
-#define kUSBHID_sendComplete        0x02
-#define kUSBHID_intfBusyError       0x03
-#define kUSBHID_receiveStarted      0x04
-#define kUSBHID_receiveCompleted    0x05
-#define kUSBHID_receiveInProgress   0x06
-#define kUSBHID_generalError        0x07
-#define kUSBHID_busNotAvailable     0x08
-
-/*----------------------------------------------------------------------------
-These functions can be used in application
-+----------------------------------------------------------------------------*/
-
-/*
-Sends a pre-built report reportData to the host.
-  Returns:  kUSBHID_sendComplete
-            kUSBHID_intfBusyError
-            kUSBHID_busSuspended
-*/
-BYTE USBHID_sendReport(const BYTE * reportData, BYTE intfNum);
-
-/*
-Receives report reportData from the host.
-Return:     kUSBHID_receiveCompleted
-            kUSBHID_generalError
-            kUSBHID_busSuspended
-*/
-BYTE USBHID_receiveReport(BYTE * reportData, BYTE intfNum);
-
-/*
-Sends data over interface intfNum, of size size and starting at address data.
-  Returns:  kUSBHID_sendStarted
-            kUSBHID_sendComplete
-            kUSBHID_intfBusyError
-*/
-BYTE USBHID_sendData(const BYTE* data, WORD size, BYTE intfNum);
-
-/*
-Receives data over interface intfNum, of size size, into memory starting at address data.
-*/
-BYTE USBHID_receiveData(BYTE* data, WORD size, BYTE intfNum);
-
-/*
-Aborts an active receive operation on interface intfNum.
-  size: the number of bytes that were received and transferred
-  to the data location established for this receive operation.
-*/
-BYTE USBHID_abortReceive(WORD* size, BYTE intfNum);
-
-
-#define kUSBHID_noDataWaiting 1 //returned by USBHID_rejectData() if no data pending
-
-/*
-This function rejects payload data that has been received from the host.
-*/
-BYTE USBHID_rejectData(BYTE intfNum);
-
-/*
-Aborts an active send operation on interface intfNum.  Returns the number of bytes that were sent prior to the abort, in size.
-*/
-BYTE USBHID_abortSend(WORD* size, BYTE intfNum);
-
-
-#define kUSBHID_waitingForSend      0x01
-#define kUSBHID_waitingForReceive   0x02
-#define kUSBHID_dataWaiting         0x04
-#define kUSBHID_busNotAvailable     0x08
-/*
-This function indicates the status of the interface intfNum.
-  If a send operation is active for this interface,
-  the function also returns the number of bytes that have been transmitted to the host.
-  If a receiver operation is active for this interface, the function also returns
-  the number of bytes that have been received from the host and are waiting at the assigned address.
-
-returns kUSBHID_waitingForSend (indicates that a call to USBHID_SendData()
-  has been made, for which data transfer has not been completed)
-
-returns kUSBHID_waitingForReceive (indicates that a receive operation
-  has been initiated, but not all data has yet been received)
-
-returns kUSBHID_dataWaiting (indicates that data has been received
-  from the host, waiting in the USB receive buffers)
-*/
-BYTE USBHID_intfStatus(BYTE intfNum, WORD* bytesSent, WORD* bytesReceived);
-
-/*
-Returns how many bytes are in the buffer are received and ready to be read.
-*/
-BYTE USBHID_bytesInUSBBuffer(BYTE intfNum);
-
-/*----------------------------------------------------------------------------
-Event-Handling routines
-+----------------------------------------------------------------------------*/
-
-/*
-This event indicates that data has been received for port port, but no data receive operation is underway.
-returns TRUE to keep CPU awake
-*/
-BYTE USBHID_handleDataReceived(BYTE intfNum);
-
-/*
-This event indicates that a send operation on port port has just been completed.
-returns TRUE to keep CPU awake
-*/
-BYTE USBHID_handleSendCompleted(BYTE intfNum);
-
-/*
-This event indicates that a receive operation on port port has just been completed.
-returns TRUE to keep CPU awake
-*/
-BYTE USBHID_handleReceiveCompleted(BYTE intfNum);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif //_UsbHid_H_
diff --git a/USB_API/USB_HID_API/UsbHidReportHandler.c b/USB_API/USB_HID_API/UsbHidReportHandler.c
deleted file mode 100644 (file)
index 6e12cf9..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * UsbHidReportHandler.c
- *
- * USB HID functions for Report Handler
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (HID Driver)                    |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: HidReportHandler.c, File Version 1.00 2009/12/03                   |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2009/03/03   born                                             |
-|  RSTO         2009/07/17   added __data16 qualifier for USB buffers         |
-+----------------------------------------------------------------------------*/
-
-#include "../USB_Common/device.h"
-#include "../USB_Common/types.h"              // Basic Type declarations
-#include "../USB_Common/defMSP430USB.h"
-#include "../USB_Common/usb.h"                // USB-specific Data Structures
-#include "UsbHidReportHandler.h"
-#include <descriptors.h>
-
-#ifdef _HID_
-
-extern __no_init tEDB0 __data16 tEndPoint0DescriptorBlock;
-extern __no_init tEDB __data16 tInputEndPointDescriptorBlock[];
-extern __no_init tEDB __data16 tOutputEndPointDescriptorBlock[];
-
-
-//----------------------------------------------------------------------------
-
-VOID Handler_InReport(VOID)
-{
-}
-
-//----------------------------------------------------------------------------
-
-VOID Handler_InFeature(VOID)
-{
-    switch((BYTE)tSetupPacket.wValue)    // tSetupPacket.wValue is contains HID-Report-ID
-    {
-        case 1:
-            // user's specified code...
-            break;
-
-         case 2:
-            // user's specified code...
-            break;
-
-        default:;
-    }
-    usbSendDataPacketOnEP0((PBYTE)&abUsbRequestReturnData);
-}
-
-//----------------------------------------------------------------------------
-
-VOID Handler_OutReport(VOID)
-{
-}
-
-//----------------------------------------------------------------------------
-
-VOID Handler_OutFeature(VOID)
-{
-    switch((BYTE)tSetupPacket.wValue)    // tSetupPacket.wValue is contains HID-Report-ID
-    {
-        case 1:
-            // user's specified code...
-            break;
-
-         case 2:
-            // user's specified code...
-            break;
-
-        default:;
-    }
-}
-
-#endif //_HID_
-/*----------------------------------------------------------------------------+
-| End of source file                                                          |
-+----------------------------------------------------------------------------*/
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_HID_API/UsbHidReportHandler.h b/USB_API/USB_HID_API/UsbHidReportHandler.h
deleted file mode 100644 (file)
index 0e6021b..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * UsbHidReportHandler.h
- *
- * USB HID functions for Report Handler
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (HID Driver)                    |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: HidReportHandler.h, File Version 1.00 2009/12/03                   |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2009/03/03   born                                             |
-+----------------------------------------------------------------------------*/
-
-#ifndef _HidReportHandler_H_
-#define _HidReportHandler_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/**
-Parses setup packet for report id and call function which belongs to report id
-  Called function will generate InReport.
-*/
-VOID Handler_InReport(VOID);
-
-/**
-Parses setup packet for report id and call function which belongs to report id
-Called function will generate InFeatureReport.
-*/
-VOID Handler_InFeature(VOID);
-
-/**
-Parses setup packet for report id and call function which belongs to report id.
-*/
-VOID Handler_OutReport(VOID);
-
-/**
-Parses setup packet for report id and call function which belongs to report id.
-*/
-VOID Handler_OutFeature(VOID);
-
-#ifdef __cplusplus
-}
-#endif
-#endif //_HidReportHandler_H_
diff --git a/USB_API/USB_HID_API/UsbHidReq.c b/USB_API/USB_HID_API/UsbHidReq.c
deleted file mode 100644 (file)
index b444d2f..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * UsbHidReq.c
- *
- * USB HID Request functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*----------------------------------------------------------------------------+
-|                                                                             |
-|                              Texas Instruments                              |
-|                                                                             |
-|                          MSP430 USB-Example (HID Driver)                    |
-|                                                                             |
-+-----------------------------------------------------------------------------+
-|  Source: UsbHidReq.c, File Version 1.00 2009/12/03                          |
-|  Author: RSTO                                                               |
-|                                                                             |
-|  WHO          WHEN         WHAT                                             |
-|  ---          ----------   ------------------------------------------------ |
-|  RSTO         2009/03/03   born                                             |
-|  MSP/Biju     2009/10/21   Changes for composite support                    |
-+----------------------------------------------------------------------------*/
-
-#include "../USB_Common/device.h"
-#include "../USB_Common/types.h"              // Basic Type declarations
-#include "../USB_Common/defMSP430USB.h"
-#include "../USB_Common/usb.h"                // USB-specific Data Structures
-#include "UsbHidReportHandler.h"
-#include <descriptors.h>
-
-#ifdef _HID_
-
-VOID usbClearOEP0ByteCount(VOID);
-VOID usbSendDataPacketOnEP0(PBYTE pbBuffer);
-VOID usbReceiveDataPacketOnEP0(PBYTE pbBuffer);
-
-
-VOID usbGetHidDescriptor(VOID)
-{
-    static BYTE intfNum;
-    if(intfNum >= HID_NUM_INTERFACES)
-    {
-      intfNum = 0;
-    } 
-    usbClearOEP0ByteCount();
-    wBytesRemainingOnIEP0 = 9;
-    usbSendDataPacketOnEP0((PBYTE)&abromConfigurationDescriptorGroup.stHid[intfNum].blength_hid_descriptor);
-    intfNum++;
-}
-
-//----------------------------------------------------------------------------
-VOID usbGetReportDescriptor(VOID)
-{
-    wBytesRemainingOnIEP0 = SIZEOF_REPORT_DESCRIPTOR;
-    usbSendDataPacketOnEP0((PBYTE)&abromReportDescriptor);
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbSetReport(VOID)
-{
-    usbReceiveDataPacketOnEP0((PBYTE) &abUsbRequestIncomingData);     // receive data over EP0 from Host
-}
-
-//----------------------------------------------------------------------------
-
-VOID usbGetReport(VOID)
-{
-    switch((BYTE)tSetupPacket.wValue)
-    {
-       case USB_REQ_HID_FEATURE:
-            Handler_InFeature();
-            break;
-       case USB_REQ_HID_INPUT:
-            Handler_InReport();
-            break;
-       default:;
-    }
-}
-
-#endif //_HID_
-/*----------------------------------------------------------------------------+
-| End of source file                                                          |
-+----------------------------------------------------------------------------*/
-/*------------------------ Nothing Below This Line --------------------------*/
diff --git a/USB_API/USB_HID_API/UsbHidReq.h b/USB_API/USB_HID_API/UsbHidReq.h
deleted file mode 100644 (file)
index 40731d1..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * UsbHidReq.h
- *
- * USB HID Request functions
- *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
- * 
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *