rename tusb_device_is_configured

remove dcd_lpc18xx_lpc43xx.h and dcd_lpc11uxx_lpc13xx move define to hal
This commit is contained in:
hathach
2013-06-04 10:43:58 +07:00
parent a3ed66344d
commit cdc830782f
9 changed files with 90 additions and 179 deletions

View File

@@ -1,64 +0,0 @@
/**************************************************************************/
/*!
@file dcd_lpc11uxx_lpc13xx.h
@author hathach (tinyusb.org)
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2013, hathach (tinyusb.org)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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.
3. Neither the name of the copyright holders 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 ''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 HOLDER 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.
This file is part of the tinyusb stack.
*/
/**************************************************************************/
/** \ingroup TBD
* \defgroup TBD
* \brief TBD
*
* @{
*/
#ifndef _TUSB_DCD_LPC11UXX_LPC13XX_H_
#define _TUSB_DCD_LPC11UXX_LPC13XX_H_
#define NXP_ROMDRIVER_REG_BASE LPC_USB_BASE
#define NXP_ROMDRIVER_FUNCTION_ADDR 0x1FFF1FF8
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* _TUSB_DCD_LPC11UXX_LPC13XX_H_ */
/** @} */

View File

@@ -1,62 +0,0 @@
/**************************************************************************/
/*!
@file dcd_lpc18xx_lpc43xx.h
@author hathach (tinyusb.org)
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2013, hathach (tinyusb.org)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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.
3. Neither the name of the copyright holders 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 ''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 HOLDER 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.
This file is part of the tinyusb stack.
*/
/**************************************************************************/
/** \ingroup TBD
* \defgroup TBD
* \brief TBD
*
* @{
*/
#ifndef _TUSB_DCD_LPC18XX_LPC43XX_H_
#define _TUSB_DCD_LPC18XX_LPC43XX_H_
#ifdef __cplusplus
extern "C" {
#endif
#define NXP_ROMDRIVER_REG_BASE LPC_USB0_BASE // TODO USB1
#define NXP_ROMDRIVER_FUNCTION_ADDR 0x1040011C
#ifdef __cplusplus
}
#endif
#endif /* _TUSB_DCD_LPC18XX_LPC43XX_H_ */
/** @} */

View File

@@ -112,15 +112,12 @@ ErrorCode_t USB_Error_Event (USBD_HANDLE_T hUsb, uint32_t param1)
tusb_error_t dcd_init(void)
{
uint32_t membase = (uint32_t) usb_RomDriver_buffer;
uint32_t memsize = USB_ROM_SIZE;
USBD_API_INIT_PARAM_T usb_param =
{
.usb_reg_base = NXP_ROMDRIVER_REG_BASE,
.max_num_ep = USB_MAX_EP_NUM,
.mem_base = membase,
.mem_size = memsize,
.mem_base = (uint32_t) usb_RomDriver_buffer,
.mem_size = USB_ROM_SIZE,
.USB_Configure_Event = USB_Configure_Event,
.USB_Reset_Event = USB_Reset_Event,
@@ -141,13 +138,13 @@ tusb_error_t dcd_init(void)
ASSERT_INT(LPC_OK, ROM_API->hw->Init(&romdriver_hdl, &desc_core, &usb_param), TUSB_ERROR_FAILED);
// TODO need to confirm the mem_size is reduced by the number of byte used
membase += (memsize - usb_param.mem_size);
memsize = usb_param.mem_size;
// membase += (memsize - usb_param.mem_size);
// memsize = usb_param.mem_size;
return TUSB_ERROR_NONE;
}
bool usb_isConfigured(void)
bool tusb_device_is_configured(void)
{
return usbd_info.state == TUSB_DEVICE_STATE_CONFIGURED;
}

View File

@@ -56,11 +56,9 @@
#define USB_MAX_IF_NUM 8 // maximum interface number supported, should be fixed to 8
#if (MCU == MCU_LPC18XX) || (MCU == MCU_LPC43XX)
#include "dcd_lpc18xx_lpc43xx.h"
#define ROM_API ( * ((USBD_API_T**) NXP_ROMDRIVER_FUNCTION_ADDR) )
#define USB_MAX_EP_NUM 6
#elif (MCU == MCU_LPC13UXX) || (MCU == MCU_LPC11UXX)
#include "dcd_lpc11uxx_lpc13xx.h"
#define ROM_API ( * (*((USBD_API_T***) NXP_ROMDRIVER_FUNCTION_ADDR)) )
#define USB_MAX_EP_NUM 5
#else