Standardize the width of all comment boxes in C files

This commit is contained in:
Gregory Nutt 2015-10-03 07:25:03 -06:00
parent cae0c9a2e3
commit 7ced84c5f0
53 changed files with 3060 additions and 3060 deletions

View file

@ -1,4 +1,4 @@
/*****************************************************************************
/****************************************************************************
* arch/arm/src/armv7-m/up_itm.c
*
* Copyright (c) 2009 - 2013 ARM LIMITED
@ -59,11 +59,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
****************************************************************************/
/*****************************************************************************
/****************************************************************************
* Included Files
*****************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -72,15 +72,15 @@
#include "up_arch.h"
#include "itm.h"
/*****************************************************************************
/****************************************************************************
* Public Data
*****************************************************************************/
****************************************************************************/
/*****************************************************************************
/****************************************************************************
* Public Functions
*****************************************************************************/
****************************************************************************/
/*****************************************************************************
/****************************************************************************
* Name: itm_sendchar
*
* Description:
@ -95,7 +95,7 @@
* Returned Value:
* Character to transmit.
*
*****************************************************************************/
****************************************************************************/
uint32_t itm_sendchar(uint32_t ch)
{
@ -109,7 +109,7 @@ uint32_t itm_sendchar(uint32_t ch)
return ch;
}
/*****************************************************************************
/****************************************************************************
* Name: itm_receivechar
*
* Description:
@ -120,7 +120,7 @@ uint32_t itm_sendchar(uint32_t ch)
* Returned Value:
* Received character or -1 No character pending.
*
*****************************************************************************/
****************************************************************************/
int32_t itm_receivechar(void)
{
@ -135,7 +135,7 @@ int32_t itm_receivechar(void)
return ch;
}
/*****************************************************************************
/****************************************************************************
* Name: itm_checkchar
*
* Description:
@ -148,7 +148,7 @@ int32_t itm_receivechar(void)
* 0 No character available.
* 1 Character available.
*
*****************************************************************************/
****************************************************************************/
int32_t itm_checkchar (void)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_usbdev.c
*
* Copyright (C) 2008-2013 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -61,9 +61,9 @@
#include "up_internal.h"
#include "dm320_usb.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
@ -184,9 +184,9 @@
#define dm320_rqempty(ep) ((ep)->head == NULL)
#define dm320_rqpeek(ep) ((ep)->head)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* A container for a request so that the request make be retained in a list */
@ -262,9 +262,9 @@ struct dm320_epinfo_s
#endif
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Register operations */
@ -342,9 +342,9 @@ static int dm320_wakeup(struct usbdev_s *dev);
static int dm320_selfpowered(struct usbdev_s *dev, bool selfpowered);
static int dm320_pullup(struct usbdev_s *dev, bool enable);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* Endpoint methods */
@ -410,17 +410,17 @@ static const struct dm320_epinfo_s g_epinfo[DM320_NENDPOINTS] =
}
};
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: dm320_getreg8
*
* Description:
* Get the contents of an DM320 8-bit register
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static uint8_t dm320_getreg8(uint32_t addr)
@ -476,13 +476,13 @@ static uint8_t dm320_getreg8(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_getreg16
*
* Description:
* Get the contents of an DM320 16-bit register
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static uint32_t dm320_getreg16(uint32_t addr)
@ -538,13 +538,13 @@ static uint32_t dm320_getreg16(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_getreg32
*
* Description:
* Get the contents of an DM320 32-bit register
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static uint32_t dm320_getreg32(uint32_t addr)
@ -600,13 +600,13 @@ static uint32_t dm320_getreg32(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_putreg8
*
* Description:
* Set the contents of an DM320 8-bit register to a value
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static void dm320_putreg8(uint8_t val, uint32_t addr)
@ -621,13 +621,13 @@ static void dm320_putreg8(uint8_t val, uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_putreg16
*
* Description:
* Set the contents of an DM320 16-bit register to a value
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static void dm320_putreg16(uint16_t val, uint32_t addr)
@ -642,13 +642,13 @@ static void dm320_putreg16(uint16_t val, uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_putreg32
*
* Description:
* Set the contents of an DM320 32-bit register to a value
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static void dm320_putreg32(uint32_t val, uint32_t addr)
@ -663,13 +663,13 @@ static void dm320_putreg32(uint32_t val, uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_rqdequeue
*
* Description:
* Remove a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static FAR struct dm320_req_s *dm320_rqdequeue(FAR struct dm320_ep_s *privep)
{
@ -689,13 +689,13 @@ static FAR struct dm320_req_s *dm320_rqdequeue(FAR struct dm320_ep_s *privep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_rqenqueue
*
* Description:
* Add a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static void dm320_rqenqueue(FAR struct dm320_ep_s *privep,
FAR struct dm320_req_s *req)
@ -713,13 +713,13 @@ static void dm320_rqenqueue(FAR struct dm320_ep_s *privep,
}
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_ep0write
*
* Description:
* Control endpoint write (IN)
*
*******************************************************************************/
****************************************************************************/
static int dm320_ep0write(uint8_t *buf, uint16_t nbytes)
{
@ -748,13 +748,13 @@ static int dm320_ep0write(uint8_t *buf, uint16_t nbytes)
return nwritten;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epwrite
*
* Description:
* Endpoint write (IN)
*
*******************************************************************************/
****************************************************************************/
static int dm320_epwrite(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
{
@ -799,13 +799,13 @@ static int dm320_epwrite(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epread
*
* Description:
* Endpoint read (OUT)
*
*******************************************************************************/
****************************************************************************/
static int dm320_epread(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
{
@ -853,13 +853,13 @@ static int dm320_epread(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_abortrequest
*
* Description:
* Discard a request
*
*******************************************************************************/
****************************************************************************/
static inline void dm320_abortrequest(struct dm320_ep_s *privep,
struct dm320_req_s *privreq,
@ -876,13 +876,13 @@ static inline void dm320_abortrequest(struct dm320_ep_s *privep,
privreq->req.callback(&privep->ep, &privreq->req);
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_reqcomplete
*
* Description:
* Handle termination of a request.
*
*******************************************************************************/
****************************************************************************/
static void dm320_reqcomplete(struct dm320_ep_s *privep, int16_t result)
{
@ -925,7 +925,7 @@ static void dm320_reqcomplete(struct dm320_ep_s *privep, int16_t result)
}
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_wrrequest
*
* Description:
@ -934,7 +934,7 @@ static void dm320_reqcomplete(struct dm320_ep_s *privep, int16_t result)
* Returned Value:
* 0:not finished; 1:completed; <0:error
*
*******************************************************************************/
****************************************************************************/
static int dm320_wrrequest(struct dm320_ep_s *privep)
{
@ -1019,13 +1019,13 @@ static int dm320_wrrequest(struct dm320_ep_s *privep)
return OK; /* Won't get here */
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_rdrequest
*
* Description:
* Receive to the next queued read request
*
*******************************************************************************/
****************************************************************************/
static int dm320_rdrequest(struct dm320_ep_s *privep)
{
@ -1068,13 +1068,13 @@ static int dm320_rdrequest(struct dm320_ep_s *privep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_cancelrequests
*
* Description:
* Cancel all pending requests for an endpoint
*
*******************************************************************************/
****************************************************************************/
static void dm320_cancelrequests(struct dm320_ep_s *privep)
{
@ -1086,14 +1086,14 @@ static void dm320_cancelrequests(struct dm320_ep_s *privep)
}
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epfindbyaddr
*
* Description:
* Find the physical endpoint structure corresponding to a logic endpoint
* address
*
*******************************************************************************/
****************************************************************************/
static struct dm320_ep_s *dm320_epfindbyaddr(struct dm320_usbdev_s *priv,
uint16_t eplog)
@ -1129,13 +1129,13 @@ static struct dm320_ep_s *dm320_epfindbyaddr(struct dm320_usbdev_s *priv,
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_dispatchrequest
*
* Description:
* Provide unhandled setup actions to the class driver
*
*******************************************************************************/
****************************************************************************/
static void dm320_dispatchrequest(struct dm320_usbdev_s *priv,
const struct usb_ctrlreq_s *ctrl)
@ -1156,13 +1156,13 @@ static void dm320_dispatchrequest(struct dm320_usbdev_s *priv,
}
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_ep0setup
*
* Description:
* USB Ctrl EP Setup Event
*
*******************************************************************************/
****************************************************************************/
static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
{
@ -1429,13 +1429,13 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_highestpriinterrupt
*
* Description:
* Part of the USB core controller interrupt handling logic
*
*******************************************************************************/
****************************************************************************/
static inline uint32_t dm320_highestpriinterrupt(int intstatus)
{
@ -1465,13 +1465,13 @@ static inline uint32_t dm320_highestpriinterrupt(int intstatus)
return USB_INT_NOINTERRUPT;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_ctlrinterrupt
*
* Description:
* Handle USB controller core interrupts
*
*******************************************************************************/
****************************************************************************/
static int dm320_ctlrinterrupt(int irq, FAR void *context)
{
@ -1632,13 +1632,13 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_attachinterrupt
*
* Description:
* Attach GIO interrtup handler
*
*******************************************************************************/
****************************************************************************/
static int dm320_attachinterrupt(int irq, FAR void *context)
{
@ -1690,9 +1690,9 @@ static int dm320_attachinterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epreset
*******************************************************************************/
****************************************************************************/
static void dm320_epreset(unsigned int index)
{
@ -1702,13 +1702,13 @@ static void dm320_epreset(unsigned int index)
dm320_putreg8(USB_CSR2_FLFIFO, DM320_USB_CSR2);
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epinitialize
*
* Description:
* Initialize endpoints. This is logically a part of dm320_ctrlinitialize
*
*******************************************************************************/
****************************************************************************/
static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
{
@ -1793,13 +1793,13 @@ static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_ctrlinitialize
*
* Description:
* Initialize the DM320 USB controller for peripheral mode operation .
*
*******************************************************************************/
****************************************************************************/
static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
{
@ -1853,11 +1853,11 @@ static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
dm320_putreg8(USB_EP0_SELECT, DM320_USB_INDEX);
}
/*******************************************************************************
/****************************************************************************
* Endpoint Methods
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: dm320_epconfigure
*
* Description:
@ -1870,7 +1870,7 @@ static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
****************************************************************************/
static int dm320_epconfigure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc,
@ -1886,13 +1886,13 @@ static int dm320_epconfigure(FAR struct usbdev_ep_s *ep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epdisable
*
* Description:
* The endpoint will no longer be used
*
*******************************************************************************/
****************************************************************************/
static int dm320_epdisable(FAR struct usbdev_ep_s *ep)
{
@ -1918,13 +1918,13 @@ static int dm320_epdisable(FAR struct usbdev_ep_s *ep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epallocreq
*
* Description:
* Allocate an I/O request
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_req_s *dm320_epallocreq(FAR struct usbdev_ep_s *ep)
{
@ -1949,13 +1949,13 @@ static FAR struct usbdev_req_s *dm320_epallocreq(FAR struct usbdev_ep_s *ep)
return &privreq->req;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epfreereq
*
* Description:
* Free an I/O request
*
*******************************************************************************/
****************************************************************************/
static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -1973,13 +1973,13 @@ static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
kmm_free(privreq);
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epallocbuffer
*
* Description:
* Allocate an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void *dm320_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
@ -1994,13 +1994,13 @@ static void *dm320_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_epfreebuffer
*
* Description:
* Free an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void dm320_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
@ -2015,13 +2015,13 @@ static void dm320_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: dm320_epsubmit
*
* Description:
* Submit an I/O request to the endpoint
*
*******************************************************************************/
****************************************************************************/
static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2112,13 +2112,13 @@ static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_epcancel
*
* Description:
* Cancel an I/O request previously sent to an endpoint
*
*******************************************************************************/
****************************************************************************/
static int dm320_epcancel(struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2142,11 +2142,11 @@ static int dm320_epcancel(struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Device Methods
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: dm320_allocep
*
* Description:
@ -2160,7 +2160,7 @@ static int dm320_epcancel(struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev, uint8_t eplog,
bool in, uint8_t eptype)
@ -2216,13 +2216,13 @@ static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev, uint8_t e
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_freeep
*
* Description:
* Free the previously allocated endpoint
*
*******************************************************************************/
****************************************************************************/
static void dm320_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
{
@ -2233,13 +2233,13 @@ static void dm320_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
/* Nothing needs to be done */
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_getframe
*
* Description:
* Returns the current frame number
*
*******************************************************************************/
****************************************************************************/
static int dm320_getframe(struct usbdev_s *dev)
{
@ -2267,13 +2267,13 @@ static int dm320_getframe(struct usbdev_s *dev)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_wakeup
*
* Description:
* Tries to wake up the host connected to this device
*
*******************************************************************************/
****************************************************************************/
static int dm320_wakeup(struct usbdev_s *dev)
{
@ -2286,13 +2286,13 @@ static int dm320_wakeup(struct usbdev_s *dev)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_selfpowered
*
* Description:
* Sets/clears the device selfpowered feature
*
*******************************************************************************/
****************************************************************************/
static int dm320_selfpowered(struct usbdev_s *dev, bool selfpowered)
{
@ -2312,13 +2312,13 @@ static int dm320_selfpowered(struct usbdev_s *dev, bool selfpowered)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: dm320_pullup
*
* Description:
* Software-controlled connect to/disconnect from USB host
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_DM320_GIO_USBDPPULLUP
static int dm320_pullup(struct usbdev_s *dev, bool enable)
@ -2342,17 +2342,17 @@ static int dm320_pullup(struct usbdev_s *dev, bool enable)
}
#endif
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_usbinitialize
*
* Description:
* Initialize USB hardware
*
*******************************************************************************/
****************************************************************************/
void up_usbinitialize(void)
{
@ -2457,9 +2457,9 @@ errout:
up_usbuninitialize();
}
/*******************************************************************************
/****************************************************************************
* Name: up_usbuninitialize
*******************************************************************************/
****************************************************************************/
void up_usbuninitialize(void)
{

View file

@ -230,7 +230,7 @@ static void adc_putreg(struct efm32_dev_s *priv, int offset, uint32_t value)
* ref - Reference to load calibrated values for. No values are loaded for
* external references.
*
******************************************************************************/
****************************************************************************/
static void ADC_CalibrateLoadScan(ADC_TypeDef *adc, ADC_Ref_TypeDef ref)
{
@ -314,7 +314,7 @@ static void ADC_CalibrateLoadScan(ADC_TypeDef *adc, ADC_Ref_TypeDef ref)
* ref - Reference to load calibrated values for. No values are loaded for
* external references.
*
******************************************************************************/
****************************************************************************/
static void ADC_CalibrateLoadSingle(ADC_TypeDef *adc, ADC_Ref_TypeDef ref)
{
@ -381,9 +381,9 @@ static void ADC_CalibrateLoadSingle(ADC_TypeDef *adc, ADC_Ref_TypeDef ref)
}
}
/*******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/***************************************************************************//**
* Name: ADC_Init
@ -400,7 +400,7 @@ static void ADC_CalibrateLoadSingle(ADC_TypeDef *adc, ADC_Ref_TypeDef ref)
* adc- Pointer to ADC peripheral register block.
* int - Pointer to ADC initialization structure.
*
******************************************************************************/
****************************************************************************/
void ADC_Init(ADC_TypeDef *adc, const ADC_Init_TypeDef *init)
{
@ -444,7 +444,7 @@ void ADC_Init(ADC_TypeDef *adc, const ADC_Init_TypeDef *init)
* adc - Pointer to ADC peripheral register block.
* init - Pointer to ADC initialization structure.
*
******************************************************************************/
****************************************************************************/
void ADC_InitScan(ADC_TypeDef *adc, const ADC_InitScan_TypeDef *init)
{
@ -507,7 +507,7 @@ void ADC_InitScan(ADC_TypeDef *adc, const ADC_InitScan_TypeDef *init)
* adc - Pointer to ADC peripheral register block.
* init - Pointer to ADC initialization structure.
*
******************************************************************************/
****************************************************************************/
void ADC_InitSingle(ADC_TypeDef *adc, const ADC_InitSingle_TypeDef *init)
{
@ -570,7 +570,7 @@ void ADC_InitSingle(ADC_TypeDef *adc, const ADC_InitSingle_TypeDef *init)
* Prescaler value to use for ADC in order to achieve a clock value
* <= @p adcFreq.
*
******************************************************************************/
****************************************************************************/
uint8_t ADC_PrescaleCalc(uint32_t adcFreq, uint32_t hfperFreq)
{
@ -616,7 +616,7 @@ uint8_t ADC_PrescaleCalc(uint32_t adcFreq, uint32_t hfperFreq)
* Input Parameters:
* adc - Pointer to ADC peripheral register block.
*
******************************************************************************/
****************************************************************************/
void ADC_Reset(ADC_TypeDef *adc)
{
@ -651,7 +651,7 @@ void ADC_Reset(ADC_TypeDef *adc)
* Returned Value:
* Timebase value to use for ADC in order to achieve at least 1 us.
*
******************************************************************************/
****************************************************************************/
uint8_t ADC_TimebaseCalc(uint32_t hfperFreq)
{
@ -837,7 +837,7 @@ static void adc_hw_reset(struct efm32_dev_s *priv, bool reset)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: adc_enable
*
* Description : Enables or disables the specified ADC peripheral.
@ -851,7 +851,7 @@ static void adc_hw_reset(struct efm32_dev_s *priv, bool reset)
*
* Returned Value:
*
*******************************************************************************/
****************************************************************************/
static void adc_enable(FAR struct efm32_dev_s *priv, bool enable)
{

View file

@ -73,7 +73,7 @@
* Private Functions
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: bitband_set_peripheral
*
* Description:
@ -91,7 +91,7 @@
* bit Bit position to modify, 0-31.
* val Value to set bit to, 0 or 1.
*
******************************************************************************/
****************************************************************************/
inline void bitband_set_peripheral(uint32_t addr, uint32_t bit, uint32_t val)
{
@ -101,7 +101,7 @@ inline void bitband_set_peripheral(uint32_t addr, uint32_t bit, uint32_t val)
*((volatile uint32_t *)regval) = (uint32_t)val;
}
/******************************************************************************
/****************************************************************************
* Name: bitband_get_peripheral
*
* Description:
@ -122,7 +122,7 @@ inline void bitband_set_peripheral(uint32_t addr, uint32_t bit, uint32_t val)
* Returned Value:
* Return bit value read, 0 or 1.
*
******************************************************************************/
****************************************************************************/
inline uint32_t bitband_get_peripheral(uint32_t addr, uint32_t bit)
{
@ -132,7 +132,7 @@ inline uint32_t bitband_get_peripheral(uint32_t addr, uint32_t bit)
return *((volatile uint32_t *)regval);
}
/******************************************************************************
/****************************************************************************
* Name: bitband_set_sram
*
* Description:
@ -150,7 +150,7 @@ inline uint32_t bitband_get_peripheral(uint32_t addr, uint32_t bit)
* bit Bit position to modify, 0-31.
* val Value to set bit to, 0 or 1.
*
******************************************************************************/
****************************************************************************/
inline void bitband_set_sram(uint32_t addr, uint32_t bit, uint32_t val)
{
@ -160,7 +160,7 @@ inline void bitband_set_sram(uint32_t addr, uint32_t bit, uint32_t val)
*((volatile uint32_t *)regval) = (uint32_t)val;
}
/******************************************************************************
/****************************************************************************
* Name: bitband_get_sram
*
* Description::
@ -181,7 +181,7 @@ inline void bitband_set_sram(uint32_t addr, uint32_t bit, uint32_t val)
* Returned Value:
* Return bit value read, 0 or 1.
*
******************************************************************************/
****************************************************************************/
inline uint32_t bitband_get_sram(uint32_t addr, uint32_t bit)
{

View file

@ -1,4 +1,4 @@
/*****************************************************************************
/****************************************************************************
* arch/arm/src/efm32/efm32_dma.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
****************************************************************************/
/*****************************************************************************
/****************************************************************************
* Included Files
*****************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -53,17 +53,17 @@
#include "chip/efm32_dma.h"
#include "efm32_dma.h"
/*****************************************************************************
/****************************************************************************
* Pre-processor Definitions
*****************************************************************************/
****************************************************************************/
#define ALIGN_MASK(s) ((1 << s) - 1)
#define ALIGN_DOWN(v,m) ((v) & ~m)
#define ALIGN_UP(v,m) (((v) + (m)) & ~m)
/*****************************************************************************
/****************************************************************************
* Public Types
*****************************************************************************/
****************************************************************************/
/* This structure describes one DMA channel */
struct dma_channel_s
@ -83,9 +83,9 @@ struct dma_controller_s
sem_t chansem; /* Count of free channels */
};
/*****************************************************************************
/****************************************************************************
* Private Data
*****************************************************************************/
****************************************************************************/
/* This is the overall state of the DMA controller */
@ -130,13 +130,13 @@ static struct dma_descriptor_s g_descriptors[EFM32_DMA_NCHANNELS]
__attribute__((aligned(DESC_TABLE_ALIGN)));
#endif
/*****************************************************************************
/****************************************************************************
* Public Data
*****************************************************************************/
****************************************************************************/
/*****************************************************************************
/****************************************************************************
* Private Functions
*****************************************************************************/
****************************************************************************/
/****************************************************************************
* Name: efm32_set_chctrl
@ -249,9 +249,9 @@ static int efm32_dmac_interrupt(int irq, void *context)
return OK;
}
/*****************************************************************************
/****************************************************************************
* Public Functions
*****************************************************************************/
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize

View file

@ -1,4 +1,4 @@
/*****************************************************************************
/****************************************************************************
* arch/arm/src/efm32/efm32_flash.c
*
* Copyright 2014 Silicon Laboratories, Inc. http://www.silabs.com
@ -183,7 +183,7 @@ void efm32_flash_unlock(void)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: msc_load_verify_address
*
* Description:
@ -206,7 +206,7 @@ void efm32_flash_unlock(void)
* -EBUSY - Busy timeout.
* -EINVAL - Operation tried to access a non-flash area.
* -EACCES - Operation tried to access a locked area of the flash.
*******************************************************************************/
****************************************************************************/
int __ramfunc__ msc_load_verify_address(uint32_t* address)
{
@ -251,7 +251,7 @@ int __ramfunc__ msc_load_verify_address(uint32_t* address)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name:msc_load_data
*
* Description:
@ -276,7 +276,7 @@ int __ramfunc__ msc_load_verify_address(uint32_t* address)
* OK - Operation completed successfully.
* -ETIMEDOUT - Operation timed out waiting for flash operation
* to complete.
******************************************************************************/
****************************************************************************/
int __ramfunc__ msc_load_write_data(uint32_t* data, uint32_t num_words,
bool write_strategy_safe)

View file

@ -32,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
/* Supports:
* - Master operation, 100 kHz (standard) and 400 kHz (full speed)
@ -51,9 +51,9 @@
*
*/
/*******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -84,9 +84,9 @@
#if defined(CONFIG_EFM32_I2C0) || defined(CONFIG_EFM32_I2C1)
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************/
****************************************************************************/
/* Configuration **************************************************************/
@ -281,9 +281,9 @@ struct efm32_i2c_inst_s
uint32_t flags; /* Flags used in this instantiation */
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
******************************************************************************/
****************************************************************************/
static inline uint32_t efm32_i2c_getreg(FAR struct efm32_i2c_priv_s *priv,
uint8_t offset);
@ -351,9 +351,9 @@ static int efm32_i2c_transfer(FAR struct i2c_dev_s *dev,
static const char *efm32_i2c_state_str(int i2c_state);
#endif
/*******************************************************************************
/****************************************************************************
* Private Data
******************************************************************************/
****************************************************************************/
/* Trace events strings */
@ -433,17 +433,17 @@ static const struct i2c_ops_s efm32_i2c_ops =
#endif
};
/*******************************************************************************
/****************************************************************************
* Private Functions
******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_getreg
*
* Description:
* Get a 16-bit register value by offset
*
******************************************************************************/
****************************************************************************/
static inline uint32_t efm32_i2c_getreg(FAR struct efm32_i2c_priv_s *priv,
uint8_t offset)
@ -451,13 +451,13 @@ static inline uint32_t efm32_i2c_getreg(FAR struct efm32_i2c_priv_s *priv,
return getreg32(priv->config->base + offset);
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_putreg
*
* Description:
* Put a 16-bit register value by offset
*
******************************************************************************/
****************************************************************************/
static inline void efm32_i2c_putreg(FAR struct efm32_i2c_priv_s *priv,
uint8_t offset, uint32_t value)
@ -465,13 +465,13 @@ static inline void efm32_i2c_putreg(FAR struct efm32_i2c_priv_s *priv,
putreg32(value, priv->config->base + offset);
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_modifyreg
*
* Description:
* Modify a 16-bit register value by offset
*
******************************************************************************/
****************************************************************************/
static inline void efm32_i2c_modifyreg(FAR struct efm32_i2c_priv_s *priv,
uint8_t offset, uint32_t clearbits,
@ -480,13 +480,13 @@ static inline void efm32_i2c_modifyreg(FAR struct efm32_i2c_priv_s *priv,
modifyreg32(priv->config->base + offset, clearbits, setbits);
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_state_str
*
* Description:
* Convert i2c_state into corresponding text.
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_TRACE
static const char *efm32_i2c_state_str(int i2c_state)
@ -521,13 +521,13 @@ static const char *efm32_i2c_state_str(int i2c_state)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_sem_wait
*
* Description:
* Take the exclusive access, waiting as necessary
*
******************************************************************************/
****************************************************************************/
static inline void efm32_i2c_sem_wait(FAR struct i2c_dev_s *dev)
{
@ -537,14 +537,14 @@ static inline void efm32_i2c_sem_wait(FAR struct i2c_dev_s *dev)
}
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_tousecs
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
* processed.
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_EFM32_I2C_DYNTIMEO
static useconds_t efm32_i2c_tousecs(int msgc, FAR struct i2c_msg_s *msgs)
@ -566,13 +566,13 @@ static useconds_t efm32_i2c_tousecs(int msgc, FAR struct i2c_msg_s *msgs)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_sem_waitdone
*
* Description:
* Wait for a transfer to complete
*
******************************************************************************/
****************************************************************************/
#ifndef CONFIG_I2C_POLLED
static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
@ -701,26 +701,26 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_sem_post
*
* Description:
* Release the mutual exclusion semaphore
*
******************************************************************************/
****************************************************************************/
static inline void efm32_i2c_sem_post(FAR struct i2c_dev_s *dev)
{
sem_post(&((struct efm32_i2c_inst_s *)dev)->priv->sem_excl);
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_sem_init
*
* Description:
* Initialize semaphores
*
******************************************************************************/
****************************************************************************/
static inline void efm32_i2c_sem_init(FAR struct i2c_dev_s *dev)
{
@ -730,13 +730,13 @@ static inline void efm32_i2c_sem_init(FAR struct i2c_dev_s *dev)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_sem_destroy
*
* Description:
* Destroy semaphores.
*
******************************************************************************/
****************************************************************************/
static inline void efm32_i2c_sem_destroy(FAR struct i2c_dev_s *dev)
{
@ -746,13 +746,13 @@ static inline void efm32_i2c_sem_destroy(FAR struct i2c_dev_s *dev)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_trace*
*
* Description:
* I2C trace instrumentation
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_TRACE
static void efm32_i2c_traceclear(FAR struct efm32_i2c_priv_s *priv)
@ -841,13 +841,13 @@ static void efm32_i2c_tracedump(FAR struct efm32_i2c_priv_s *priv)
}
#endif /* CONFIG_I2C_TRACE */
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_setclock
*
* Description:
* Set the I2C clock
*
******************************************************************************/
****************************************************************************/
static void efm32_i2c_setclock(FAR struct efm32_i2c_priv_s *priv,
uint32_t frequency)
@ -893,13 +893,13 @@ static void efm32_i2c_setclock(FAR struct efm32_i2c_priv_s *priv,
efm32_i2c_putreg(priv, EFM32_I2C_CLKDIV_OFFSET, div);
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_isr
*
* Description:
* Common Interrupt Service Routine
*
******************************************************************************/
****************************************************************************/
static int efm32_i2c_isr(struct efm32_i2c_priv_s *priv)
{
@ -1307,13 +1307,13 @@ done:
#ifndef CONFIG_I2C_POLLED
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c0_isr
*
* Description:
* I2C0 interrupt service routine
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_EFM32_I2C0
static int efm32_i2c0_isr(int irq, void *context)
@ -1322,13 +1322,13 @@ static int efm32_i2c0_isr(int irq, void *context)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c1_isr
*
* Description:
* I2C1 interrupt service routine
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_EFM32_I2C1
static int efm32_i2c1_isr(int irq, void *context)
@ -1339,17 +1339,17 @@ static int efm32_i2c1_isr(int irq, void *context)
#endif
/*******************************************************************************
/****************************************************************************
* Private Initialization and Deinitialization
******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_reset
*
* Description:
* Reset I2C to same state as after a HW reset.
*
******************************************************************************/
****************************************************************************/
static void efm32_i2c_reset(FAR struct efm32_i2c_priv_s *priv)
{
@ -1363,14 +1363,14 @@ static void efm32_i2c_reset(FAR struct efm32_i2c_priv_s *priv)
/* Do not reset route register, setting should be done independently */
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_init
*
* Description:
* Setup the I2C hardware, ready for operation with defaults
* Prepare and start an I2C transfer (single master mode only).
*
******************************************************************************/
****************************************************************************/
static int efm32_i2c_init(FAR struct efm32_i2c_priv_s *priv, int frequency)
{
@ -1434,13 +1434,13 @@ static int efm32_i2c_init(FAR struct efm32_i2c_priv_s *priv, int frequency)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_deinit
*
* Description:
* Shutdown the I2C hardware
*
******************************************************************************/
****************************************************************************/
static int efm32_i2c_deinit(FAR struct efm32_i2c_priv_s *priv)
{
@ -1466,17 +1466,17 @@ static int efm32_i2c_deinit(FAR struct efm32_i2c_priv_s *priv)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Device Driver Operations
******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_setfrequency
*
* Description:
* Set the I2C frequency
*
******************************************************************************/
****************************************************************************/
static uint32_t efm32_i2c_setfrequency(FAR struct i2c_dev_s *dev,
uint32_t frequency)
@ -1489,13 +1489,13 @@ static uint32_t efm32_i2c_setfrequency(FAR struct i2c_dev_s *dev,
return frequency;
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_setaddress
*
* Description:
* Set the I2C slave address
*
******************************************************************************/
****************************************************************************/
static int efm32_i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -1508,13 +1508,13 @@ static int efm32_i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_process
*
* Description:
* Common I2C transfer logic
*
******************************************************************************/
****************************************************************************/
static int efm32_i2c_process(FAR struct i2c_dev_s *dev,
FAR struct i2c_msg_s *msgs, int count)
@ -1660,13 +1660,13 @@ static int efm32_i2c_process(FAR struct i2c_dev_s *dev,
return -errval;
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_write
*
* Description:
* Write I2C data
*
******************************************************************************/
****************************************************************************/
static int efm32_i2c_write(FAR struct i2c_dev_s *dev, const uint8_t * buffer,
int buflen)
@ -1682,13 +1682,13 @@ static int efm32_i2c_write(FAR struct i2c_dev_s *dev, const uint8_t * buffer,
return efm32_i2c_process(dev, &msgv, 1);
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_read
*
* Description:
* Read I2C data
*
******************************************************************************/
****************************************************************************/
int efm32_i2c_read(FAR struct i2c_dev_s *dev, uint8_t * buffer, int buflen)
{
@ -1703,13 +1703,13 @@ int efm32_i2c_read(FAR struct i2c_dev_s *dev, uint8_t * buffer, int buflen)
return efm32_i2c_process(dev, &msgv, 1);
}
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_writeread
*
* Description:
* Read then write I2C data
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_WRITEREAD
static int efm32_i2c_writeread(FAR struct i2c_dev_s *dev,
@ -1735,13 +1735,13 @@ static int efm32_i2c_writeread(FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: efm32_i2c_transfer
*
* Description:
* Generic I2C transfer function
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_TRANSFER
static int efm32_i2c_transfer(FAR struct i2c_dev_s *dev,
@ -1751,17 +1751,17 @@ static int efm32_i2c_transfer(FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialize one I2C bus
*
******************************************************************************/
****************************************************************************/
FAR struct i2c_dev_s *up_i2cinitialize(int port)
{
@ -1821,13 +1821,13 @@ FAR struct i2c_dev_s *up_i2cinitialize(int port)
return (struct i2c_dev_s *)inst;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitialize
*
* Description:
* Uninitialize an I2C bus
*
******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s *dev)
{
@ -1865,13 +1865,13 @@ int up_i2cuninitialize(FAR struct i2c_dev_s *dev)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2creset
*
* Description:
* Reset an I2C bus
*
******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_RESET
int up_i2creset(FAR struct i2c_dev_s *dev)

View file

@ -488,13 +488,13 @@ void efm32_lowsetup(void)
#endif
}
/*****************************************************************************
/****************************************************************************
* Name: efm32_lowputc
*
* Description:
* Output one character to the UART using a simple polling method.
*
*****************************************************************************/
****************************************************************************/
#if defined(HAVE_UART_CONSOLE)
void efm32_lowputc(uint32_t ch)
@ -527,13 +527,13 @@ void efm32_lowputc(uint32_t ch)
}
#endif
/*****************************************************************************
/****************************************************************************
* Name: efm32_uartconfigure
*
* Description:
* Configure a U[S]ART as a RS-232 UART.
*
*****************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void efm32_uartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
@ -646,13 +646,13 @@ void efm32_uartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
}
#endif
/*****************************************************************************
/****************************************************************************
* Name: efm32_leuartconfigure
*
* Description:
* Configure a LEUART as a RS-232 UART.
*
*****************************************************************************/
****************************************************************************/
#ifdef HAVE_LEUART_DEVICE
void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
@ -722,7 +722,7 @@ void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
}
#endif
/*****************************************************************************
/****************************************************************************
* Name: efm32_uart_reset
*
* Description:
@ -730,7 +730,7 @@ void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
* to the initial, reset value. Only the ROUTE data set by efm32_lowsetup
* is preserved.
*
*****************************************************************************/
****************************************************************************/
#if defined(HAVE_UART_DEVICE) || defined(HAVE_SPI_DEVICE)
void efm32_uart_reset(uintptr_t base)
@ -755,7 +755,7 @@ void efm32_uart_reset(uintptr_t base)
}
#endif
/*****************************************************************************
/****************************************************************************
* Name: efm32_leuart_reset
*
* Description:
@ -763,7 +763,7 @@ void efm32_uart_reset(uintptr_t base)
* to the initial, reset value. Only the ROUTE data set by efm32_lowsetup
* is preserved.
*
*****************************************************************************/
****************************************************************************/
#ifdef HAVE_LEUART_DEVICE
void efm32_leuart_reset(uintptr_t base)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -268,13 +268,13 @@ void kinetis_lowsetup(void)
#endif /* HAVE_UART_DEVICE */
}
/******************************************************************************
/****************************************************************************
* Name: kinetis_uartreset
*
* Description:
* Reset a UART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void kinetis_uartreset(uintptr_t uart_base)
@ -289,13 +289,13 @@ void kinetis_uartreset(uintptr_t uart_base)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: kinetis_uartconfigure
*
* Description:
* Configure a UART as a RS-232 UART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void kinetis_uartconfigure(uintptr_t uart_base, uint32_t baud,

View file

@ -222,13 +222,13 @@ void kl_lowsetup(void)
#endif
}
/******************************************************************************
/****************************************************************************
* Name: kl_uartreset
*
* Description:
* Reset a UART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void kl_uartreset(uintptr_t uart_base)
@ -243,13 +243,13 @@ void kl_uartreset(uintptr_t uart_base)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: kl_uartconfigure
*
* Description:
* Configure a UART as a RS-232 UART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void kl_uartconfigure(uintptr_t uart_base, uint32_t baud, uint32_t clock,

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc11xx/lpc11_i2c.c
*
* Copyright (C) 2011 Li Zhuoyi. All rights reserved.
@ -39,11 +39,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -72,9 +72,9 @@
#if defined(CONFIG_LPC11_I2C0) || defined(CONFIG_LPC11_I2C1) || defined(CONFIG_LPC11_I2C2)
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
#ifndef GPIO_I2C1_SCL
# define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
@ -95,9 +95,9 @@
#define I2C_TIMEOUT ((20 * CLK_TCK) / 1000) /* 20 mS */
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
struct lpc11_i2cdev_s
{
@ -115,9 +115,9 @@ struct lpc11_i2cdev_s
uint16_t rdcnt; /* number of bytes read from rx fifo */
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
static int i2c_start(struct lpc11_i2cdev_s *priv);
static void i2c_stop(struct lpc11_i2cdev_s *priv);
@ -132,9 +132,9 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen);
static int i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
static struct lpc11_i2cdev_s i2cdevices[3];
@ -149,13 +149,13 @@ struct i2c_ops_s lpc11_i2c_ops =
#endif
};
/*******************************************************************************
/****************************************************************************
* Name: lpc11_i2c_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
@ -185,13 +185,13 @@ static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return frequency;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc11_i2c_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -206,14 +206,14 @@ static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc11_i2c_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer,
int buflen)
@ -234,14 +234,14 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer,
return ret > 0 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc11_i2c_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
{
@ -261,13 +261,13 @@ static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
return ret > 0 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_start
*
* Description:
* Perform a I2C transfer start
*
*******************************************************************************/
****************************************************************************/
static int i2c_start(struct lpc11_i2cdev_s *priv)
{
@ -295,13 +295,13 @@ static int i2c_start(struct lpc11_i2cdev_s *priv)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_stop
*
* Description:
* Perform a I2C transfer stop
*
*******************************************************************************/
****************************************************************************/
static void i2c_stop(struct lpc11_i2cdev_s *priv)
{
@ -313,13 +313,13 @@ static void i2c_stop(struct lpc11_i2cdev_s *priv)
sem_post(&priv->wait);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_timeout
*
* Description:
* Watchdog timer for timeout of I2C operation
*
*******************************************************************************/
****************************************************************************/
static void i2c_timeout(int argc, uint32_t arg, ...)
{
@ -331,13 +331,13 @@ static void i2c_timeout(int argc, uint32_t arg, ...)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_interrupt
*
* Description:
* The I2C Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int i2c_interrupt(int irq, FAR void *context)
{
@ -439,17 +439,17 @@ static int i2c_interrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialise an I2C device
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int port)
{
@ -569,13 +569,13 @@ struct i2c_dev_s *up_i2cinitialize(int port)
return &priv->dev;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialise an I2C device
*
*******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
{

View file

@ -448,13 +448,13 @@ static void lpc17_ethreset(struct lpc17_driver_s *priv);
* Private Functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc17_printreg
*
* Description:
* Print the contents of an LPC17xx register operation
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite)
@ -463,13 +463,13 @@ static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_checkreg
*
* Description:
* Get the contents of an LPC17xx register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
@ -527,13 +527,13 @@ static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_getreg
*
* Description:
* Get the contents of an LPC17xx register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static uint32_t lpc17_getreg(uint32_t addr)
@ -549,13 +549,13 @@ static uint32_t lpc17_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_putreg
*
* Description:
* Set the contents of an LPC17xx register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void lpc17_putreg(uint32_t val, uint32_t addr)
@ -2315,7 +2315,7 @@ static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_showpins
*
* Description:
@ -2329,7 +2329,7 @@ static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
*
* Assumptions:
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_NET_REGDEBUG) && defined(CONFIG_DEBUG_GPIO)
static void lpc17_showpins(void)
@ -2339,7 +2339,7 @@ static void lpc17_showpins(void)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_showmii
*
* Description:
@ -2353,7 +2353,7 @@ static void lpc17_showpins(void)
*
* Assumptions:
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_NET_REGDEBUG) && defined(LPC17_HAVE_PHY)
static void lpc17_showmii(uint8_t phyaddr, const char *msg)

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc17xx/lpc17_i2c.c
*
* Copyright (C) 2011 Li Zhuoyi. All rights reserved.
@ -39,11 +39,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -89,19 +89,19 @@
# define CONFIG_I2C2_FREQ 100000
#endif
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
#define I2C_TIMEOUT ((20 * CLK_TCK) / 1000) /* 20 mS */
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
struct lpc17_i2cdev_s
{
@ -121,18 +121,18 @@ struct lpc17_i2cdev_s
static struct lpc17_i2cdev_s i2cdevices[3];
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
static int i2c_start(struct lpc17_i2cdev_s *priv);
static void i2c_stop(struct lpc17_i2cdev_s *priv);
static int i2c_interrupt(int irq, FAR void *context);
static void i2c_timeout(int argc, uint32_t arg, ...);
/*******************************************************************************
/****************************************************************************
* I2C device operations
*******************************************************************************/
****************************************************************************/
static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency);
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits);
@ -151,13 +151,13 @@ struct i2c_ops_s lpc17_i2c_ops =
#endif
};
/*******************************************************************************
/****************************************************************************
* Name: lpc17_i2c_setfrequency
*
* Description:
* Set the frequence for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
@ -183,13 +183,13 @@ static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return frequency;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_i2c_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -204,14 +204,14 @@ static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_i2c_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen)
{
@ -231,14 +231,14 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int bufle
return ret > 0 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_i2c_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
{
@ -258,13 +258,13 @@ static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
return ret > 0 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_start
*
* Description:
* Perform a I2C transfer start
*
*******************************************************************************/
****************************************************************************/
static int i2c_start(struct lpc17_i2cdev_s *priv)
{
@ -292,13 +292,13 @@ static int i2c_start(struct lpc17_i2cdev_s *priv)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_stop
*
* Description:
* Perform a I2C transfer stop
*
*******************************************************************************/
****************************************************************************/
static void i2c_stop(struct lpc17_i2cdev_s *priv)
{
@ -310,13 +310,13 @@ static void i2c_stop(struct lpc17_i2cdev_s *priv)
sem_post(&priv->wait);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_timeout
*
* Description:
* Watchdog timer for timeout of I2C operation
*
*******************************************************************************/
****************************************************************************/
static void i2c_timeout(int argc, uint32_t arg, ...)
{
@ -328,13 +328,13 @@ static void i2c_timeout(int argc, uint32_t arg, ...)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_interrupt
*
* Description:
* The I2C Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int i2c_interrupt(int irq, FAR void *context)
{
@ -436,17 +436,17 @@ static int i2c_interrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialise an I2C device
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int port)
{
@ -566,13 +566,13 @@ struct i2c_dev_s *up_i2cinitialize(int port)
return &priv->dev;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialise an I2C device
*
*******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc17xx/lpc17_usbdev.c
*
* Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -65,9 +65,9 @@
#include "lpc17_gpio.h"
#include "lpc17_gpdma.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
@ -272,9 +272,9 @@
#define lpc17_rqempty(ep) ((ep)->head == NULL)
#define lpc17_rqpeek(ep) ((ep)->head)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* A container for a request so that the request make be retained in a list */
@ -364,9 +364,9 @@ struct lpc17_usbdev_s
struct lpc17_ep_s eplist[LPC17_NPHYSENDPOINTS];
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Register operations ********************************************************/
@ -457,9 +457,9 @@ static int lpc17_wakeup(struct usbdev_s *dev);
static int lpc17_selfpowered(struct usbdev_s *dev, bool selfpowered);
static int lpc17_pullup(struct usbdev_s *dev, bool enable);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* Since there is only a single USB interface, all status information can be
* be simply retained in a single global instance.
@ -512,21 +512,21 @@ static uint32_t g_udca[LPC17_NPHYSENDPOINTS] __attribute__ ((alig
static struct lpc17_dmadesc_s g_usbddesc[CONFIG_LPC17_USBDEV_NDMADESCRIPTORS];
#endif
/*******************************************************************************
/****************************************************************************
* Public Data
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc17_printreg
*
* Description:
* Print the contents of an LPC17xx register operation
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_REGDEBUG
static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite)
@ -535,13 +535,13 @@ static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_checkreg
*
* Description:
* Get the contents of an LPC17xx register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_REGDEBUG
static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
@ -599,13 +599,13 @@ static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_getreg
*
* Description:
* Get the contents of an LPC17xx register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_REGDEBUG
static uint32_t lpc17_getreg(uint32_t addr)
@ -621,13 +621,13 @@ static uint32_t lpc17_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_putreg
*
* Description:
* Set the contents of an LPC17xx register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_REGDEBUG
static void lpc17_putreg(uint32_t val, uint32_t addr)
@ -642,13 +642,13 @@ static void lpc17_putreg(uint32_t val, uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_usbcmd
*
* Description:
* Transmit commands to the USB engine
*
*******************************************************************************/
****************************************************************************/
static uint32_t lpc17_usbcmd(uint16_t cmd, uint8_t data)
{
@ -786,13 +786,13 @@ static uint32_t lpc17_usbcmd(uint16_t cmd, uint8_t data)
return tmp;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_rqdequeue
*
* Description:
* Remove a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static FAR struct lpc17_req_s *lpc17_rqdequeue(FAR struct lpc17_ep_s *privep)
{
@ -812,13 +812,13 @@ static FAR struct lpc17_req_s *lpc17_rqdequeue(FAR struct lpc17_ep_s *privep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_rqenqueue
*
* Description:
* Add a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static void lpc17_rqenqueue(FAR struct lpc17_ep_s *privep,
FAR struct lpc17_req_s *req)
@ -836,13 +836,13 @@ static void lpc17_rqenqueue(FAR struct lpc17_ep_s *privep,
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epwrite
*
* Description:
* Endpoint write (IN)
*
*******************************************************************************/
****************************************************************************/
static void lpc17_epwrite(uint8_t epphy, const uint8_t *data, uint32_t nbytes)
{
@ -897,13 +897,13 @@ static void lpc17_epwrite(uint8_t epphy, const uint8_t *data, uint32_t nbytes)
(void)lpc17_usbcmd(CMD_USBDEV_EPVALIDATEBUFFER, 0);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epread
*
* Description:
* Endpoint read (OUT)
*
*******************************************************************************/
****************************************************************************/
static int lpc17_epread(uint8_t epphy, uint8_t *data, uint32_t nbytes)
{
@ -983,13 +983,13 @@ static int lpc17_epread(uint8_t epphy, uint8_t *data, uint32_t nbytes)
return pktlen;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_abortrequest
*
* Description:
* Discard a request
*
*******************************************************************************/
****************************************************************************/
static inline void lpc17_abortrequest(struct lpc17_ep_s *privep,
struct lpc17_req_s *privreq,
@ -1006,13 +1006,13 @@ static inline void lpc17_abortrequest(struct lpc17_ep_s *privep,
privreq->req.callback(&privep->ep, &privreq->req);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_reqcomplete
*
* Description:
* Handle termination of the request at the head of the endpoint request queue.
*
*******************************************************************************/
****************************************************************************/
static void lpc17_reqcomplete(struct lpc17_ep_s *privep, int16_t result)
{
@ -1052,13 +1052,13 @@ static void lpc17_reqcomplete(struct lpc17_ep_s *privep, int16_t result)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_wrrequest
*
* Description:
* Send from the next queued write request
*
*******************************************************************************/
****************************************************************************/
static int lpc17_wrrequest(struct lpc17_ep_s *privep)
{
@ -1162,13 +1162,13 @@ static int lpc17_wrrequest(struct lpc17_ep_s *privep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_rdrequest
*
* Description:
* Receive to the next queued read request
*
*******************************************************************************/
****************************************************************************/
static int lpc17_rdrequest(struct lpc17_ep_s *privep)
{
@ -1223,13 +1223,13 @@ static int lpc17_rdrequest(struct lpc17_ep_s *privep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_cancelrequests
*
* Description:
* Cancel all pending requests for an endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc17_cancelrequests(struct lpc17_ep_s *privep)
{
@ -1241,14 +1241,14 @@ static void lpc17_cancelrequests(struct lpc17_ep_s *privep)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epfindbyaddr
*
* Description:
* Find the physical endpoint structure corresponding to a logic endpoint
* address
*
*******************************************************************************/
****************************************************************************/
static struct lpc17_ep_s *lpc17_epfindbyaddr(struct lpc17_usbdev_s *priv,
uint16_t eplog)
@ -1284,13 +1284,13 @@ static struct lpc17_ep_s *lpc17_epfindbyaddr(struct lpc17_usbdev_s *priv,
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_eprealize
*
* Description:
* Enable or disable an endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc17_eprealize(struct lpc17_ep_s *privep, bool prio, uint32_t packetsize)
{
@ -1334,13 +1334,13 @@ static void lpc17_eprealize(struct lpc17_ep_s *privep, bool prio, uint32_t packe
lpc17_putreg(USBDEV_INT_EPRLZED,LPC17_USBDEV_INTCLR);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epclrinterrupt
*
* Description:
* Clear the EP interrupt flag and return the current EP status
*
*******************************************************************************/
****************************************************************************/
static uint8_t lpc17_epclrinterrupt(uint8_t epphy)
{
@ -1357,13 +1357,13 @@ static uint8_t lpc17_epclrinterrupt(uint8_t epphy)
return lpc17_getreg(LPC17_USBDEV_CMDDATA);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_ep0configure
*
* Description:
* Configure endpoint 0
*
*******************************************************************************/
****************************************************************************/
static inline void lpc17_ep0configure(struct lpc17_usbdev_s *priv)
{
@ -1381,12 +1381,12 @@ static inline void lpc17_ep0configure(struct lpc17_usbdev_s *priv)
lpc17_putreg(inten, LPC17_USBDEV_EPINTEN);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_dmareset
*
* Description: Reset USB DMA
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_DMA
static inline void lpc17_dmareset(uint32_t enable)
@ -1441,13 +1441,13 @@ static inline void lpc17_dmareset(uint32_t enable)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_usbreset
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static void lpc17_usbreset(struct lpc17_usbdev_s *priv)
{
@ -1500,14 +1500,14 @@ static void lpc17_usbreset(struct lpc17_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_dispatchrequest
*
* Description:
* Provide unhandled setup actions to the class driver. This is logically part
* of the USB interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void lpc17_dispatchrequest(struct lpc17_usbdev_s *priv,
const struct usb_ctrlreq_s *ctrl)
@ -1530,14 +1530,14 @@ static void lpc17_dispatchrequest(struct lpc17_usbdev_s *priv,
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_ep0setup
*
* Description:
* USB Ctrl EP Setup Event. This is logically part of the USB interrupt
* handler. This event occurs when a setup packet is receive on EP0 OUT.
*
*******************************************************************************/
****************************************************************************/
static inline void lpc17_ep0setup(struct lpc17_usbdev_s *priv)
{
@ -1911,7 +1911,7 @@ static inline void lpc17_ep0setup(struct lpc17_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_ep0dataoutinterrupt
*
* Description:
@ -1919,7 +1919,7 @@ static inline void lpc17_ep0setup(struct lpc17_usbdev_s *priv)
* handler. Each non-isochronous OUT endpoint gives an interrupt when they
* receive a packet without error.
*
*******************************************************************************/
****************************************************************************/
static inline void lpc17_ep0dataoutinterrupt(struct lpc17_usbdev_s *priv)
{
@ -1972,7 +1972,7 @@ static inline void lpc17_ep0dataoutinterrupt(struct lpc17_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_ep0dataininterrupt
*
* Description:
@ -1981,7 +1981,7 @@ static inline void lpc17_ep0dataoutinterrupt(struct lpc17_usbdev_s *priv)
* packet is successfully transmitted (OR a NAK handshake is sent on the bus
* provided that the interrupt on NAK feature is enabled).
*
*******************************************************************************/
****************************************************************************/
static inline void lpc17_ep0dataininterrupt(struct lpc17_usbdev_s *priv)
{
@ -2037,13 +2037,13 @@ static inline void lpc17_ep0dataininterrupt(struct lpc17_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_usbinterrupt
*
* Description:
* USB interrupt handler
*
*******************************************************************************/
****************************************************************************/
static int lpc17_usbinterrupt(int irq, FAR void *context)
{
@ -2394,13 +2394,13 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_dmasetup
*
* Description:
* Setup for DMA Transfer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_DMA
static int lpc17_dmasetup(struct lpc17_usbdev_s *priv, uint8_t epphy,
@ -2482,13 +2482,13 @@ static int lpc17_dmasetup(struct lpc17_usbdev_s *priv, uint8_t epphy,
}
#endif /* CONFIG_LPC17_USBDEV_DMA */
/*******************************************************************************
/****************************************************************************
* Name: lpc17_dmarestart
*
* Description:
* Restart DMA Transfer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_DMA
static void lpc17_dmarestart(uint8_t epphy, uint32_t descndx)
@ -2517,13 +2517,13 @@ static void lpc17_dmarestart(uint8_t epphy, uint32_t descndx)
}
#endif /* CONFIG_LPC17_USBDEV_DMA */
/*******************************************************************************
/****************************************************************************
* Name: lpc17_dmadisable
*
* Description:
* Disable DMA transfer for the EP
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBDEV_DMA
static void lpc17_dmadisable(uint8_t epphy)
@ -2532,11 +2532,11 @@ static void lpc17_dmadisable(uint8_t epphy)
}
#endif /* CONFIG_LPC17_USBDEV_DMA */
/*******************************************************************************
/****************************************************************************
* Endpoint operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epconfigure
*
* Description:
@ -2549,7 +2549,7 @@ static void lpc17_dmadisable(uint8_t epphy)
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_epconfigure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc,
@ -2593,13 +2593,13 @@ static int lpc17_epconfigure(FAR struct usbdev_ep_s *ep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epdisable
*
* Description:
* The endpoint will no longer be used
*
*******************************************************************************/
****************************************************************************/
static int lpc17_epdisable(FAR struct usbdev_ep_s *ep)
{
@ -2638,13 +2638,13 @@ static int lpc17_epdisable(FAR struct usbdev_ep_s *ep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epallocreq
*
* Description:
* Allocate an I/O request
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_req_s *lpc17_epallocreq(FAR struct usbdev_ep_s *ep)
{
@ -2670,13 +2670,13 @@ static FAR struct usbdev_req_s *lpc17_epallocreq(FAR struct usbdev_ep_s *ep)
return &privreq->req;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epfreereq
*
* Description:
* Free an I/O request
*
*******************************************************************************/
****************************************************************************/
static void lpc17_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2694,13 +2694,13 @@ static void lpc17_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
kmm_free(privreq);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epallocbuffer
*
* Description:
* Allocate an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static FAR void *lpc17_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbytes)
@ -2735,13 +2735,13 @@ static FAR void *lpc17_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbytes
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epfreebuffer
*
* Description:
* Free an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void lpc17_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
@ -2774,13 +2774,13 @@ static void lpc17_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epsubmit
*
* Description:
* Submit an I/O request to the endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc17_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2862,13 +2862,13 @@ static int lpc17_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epcancel
*
* Description:
* Cancel an I/O request previously sent to an endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc17_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2891,13 +2891,13 @@ static int lpc17_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_epstall
*
* Description:
* Stall or resume and endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc17_epstall(FAR struct usbdev_ep_s *ep, bool resume)
{
@ -2920,11 +2920,11 @@ static int lpc17_epstall(FAR struct usbdev_ep_s *ep, bool resume)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc17_allocep
*
* Description:
@ -2938,7 +2938,7 @@ static int lpc17_epstall(FAR struct usbdev_ep_s *ep, bool resume)
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_ep_s *lpc17_allocep(FAR struct usbdev_s *dev, uint8_t eplog,
bool in, uint8_t eptype)
@ -3048,13 +3048,13 @@ static FAR struct usbdev_ep_s *lpc17_allocep(FAR struct usbdev_s *dev, uint8_t e
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_freeep
*
* Description:
* Free the previously allocated endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc17_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
{
@ -3074,13 +3074,13 @@ static void lpc17_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_getframe
*
* Description:
* Returns the current frame number
*
*******************************************************************************/
****************************************************************************/
static int lpc17_getframe(struct usbdev_s *dev)
{
@ -3099,13 +3099,13 @@ static int lpc17_getframe(struct usbdev_s *dev)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_wakeup
*
* Description:
* Tries to wake up the host connected to this device
*
*******************************************************************************/
****************************************************************************/
static int lpc17_wakeup(struct usbdev_s *dev)
{
@ -3125,13 +3125,13 @@ static int lpc17_wakeup(struct usbdev_s *dev)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_selfpowered
*
* Description:
* Sets/clears the device selfpowered feature
*
*******************************************************************************/
****************************************************************************/
static int lpc17_selfpowered(struct usbdev_s *dev, bool selfpowered)
{
@ -3151,13 +3151,13 @@ static int lpc17_selfpowered(struct usbdev_s *dev, bool selfpowered)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_pullup
*
* Description:
* Software-controlled connect to/disconnect from USB host
*
*******************************************************************************/
****************************************************************************/
static int lpc17_pullup(struct usbdev_s *dev, bool enable)
{
@ -3171,11 +3171,11 @@ static int lpc17_pullup(struct usbdev_s *dev, bool enable)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_usbinitialize
*
* Description:
@ -3185,7 +3185,7 @@ static int lpc17_pullup(struct usbdev_s *dev, bool enable)
* This function is called very early in the initialization sequence in order
* to initialize the USB device functionality.
*
*******************************************************************************/
****************************************************************************/
void up_usbinitialize(void)
{
@ -3350,9 +3350,9 @@ errout:
up_usbuninitialize();
}
/*******************************************************************************
/****************************************************************************
* Name: up_usbuninitialize
*******************************************************************************/
****************************************************************************/
void up_usbuninitialize(void)
{
@ -3388,14 +3388,14 @@ void up_usbuninitialize(void)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_register
*
* Description:
* Register a USB device class driver. The class driver's bind() method will be
* called to bind it to a USB device driver.
*
*******************************************************************************/
****************************************************************************/
int usbdev_register(struct usbdevclass_driver_s *driver)
{
@ -3439,7 +3439,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_unregister
*
* Description:
@ -3447,7 +3447,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
* it will first disconnect(). The driver is also requested to unbind() and clean
* up any device state, before this procedure finally returns.
*
*******************************************************************************/
****************************************************************************/
int usbdev_unregister(struct usbdevclass_driver_s *driver)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc17xx/lpc17_usbhost.c
*
* Copyright (C) 2010-2012, 2014-2015 Gregory Nutt. All rights reserved.
@ -32,11 +32,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -69,9 +69,9 @@
#include "lpc17_gpio.h"
#include "lpc17_ohciram.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
@ -143,9 +143,9 @@
#define TD_DELAY(n) (uint32_t)((n) << GTD_STATUS_DI_SHIFT)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* This structure retains the state of the USB host controller */
@ -260,9 +260,9 @@ struct lpc17_list_s
/* Variable length buffer data follows */
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Register operations ********************************************************/
@ -404,9 +404,9 @@ static void lpc17_disconnect(struct usbhost_driver_s *drvr,
static inline void lpc17_ep0init(struct lpc17_usbhost_s *priv);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* In this driver implementation, support is provided for only a single a single
* USB device. All status information can be simply retained in a single global
@ -437,21 +437,21 @@ static struct lpc17_list_s *g_iofree; /* List of unused I/O buffers */
static struct lpc17_list_s *g_xfrfree;
static struct lpc17_xfrinfo_s g_xfrbuffers[CONFIG_LPC17_USBHOST_NPREALLOC];
/*******************************************************************************
/****************************************************************************
* Public Data
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc17_printreg
*
* Description:
* Print the contents of an LPC17xx register operation
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBHOST_REGDEBUG
static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite)
@ -460,13 +460,13 @@ static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_checkreg
*
* Description:
* Get the contents of an LPC17xx register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBHOST_REGDEBUG
static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
@ -524,13 +524,13 @@ static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_getreg
*
* Description:
* Get the contents of an LPC17xx register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBHOST_REGDEBUG
static uint32_t lpc17_getreg(uint32_t addr)
@ -546,13 +546,13 @@ static uint32_t lpc17_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_putreg
*
* Description:
* Set the contents of an LPC17xx register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC17_USBHOST_REGDEBUG
static void lpc17_putreg(uint32_t val, uint32_t addr)
@ -574,7 +574,7 @@ static void lpc17_putreg(uint32_t val, uint32_t addr)
* This is just a wrapper to handle the annoying behavior of semaphore
* waits that return due to the receipt of a signal.
*
*******************************************************************************/
****************************************************************************/
static void lpc17_takesem(sem_t *sem)
{
@ -596,7 +596,7 @@ static void lpc17_takesem(sem_t *sem)
* Description:
* Get a (possibly unaligned) 16-bit little endian value.
*
*******************************************************************************/
****************************************************************************/
static inline uint16_t lpc17_getle16(const uint8_t *val)
{
@ -609,7 +609,7 @@ static inline uint16_t lpc17_getle16(const uint8_t *val)
* Description:
* Put a (possibly unaligned) 16-bit little endian value.
*
*******************************************************************************/
****************************************************************************/
#if 0 /* Not used */
static void lpc17_putle16(uint8_t *dest, uint16_t val)
@ -619,13 +619,13 @@ static void lpc17_putle16(uint8_t *dest, uint16_t val)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_edfree
*
* Description:
* Return an endpoint descriptor to the free list
*
*******************************************************************************/
****************************************************************************/
static inline void lpc17_edfree(struct lpc17_ed_s *ed)
{
@ -637,7 +637,7 @@ static inline void lpc17_edfree(struct lpc17_ed_s *ed)
g_edfree = entry;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_tdalloc
*
* Description:
@ -649,7 +649,7 @@ static inline void lpc17_edfree(struct lpc17_ed_s *ed)
* handler
* - Protection from re-entrance must be assured by the caller
*
*******************************************************************************/
****************************************************************************/
static struct lpc17_gtd_s *lpc17_tdalloc(void)
{
@ -671,7 +671,7 @@ static struct lpc17_gtd_s *lpc17_tdalloc(void)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_tdfree
*
* Description:
@ -681,7 +681,7 @@ static struct lpc17_gtd_s *lpc17_tdalloc(void)
* - Only called from the WDH interrupt handler (and during initialization).
* - Interrupts are disabled in any case.
*
*******************************************************************************/
****************************************************************************/
static void lpc17_tdfree(struct lpc17_gtd_s *td)
{
@ -698,7 +698,7 @@ static void lpc17_tdfree(struct lpc17_gtd_s *td)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_tballoc
*
* Description:
@ -708,7 +708,7 @@ static void lpc17_tdfree(struct lpc17_gtd_s *td)
* - Never called from an interrupt handler.
* - Protection from re-entrance must be assured by the caller
*
*******************************************************************************/
****************************************************************************/
static uint8_t *lpc17_tballoc(void)
{
@ -720,13 +720,13 @@ static uint8_t *lpc17_tballoc(void)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_tbfree
*
* Description:
* Return an request/descriptor transfer buffer to the free list
*
*******************************************************************************/
****************************************************************************/
static void lpc17_tbfree(uint8_t *buffer)
{
@ -739,7 +739,7 @@ static void lpc17_tbfree(uint8_t *buffer)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_allocio
*
* Description:
@ -749,7 +749,7 @@ static void lpc17_tbfree(uint8_t *buffer)
* - Never called from an interrupt handler.
* - Protection from re-entrance must be assured by the caller
*
*******************************************************************************/
****************************************************************************/
#if LPC17_IOBUFFERS > 0
static uint8_t *lpc17_allocio(void)
@ -771,13 +771,13 @@ static uint8_t *lpc17_allocio(void)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_freeio
*
* Description:
* Return an TD buffer to the free list
*
*******************************************************************************/
****************************************************************************/
#if LPC17_IOBUFFERS > 0
static void lpc17_freeio(uint8_t *buffer)
@ -795,7 +795,7 @@ static void lpc17_freeio(uint8_t *buffer)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_alloc_xfrinfo
*
* Description:
@ -805,7 +805,7 @@ static void lpc17_freeio(uint8_t *buffer)
* - Never called from an interrupt handler.
* - Protection from re-entrance must be assured by the caller
*
*******************************************************************************/
****************************************************************************/
static struct lpc17_xfrinfo_s *lpc17_alloc_xfrinfo(void)
{
@ -825,13 +825,13 @@ static struct lpc17_xfrinfo_s *lpc17_alloc_xfrinfo(void)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_freeio
*
* Description:
* Return an TD buffer to the free list
*
*******************************************************************************/
****************************************************************************/
static void lpc17_free_xfrinfo(struct lpc17_xfrinfo_s *xfrinfo)
{
@ -847,13 +847,13 @@ static void lpc17_free_xfrinfo(struct lpc17_xfrinfo_s *xfrinfo)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_addctrled
*
* Description:
* Helper function to add an ED to the control list.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_addctrled(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed)
@ -885,13 +885,13 @@ static inline int lpc17_addctrled(struct lpc17_usbhost_s *priv,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_remctrled
*
* Description:
* Helper function remove an ED from the control list.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_remctrled(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed)
@ -967,13 +967,13 @@ static inline int lpc17_remctrled(struct lpc17_usbhost_s *priv,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_addbulked
*
* Description:
* Helper function to add an ED to the bulk list.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_addbulked(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed)
@ -1009,13 +1009,13 @@ static inline int lpc17_addbulked(struct lpc17_usbhost_s *priv,
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_rembulked
*
* Description:
* Helper function remove an ED from the bulk list.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_rembulked(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed)
@ -1089,13 +1089,13 @@ static inline int lpc17_rembulked(struct lpc17_usbhost_s *priv,
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_getinterval
*
* Description:
* Convert the endpoint polling interval into a HCCA table increment
*
*******************************************************************************/
****************************************************************************/
#if !defined(CONFIG_USBHOST_INT_DISABLE) || !defined(CONFIG_USBHOST_ISOC_DISABLE)
static unsigned int lpc17_getinterval(uint8_t interval)
@ -1128,14 +1128,14 @@ static unsigned int lpc17_getinterval(uint8_t interval)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_setinttab
*
* Description:
* Set the interrupt table to the selected value using the provided interval
* and offset.
*
*******************************************************************************/
****************************************************************************/
#if !defined(CONFIG_USBHOST_INT_DISABLE) || !defined(CONFIG_USBHOST_ISOC_DISABLE)
static void lpc17_setinttab(uint32_t value, unsigned int interval, unsigned int offset)
@ -1148,7 +1148,7 @@ static void lpc17_setinttab(uint32_t value, unsigned int interval, unsigned int
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_addinted
*
* Description:
@ -1166,7 +1166,7 @@ static void lpc17_setinttab(uint32_t value, unsigned int interval, unsigned int
* 1. The minimum support polling rate is 2MS, and
* 2. Some devices may get polled at a much higher rate than they request.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_addinted(struct lpc17_usbhost_s *priv,
const struct usbhost_epdesc_s *epdesc,
@ -1257,7 +1257,7 @@ static inline int lpc17_addinted(struct lpc17_usbhost_s *priv,
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_reminted
*
* Description:
@ -1275,7 +1275,7 @@ static inline int lpc17_addinted(struct lpc17_usbhost_s *priv,
* 1. The minimum support polling rate is 2MS, and
* 2. Some devices may get polled at a much higher rate than they request.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_reminted(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed)
@ -1398,13 +1398,13 @@ static inline int lpc17_reminted(struct lpc17_usbhost_s *priv,
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_addisoced
*
* Description:
* Helper functions to add an ED to the periodic table.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_addisoced(struct lpc17_usbhost_s *priv,
const struct usbhost_epdesc_s *epdesc,
@ -1416,13 +1416,13 @@ static inline int lpc17_addisoced(struct lpc17_usbhost_s *priv,
return -ENOSYS;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_remisoced
*
* Description:
* Helper functions to remove an ED from the periodic table.
*
*******************************************************************************/
****************************************************************************/
static inline int lpc17_remisoced(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed)
@ -1433,14 +1433,14 @@ static inline int lpc17_remisoced(struct lpc17_usbhost_s *priv,
return -ENOSYS;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_enqueuetd
*
* Description:
* Enqueue a transfer descriptor. Notice that this function only supports
* queue on TD per ED.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_enqueuetd(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed, uint32_t dirpid,
@ -1480,7 +1480,7 @@ static int lpc17_enqueuetd(struct lpc17_usbhost_s *priv,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_wdhwait
*
* Description:
@ -1489,7 +1489,7 @@ static int lpc17_enqueuetd(struct lpc17_usbhost_s *priv,
* We do this to minimize race conditions. This logic would have to be expanded
* if we want to have more than one packet in flight at a time!
*
*******************************************************************************/
****************************************************************************/
static int lpc17_wdhwait(struct lpc17_usbhost_s *priv, struct lpc17_ed_s *ed)
{
@ -1516,7 +1516,7 @@ static int lpc17_wdhwait(struct lpc17_usbhost_s *priv, struct lpc17_ed_s *ed)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_ctrltd
*
* Description:
@ -1528,7 +1528,7 @@ static int lpc17_wdhwait(struct lpc17_usbhost_s *priv, struct lpc17_ed_s *ed)
* These are blocking methods; these functions will not return until the
* control transfer has completed.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_ctrltd(struct lpc17_usbhost_s *priv, struct lpc17_ed_s *ed,
uint32_t dirpid, uint8_t *buffer, size_t buflen)
@ -1620,13 +1620,13 @@ errout_with_xfrinfo:
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_usbinterrupt
*
* Description:
* USB interrupt handler
*
*******************************************************************************/
****************************************************************************/
static int lpc17_usbinterrupt(int irq, void *context)
{
@ -1906,11 +1906,11 @@ static int lpc17_usbinterrupt(int irq, void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* USB Host Controller Operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc17_wait
*
* Description:
@ -1933,7 +1933,7 @@ static int lpc17_usbinterrupt(int irq, void *context)
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_wait(struct usbhost_connection_s *conn,
struct usbhost_hubport_s **hport)
@ -1999,7 +1999,7 @@ static int lpc17_wait(struct usbhost_connection_s *conn,
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_enumerate
*
* Description:
@ -2025,7 +2025,7 @@ static int lpc17_wait(struct usbhost_connection_s *conn,
* Assumptions:
* This function will *not* be called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_rh_enumerate(struct usbhost_connection_s *conn,
struct usbhost_hubport_s *hport)
@ -2387,7 +2387,7 @@ static int lpc17_epfree(struct usbhost_driver_s *drvr, usbhost_ep_t ep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_alloc
*
* Description:
@ -2417,7 +2417,7 @@ static int lpc17_epfree(struct usbhost_driver_s *drvr, usbhost_ep_t ep)
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_alloc(struct usbhost_driver_s *drvr,
uint8_t **buffer, size_t *maxlen)
@ -2441,7 +2441,7 @@ static int lpc17_alloc(struct usbhost_driver_s *drvr,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_free
*
* Description:
@ -2462,7 +2462,7 @@ static int lpc17_alloc(struct usbhost_driver_s *drvr,
* Assumptions:
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_free(struct usbhost_driver_s *drvr, uint8_t *buffer)
{
@ -2561,7 +2561,7 @@ static int lpc17_iofree(struct usbhost_driver_s *drvr, uint8_t *buffer)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_ctrlin and lpc17_ctrlout
*
* Description:
@ -2595,7 +2595,7 @@ static int lpc17_iofree(struct usbhost_driver_s *drvr, uint8_t *buffer)
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_ctrlin(struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
const struct usb_ctrlreq_s *req,
@ -2673,7 +2673,7 @@ static int lpc17_ctrlout(struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_transfer_common
*
* Description:
@ -2697,7 +2697,7 @@ static int lpc17_ctrlout(struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int lpc17_transfer_common(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed, uint8_t *buffer,
@ -2751,7 +2751,7 @@ static int lpc17_transfer_common(struct lpc17_usbhost_s *priv,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_dma_alloc
*
* Description:
@ -2774,7 +2774,7 @@ static int lpc17_transfer_common(struct lpc17_usbhost_s *priv,
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
#if LPC17_IOBUFFERS > 0
static int lpc17_dma_alloc(struct lpc17_usbhost_s *priv,
@ -2823,7 +2823,7 @@ static int lpc17_dma_alloc(struct lpc17_usbhost_s *priv,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_dma_free
*
* Description:
@ -2846,7 +2846,7 @@ static int lpc17_dma_alloc(struct lpc17_usbhost_s *priv,
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void lpc17_dma_free(struct lpc17_usbhost_s *priv,
struct lpc17_ed_s *ed, uint8_t *userbuffer,
@ -2879,7 +2879,7 @@ static void lpc17_dma_free(struct lpc17_usbhost_s *priv,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_transfer
*
* Description:
@ -2915,7 +2915,7 @@ static void lpc17_dma_free(struct lpc17_usbhost_s *priv,
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static ssize_t lpc17_transfer(struct usbhost_driver_s *drvr, usbhost_ep_t ep,
uint8_t *buffer, size_t buflen)
@ -3062,7 +3062,7 @@ errout_with_sem:
return nbytes;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc17_asynch_completion
*
* Description:
@ -3080,7 +3080,7 @@ errout_with_sem:
* Assumptions:
* - Called from the interrupt level
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBHOST_ASYNCH
static void lpc17_asynch_completion(struct lpc17_usbhost_s *priv,
@ -3151,7 +3151,7 @@ static void lpc17_asynch_completion(struct lpc17_usbhost_s *priv,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_asynch
*
* Description:
@ -3184,7 +3184,7 @@ static void lpc17_asynch_completion(struct lpc17_usbhost_s *priv,
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBHOST_ASYNCH
static int lpc17_asynch(struct usbhost_driver_s *drvr, usbhost_ep_t ep,
@ -3471,7 +3471,7 @@ static int lpc17_connect(FAR struct usbhost_driver_s *drvr,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc17_disconnect
*
* Description:
@ -3494,7 +3494,7 @@ static int lpc17_connect(FAR struct usbhost_driver_s *drvr,
* - Only a single class bound to a single device is supported.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void lpc17_disconnect(struct usbhost_driver_s *drvr,
struct usbhost_hubport_s *hport)
@ -3503,10 +3503,10 @@ static void lpc17_disconnect(struct usbhost_driver_s *drvr,
hport->devclass = NULL;
}
/*******************************************************************************
/****************************************************************************
* Initialization
*******************************************************************************/
/*******************************************************************************
****************************************************************************/
/****************************************************************************
* Name: lpc17_ep0init
*
* Description:
@ -3519,7 +3519,7 @@ static void lpc17_disconnect(struct usbhost_driver_s *drvr,
* Returned Values:
* None
*
*******************************************************************************/
****************************************************************************/
static inline void lpc17_ep0init(struct lpc17_usbhost_s *priv)
{
@ -3544,11 +3544,11 @@ static inline void lpc17_ep0init(struct lpc17_usbhost_s *priv)
lpc17_addctrled(priv, EDCTRL);
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc17_usbhost_initialize
*
* Description:
@ -3571,7 +3571,7 @@ static inline void lpc17_ep0init(struct lpc17_usbhost_s *priv)
* - Class drivers should be initialized prior to calling this function.
* Otherwise, there is a race condition if the device is already connected.
*
*******************************************************************************/
****************************************************************************/
struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc214x/lpc214x_usbdev.c
*
* Copyright (C) 2008-2010, 2012-2013 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -64,9 +64,9 @@
#include "lpc214x_pll.h"
#include "lpc214x_power.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
@ -283,9 +283,9 @@
#define lpc214x_rqempty(ep) ((ep)->head == NULL)
#define lpc214x_rqpeek(ep) ((ep)->head)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* A container for a request so that the request make be retained in a list */
@ -376,9 +376,9 @@ struct lpc214x_usbdev_s
struct lpc214x_ep_s eplist[LPC214X_NPHYSENDPOINTS];
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Register operations ********************************************************/
@ -467,9 +467,9 @@ static int lpc214x_wakeup(struct usbdev_s *dev);
static int lpc214x_selfpowered(struct usbdev_s *dev, bool selfpowered);
static int lpc214x_pullup(struct usbdev_s *dev, bool enable);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* Since there is only a single USB interface, all status information can be
* be simply retained in a single global instance.
@ -502,21 +502,21 @@ static const struct usbdev_ops_s g_devops =
.pullup = lpc214x_pullup,
};
/*******************************************************************************
/****************************************************************************
* Public Data
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_getreg
*
* Description:
* Get the contents of an LPC214x register
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_LPC214X_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static uint32_t lpc214x_getreg(uint32_t addr)
@ -572,13 +572,13 @@ static uint32_t lpc214x_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_putreg
*
* Description:
* Set the contents of an LPC214x register to a value
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_LPC214X_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static void lpc214x_putreg(uint32_t val, uint32_t addr)
@ -593,13 +593,13 @@ static void lpc214x_putreg(uint32_t val, uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_usbcmd
*
* Description:
* Transmit commands to the USB engine
*
*******************************************************************************/
****************************************************************************/
static uint32_t lpc214x_usbcmd(uint16_t cmd, uint8_t data)
{
@ -729,13 +729,13 @@ static uint32_t lpc214x_usbcmd(uint16_t cmd, uint8_t data)
return tmp;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_rqdequeue
*
* Description:
* Remove a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static FAR struct lpc214x_req_s *lpc214x_rqdequeue(FAR struct lpc214x_ep_s *privep)
{
@ -755,13 +755,13 @@ static FAR struct lpc214x_req_s *lpc214x_rqdequeue(FAR struct lpc214x_ep_s *priv
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_rqenqueue
*
* Description:
* Add a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_rqenqueue(FAR struct lpc214x_ep_s *privep,
FAR struct lpc214x_req_s *req)
@ -779,13 +779,13 @@ static void lpc214x_rqenqueue(FAR struct lpc214x_ep_s *privep,
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epwrite
*
* Description:
* Endpoint write (IN)
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_epwrite(uint8_t epphy, const uint8_t *data, uint32_t nbytes)
{
@ -840,13 +840,13 @@ static void lpc214x_epwrite(uint8_t epphy, const uint8_t *data, uint32_t nbytes)
(void)lpc214x_usbcmd(CMD_USB_EP_VALIDATEBUFFER, 0);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epread
*
* Description:
* Endpoint read (OUT)
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_epread(uint8_t epphy, uint8_t *data, uint32_t nbytes)
{
@ -926,13 +926,13 @@ static int lpc214x_epread(uint8_t epphy, uint8_t *data, uint32_t nbytes)
return pktlen;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_abortrequest
*
* Description:
* Discard a request
*
*******************************************************************************/
****************************************************************************/
static inline void lpc214x_abortrequest(struct lpc214x_ep_s *privep,
struct lpc214x_req_s *privreq,
@ -949,13 +949,13 @@ static inline void lpc214x_abortrequest(struct lpc214x_ep_s *privep,
privreq->req.callback(&privep->ep, &privreq->req);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_reqcomplete
*
* Description:
* Handle termination of the request at the head of the endpoint request queue.
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_reqcomplete(struct lpc214x_ep_s *privep, int16_t result)
{
@ -995,13 +995,13 @@ static void lpc214x_reqcomplete(struct lpc214x_ep_s *privep, int16_t result)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_wrrequest
*
* Description:
* Send from the next queued write request
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
{
@ -1105,13 +1105,13 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_rdrequest
*
* Description:
* Receive to the next queued read request
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_rdrequest(struct lpc214x_ep_s *privep)
{
@ -1166,13 +1166,13 @@ static int lpc214x_rdrequest(struct lpc214x_ep_s *privep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_cancelrequests
*
* Description:
* Cancel all pending requests for an endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_cancelrequests(struct lpc214x_ep_s *privep)
{
@ -1184,14 +1184,14 @@ static void lpc214x_cancelrequests(struct lpc214x_ep_s *privep)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epfindbyaddr
*
* Description:
* Find the physical endpoint structure corresponding to a logic endpoint
* address
*
*******************************************************************************/
****************************************************************************/
static struct lpc214x_ep_s *lpc214x_epfindbyaddr(struct lpc214x_usbdev_s *priv,
uint16_t eplog)
@ -1227,13 +1227,13 @@ static struct lpc214x_ep_s *lpc214x_epfindbyaddr(struct lpc214x_usbdev_s *priv,
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_eprealize
*
* Description:
* Enable or disable an endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_eprealize(struct lpc214x_ep_s *privep, bool prio, uint32_t packetsize)
{
@ -1277,13 +1277,13 @@ static void lpc214x_eprealize(struct lpc214x_ep_s *privep, bool prio, uint32_t p
lpc214x_putreg(USBDEV_DEVINT_EPRLZED,LPC214X_USBDEV_DEVINTCLR);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epclrinterrupt
*
* Description:
* Clear the EP interrupt flag and return the current EP status
*
*******************************************************************************/
****************************************************************************/
static uint8_t lpc214x_epclrinterrupt(uint8_t epphy)
{
@ -1300,13 +1300,13 @@ static uint8_t lpc214x_epclrinterrupt(uint8_t epphy)
return lpc214x_getreg(LPC214X_USBDEV_CMDDATA);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_ep0configure
*
* Description:
* Configure endpoint 0
*
*******************************************************************************/
****************************************************************************/
static inline void lpc214x_ep0configure(struct lpc214x_usbdev_s *priv)
{
@ -1324,12 +1324,12 @@ static inline void lpc214x_ep0configure(struct lpc214x_usbdev_s *priv)
lpc214x_putreg(inten, LPC214X_USBDEV_EPINTEN);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_dmareset
*
* Description: Reset USB DMA
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC214X_USBDEV_DMA
static inline void lpc214x_dmareset(uint32_t enable)
@ -1384,13 +1384,13 @@ static inline void lpc214x_dmareset(uint32_t enable)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_usbreset
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_usbreset(struct lpc214x_usbdev_s *priv)
{
@ -1457,14 +1457,14 @@ static void lpc214x_usbreset(struct lpc214x_usbdev_s *priv)
LPC214X_USBDEV_DEVINTEN);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_dispatchrequest
*
* Description:
* Provide unhandled setup actions to the class driver. This is logically part
* of the USB interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_dispatchrequest(struct lpc214x_usbdev_s *priv,
const struct usb_ctrlreq_s *ctrl)
@ -1487,14 +1487,14 @@ static void lpc214x_dispatchrequest(struct lpc214x_usbdev_s *priv,
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_ep0setup
*
* Description:
* USB Ctrl EP Setup Event. This is logically part of the USB interrupt
* handler. This event occurs when a setup packet is receive on EP0 OUT.
*
*******************************************************************************/
****************************************************************************/
static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv)
{
@ -1870,7 +1870,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_ep0dataoutinterrupt
*
* Description:
@ -1878,7 +1878,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv)
* handler. Each non-isochronous OUT endpoint gives an interrupt when they
* receive a packet without error.
*
*******************************************************************************/
****************************************************************************/
static inline void lpc214x_ep0dataoutinterrupt(struct lpc214x_usbdev_s *priv)
{
@ -1935,7 +1935,7 @@ static inline void lpc214x_ep0dataoutinterrupt(struct lpc214x_usbdev_s *priv)
return;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_ep0dataininterrupt
*
* Description:
@ -1944,7 +1944,7 @@ static inline void lpc214x_ep0dataoutinterrupt(struct lpc214x_usbdev_s *priv)
* packet is successfully transmitted (OR a NAK handshake is sent on the bus
* provided that the interrupt on NAK feature is enabled).
*
*******************************************************************************/
****************************************************************************/
static inline void lpc214x_ep0dataininterrupt(struct lpc214x_usbdev_s *priv)
{
@ -2002,13 +2002,13 @@ static inline void lpc214x_ep0dataininterrupt(struct lpc214x_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_usbinterrupt
*
* Description:
* USB interrupt handler
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_usbinterrupt(int irq, FAR void *context)
{
@ -2359,13 +2359,13 @@ static int lpc214x_usbinterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_dmasetup
*
* Description:
* Setup for DMA Transfer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC214X_USBDEV_DMA
static int lpc214x_dmasetup(struct lpc214x_usbdev_s *priv, uint8_t epphy,
@ -2447,13 +2447,13 @@ static int lpc214x_dmasetup(struct lpc214x_usbdev_s *priv, uint8_t epphy,
}
#endif /* CONFIG_LPC214X_USBDEV_DMA */
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_dmarestart
*
* Description:
* Restart DMA Transfer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC214X_USBDEV_DMA
static void lpc214x_dmarestart(uint8_t epphy, uint32_t descndx)
@ -2482,13 +2482,13 @@ static void lpc214x_dmarestart(uint8_t epphy, uint32_t descndx)
}
#endif /* CONFIG_LPC214X_USBDEV_DMA */
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_dmadisable
*
* Description:
* Disable DMA transfer for the EP
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC214X_USBDEV_DMA
static void lpc214x_dmadisable(uint8_t epphy)
@ -2497,11 +2497,11 @@ static void lpc214x_dmadisable(uint8_t epphy)
}
#endif /* CONFIG_LPC214X_USBDEV_DMA */
/*******************************************************************************
/****************************************************************************
* Endpoint operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epconfigure
*
* Description:
@ -2514,7 +2514,7 @@ static void lpc214x_dmadisable(uint8_t epphy)
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_epconfigure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc,
@ -2558,13 +2558,13 @@ static int lpc214x_epconfigure(FAR struct usbdev_ep_s *ep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epdisable
*
* Description:
* The endpoint will no longer be used
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_epdisable(FAR struct usbdev_ep_s *ep)
{
@ -2603,13 +2603,13 @@ static int lpc214x_epdisable(FAR struct usbdev_ep_s *ep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epallocreq
*
* Description:
* Allocate an I/O request
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_req_s *lpc214x_epallocreq(FAR struct usbdev_ep_s *ep)
{
@ -2635,13 +2635,13 @@ static FAR struct usbdev_req_s *lpc214x_epallocreq(FAR struct usbdev_ep_s *ep)
return &privreq->req;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epfreereq
*
* Description:
* Free an I/O request
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2659,13 +2659,13 @@ static void lpc214x_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_
kmm_free(privreq);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epallocbuffer
*
* Description:
* Allocate an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_LPC214X_USBDEV_DMA
static FAR void *lpc214x_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbytes)
@ -2700,13 +2700,13 @@ static FAR void *lpc214x_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbyt
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epfreebuffer
*
* Description:
* Free an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
@ -2739,13 +2739,13 @@ static void lpc214x_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epsubmit
*
* Description:
* Submit an I/O request to the endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2827,13 +2827,13 @@ static int lpc214x_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epcancel
*
* Description:
* Cancel an I/O request previously sent to an endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2855,13 +2855,13 @@ static int lpc214x_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_epstall
*
* Description:
* Stall or resume and endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_epstall(FAR struct usbdev_ep_s *ep, bool resume)
{
@ -2884,11 +2884,11 @@ static int lpc214x_epstall(FAR struct usbdev_ep_s *ep, bool resume)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lcp214x_allocep
*
* Description:
@ -2902,7 +2902,7 @@ static int lpc214x_epstall(FAR struct usbdev_ep_s *ep, bool resume)
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_ep_s *lcp214x_allocep(FAR struct usbdev_s *dev, uint8_t eplog,
bool in, uint8_t eptype)
@ -3012,13 +3012,13 @@ static FAR struct usbdev_ep_s *lcp214x_allocep(FAR struct usbdev_s *dev, uint8_t
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_freeep
*
* Description:
* Free the previously allocated endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc214x_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
{
@ -3038,13 +3038,13 @@ static void lpc214x_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_getframe
*
* Description:
* Returns the current frame number
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_getframe(struct usbdev_s *dev)
{
@ -3063,13 +3063,13 @@ static int lpc214x_getframe(struct usbdev_s *dev)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_wakeup
*
* Description:
* Tries to wake up the host connected to this device
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_wakeup(struct usbdev_s *dev)
{
@ -3089,13 +3089,13 @@ static int lpc214x_wakeup(struct usbdev_s *dev)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_selfpowered
*
* Description:
* Sets/clears the device selfpowered feature
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_selfpowered(struct usbdev_s *dev, bool selfpowered)
{
@ -3115,13 +3115,13 @@ static int lpc214x_selfpowered(struct usbdev_s *dev, bool selfpowered)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc214x_pullup
*
* Description:
* Software-controlled connect to/disconnect from USB host
*
*******************************************************************************/
****************************************************************************/
static int lpc214x_pullup(struct usbdev_s *dev, bool enable)
{
@ -3135,11 +3135,11 @@ static int lpc214x_pullup(struct usbdev_s *dev, bool enable)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_usbinitialize
*
* Description:
@ -3152,7 +3152,7 @@ static int lpc214x_pullup(struct usbdev_s *dev, bool enable)
* and P0.23 and PO.31 in PINSEL1 must be configured for Vbus and USB connect
* LED.
*
*******************************************************************************/
****************************************************************************/
void up_usbinitialize(void)
{
@ -3265,9 +3265,9 @@ errout:
up_usbuninitialize();
}
/*******************************************************************************
/****************************************************************************
* Name: up_usbuninitialize
*******************************************************************************/
****************************************************************************/
void up_usbuninitialize(void)
{
@ -3303,14 +3303,14 @@ void up_usbuninitialize(void)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_register
*
* Description:
* Register a USB device class driver. The class driver's bind() method will be
* called to bind it to a USB device driver.
*
*******************************************************************************/
****************************************************************************/
int usbdev_register(struct usbdevclass_driver_s *driver)
{
@ -3354,7 +3354,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_unregister
*
* Description:
@ -3362,7 +3362,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
* it will first disconnect(). The driver is also requested to unbind() and clean
* up any device state, before this procedure finally returns.
*
*******************************************************************************/
****************************************************************************/
int usbdev_unregister(struct usbdevclass_driver_s *driver)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc2378/lpc23xx_i2c.c
*
* Copyright (C) 2013 Li Zhuoyi. All rights reserved.
@ -44,11 +44,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -153,13 +153,13 @@ struct i2c_ops_s lpc23xx_i2c_ops =
#endif
};
/*******************************************************************************
/****************************************************************************
* Name: lpc23xx_i2c_setfrequency
*
* Description:
* Set the frequence for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
@ -189,13 +189,13 @@ static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return frequency;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc23xx_i2c_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -210,14 +210,14 @@ static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc23xx_i2c_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen)
{
@ -237,14 +237,14 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int bufle
return ret >0 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc23xx_i2c_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
{
@ -264,13 +264,13 @@ static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
return ret > 0 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_start
*
* Description:
* Perform a I2C transfer start
*
*******************************************************************************/
****************************************************************************/
static int i2c_start (struct lpc23xx_i2cdev_s *priv)
{
@ -300,13 +300,13 @@ static int i2c_start (struct lpc23xx_i2cdev_s *priv)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_stop
*
* Description:
* Perform a I2C transfer stop
*
*******************************************************************************/
****************************************************************************/
static void i2c_stop (struct lpc23xx_i2cdev_s *priv)
{
@ -318,13 +318,13 @@ static void i2c_stop (struct lpc23xx_i2cdev_s *priv)
sem_post (&priv->wait);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_timeout
*
* Description:
* Watchdog timer for timeout of I2C operation
*
*******************************************************************************/
****************************************************************************/
static void i2c_timeout (int argc, uint32_t arg, ...)
{
@ -336,13 +336,13 @@ static void i2c_timeout (int argc, uint32_t arg, ...)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_interrupt
*
* Description:
* The I2C Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int i2c_interrupt (int irq, FAR void *context)
{
@ -447,13 +447,13 @@ static int i2c_interrupt (int irq, FAR void *context)
/****************************************************************************
* Public Functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialise an I2C device
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int port)
{
@ -586,13 +586,13 @@ struct i2c_dev_s *up_i2cinitialize(int port)
return &priv->dev;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialise an I2C device
*
*******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
{

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc31xx/lpc31_i2c.c
*
* Author: David Hewson
@ -33,11 +33,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -64,9 +64,9 @@
#include "lpc31_evntrtr.h"
#include "lpc31_syscreg.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
@ -142,13 +142,13 @@ struct i2c_ops_s lpc31_i2c_ops =
#endif
};
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialise an I2C device
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int port)
{
@ -191,13 +191,13 @@ struct i2c_dev_s *up_i2cinitialize(int port)
return &priv->dev;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialise an I2C device
*
*******************************************************************************/
****************************************************************************/
void up_i2cuninitalize(struct lpc31_i2cdev_s *priv)
{
@ -218,13 +218,13 @@ void up_i2cuninitalize(struct lpc31_i2cdev_s *priv)
lpc31_disableclock(priv->clkid);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_i2c_setfrequency
*
* Description:
* Set the frequence for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
@ -252,13 +252,13 @@ static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return frequency;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_i2c_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -273,14 +273,14 @@ static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_i2c_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen)
{
@ -298,14 +298,14 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int bufle
return ret == 1 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_i2c_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
{
@ -323,13 +323,13 @@ static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
return ret == 1 ? OK : -ETIMEDOUT;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_transfer
*
* Description:
* Perform a sequence of I2C transfers
*
*******************************************************************************/
****************************************************************************/
static int i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count)
{
@ -367,13 +367,13 @@ static int i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, i
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_interrupt
*
* Description:
* The I2C Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int i2c_interrupt(int irq, FAR void *context)
{
@ -390,13 +390,13 @@ static int i2c_interrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_progress
*
* Description:
* Progress any remaining I2C transfers
*
*******************************************************************************/
****************************************************************************/
static void i2c_progress(struct lpc31_i2cdev_s *priv)
{
@ -589,13 +589,13 @@ out:
}
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_timeout
*
* Description:
* Watchdog timer for timeout of I2C operation
*
*******************************************************************************/
****************************************************************************/
static void i2c_timeout(int argc, uint32_t arg, ...)
{
@ -630,13 +630,13 @@ static void i2c_timeout(int argc, uint32_t arg, ...)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_reset
*
* Description:
* Perform a soft reset of the I2C controller
*
*******************************************************************************/
****************************************************************************/
static void i2c_reset(struct lpc31_i2cdev_s *priv)
{
putreg32(I2C_CTRL_RESET, priv->base + LPC31_I2C_CTRL_OFFSET);

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc31xx/lpc31_usbdev.c
*
* Authors: David Hewson
@ -36,11 +36,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -69,9 +69,9 @@
#include "lpc31_evntrtr.h"
#include "lpc31_syscreg.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
@ -255,9 +255,9 @@ struct lpc31_dqh_s
#define lpc31_rqempty(ep) ((ep)->head == NULL)
#define lpc31_rqpeek(ep) ((ep)->head)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* A container for a request so that the request may be retained in a list */
@ -333,9 +333,9 @@ struct lpc31_usbdev_s
#define EP0STATE_DATA_IN 8
#define EP0STATE_DATA_OUT 9
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Register operations ********************************************************/
@ -422,9 +422,9 @@ static int lpc31_wakeup(struct usbdev_s *dev);
static int lpc31_selfpowered(struct usbdev_s *dev, bool selfpowered);
static int lpc31_pullup(struct usbdev_s *dev, bool enable);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* Since there is only a single USB interface, all status information can be
* be simply retained in a single global instance.
@ -460,21 +460,21 @@ static const struct usbdev_ops_s g_devops =
.pullup = lpc31_pullup,
};
/*******************************************************************************
/****************************************************************************
* Public Data
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc31_getreg
*
* Description:
* Get the contents of an LPC313x register
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_LPC31_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static uint32_t lpc31_getreg(uint32_t addr)
@ -530,13 +530,13 @@ static uint32_t lpc31_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc31_putreg
*
* Description:
* Set the contents of an LPC313x register to a value
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_LPC31_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static void lpc31_putreg(uint32_t val, uint32_t addr)
@ -551,13 +551,13 @@ static void lpc31_putreg(uint32_t val, uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc31_clrbits
*
* Description:
* Clear bits in a register
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_clrbits(uint32_t mask, uint32_t addr)
{
@ -566,13 +566,13 @@ static inline void lpc31_clrbits(uint32_t mask, uint32_t addr)
lpc31_putreg(reg, addr);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_setbits
*
* Description:
* Set bits in a register
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_setbits(uint32_t mask, uint32_t addr)
{
@ -581,13 +581,13 @@ static inline void lpc31_setbits(uint32_t mask, uint32_t addr)
lpc31_putreg(reg, addr);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_chgbits
*
* Description:
* Change bits in a register
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_chgbits(uint32_t mask, uint32_t val, uint32_t addr)
{
@ -597,13 +597,13 @@ static inline void lpc31_chgbits(uint32_t mask, uint32_t val, uint32_t addr)
lpc31_putreg(reg, addr);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_rqdequeue
*
* Description:
* Remove a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static FAR struct lpc31_req_s *lpc31_rqdequeue(FAR struct lpc31_ep_s *privep)
{
@ -623,13 +623,13 @@ static FAR struct lpc31_req_s *lpc31_rqdequeue(FAR struct lpc31_ep_s *privep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_rqenqueue
*
* Description:
* Add a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static bool lpc31_rqenqueue(FAR struct lpc31_ep_s *privep,
FAR struct lpc31_req_s *req)
@ -650,13 +650,13 @@ static bool lpc31_rqenqueue(FAR struct lpc31_ep_s *privep,
return is_empty;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_writedtd
*
* Description:
* Initialise a DTD to transfer the data
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_writedtd(struct lpc31_dtd_s *dtd, const uint8_t *data, uint32_t nbytes)
{
@ -670,13 +670,13 @@ static inline void lpc31_writedtd(struct lpc31_dtd_s *dtd, const uint8_t *data,
dtd->xfer_len = nbytes;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_queuedtd
*
* Description:
* Add the DTD to the device list
*
*******************************************************************************/
****************************************************************************/
static void lpc31_queuedtd(uint8_t epphy, struct lpc31_dtd_s *dtd)
{
@ -694,13 +694,13 @@ static void lpc31_queuedtd(uint8_t epphy, struct lpc31_dtd_s *dtd)
;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_ep0xfer
*
* Description:
* Schedule a short transfer for Endpoint 0 (IN or OUT)
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_ep0xfer(uint8_t epphy, uint8_t *buf, uint32_t nbytes)
{
@ -711,13 +711,13 @@ static inline void lpc31_ep0xfer(uint8_t epphy, uint8_t *buf, uint32_t nbytes)
lpc31_queuedtd(epphy, dtd);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_readsetup
*
* Description:
* Read a Setup packet from the DTD.
*
*******************************************************************************/
****************************************************************************/
static void lpc31_readsetup(uint8_t epphy, struct usb_ctrlreq_s *ctrl)
{
struct lpc31_dqh_s *dqh = &g_qh[epphy];
@ -740,13 +740,13 @@ static void lpc31_readsetup(uint8_t epphy, struct usb_ctrlreq_s *ctrl)
lpc31_putreg (LPC31_ENDPTMASK(LPC31_EP0_OUT), LPC31_USBDEV_ENDPTSETUPSTAT);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_set_address
*
* Description:
* Set the devices USB address
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_set_address(struct lpc31_usbdev_s *priv, uint16_t address)
{
@ -757,13 +757,13 @@ static inline void lpc31_set_address(struct lpc31_usbdev_s *priv, uint16_t addre
LPC31_USBDEV_DEVICEADDR);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_flushep
*
* Description:
* Flush any primed descriptors from this ep
*
*******************************************************************************/
****************************************************************************/
static void lpc31_flushep(struct lpc31_ep_s *privep)
{
@ -778,13 +778,13 @@ static void lpc31_flushep(struct lpc31_ep_s *privep)
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_progressep
*
* Description:
* Progress the Endpoint by priming the first request into the queue head
*
*******************************************************************************/
****************************************************************************/
static int lpc31_progressep(struct lpc31_ep_s *privep)
{
@ -843,13 +843,13 @@ static int lpc31_progressep(struct lpc31_ep_s *privep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_abortrequest
*
* Description:
* Discard a request
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_abortrequest(struct lpc31_ep_s *privep,
struct lpc31_req_s *privreq,
@ -866,13 +866,13 @@ static inline void lpc31_abortrequest(struct lpc31_ep_s *privep,
privreq->req.callback(&privep->ep, &privreq->req);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_reqcomplete
*
* Description:
* Handle termination of the request at the head of the endpoint request queue.
*
*******************************************************************************/
****************************************************************************/
static void lpc31_reqcomplete(struct lpc31_ep_s *privep,
struct lpc31_req_s *privreq, int16_t result)
@ -898,13 +898,13 @@ static void lpc31_reqcomplete(struct lpc31_ep_s *privep,
privep->stalled = stalled;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_cancelrequests
*
* Description:
* Cancel all pending requests for an endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc31_cancelrequests(struct lpc31_ep_s *privep, int16_t status)
{
@ -921,14 +921,14 @@ static void lpc31_cancelrequests(struct lpc31_ep_s *privep, int16_t status)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epfindbyaddr
*
* Description:
* Find the physical endpoint structure corresponding to a logic endpoint
* address
*
*******************************************************************************/
****************************************************************************/
static struct lpc31_ep_s *lpc31_epfindbyaddr(struct lpc31_usbdev_s *priv,
uint16_t eplog)
@ -964,14 +964,14 @@ static struct lpc31_ep_s *lpc31_epfindbyaddr(struct lpc31_usbdev_s *priv,
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_dispatchrequest
*
* Description:
* Provide unhandled setup actions to the class driver. This is logically part
* of the USB interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void lpc31_dispatchrequest(struct lpc31_usbdev_s *priv,
const struct usb_ctrlreq_s *ctrl)
@ -995,13 +995,13 @@ static void lpc31_dispatchrequest(struct lpc31_usbdev_s *priv,
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_ep0configure
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static void lpc31_ep0configure(struct lpc31_usbdev_s *priv)
{
@ -1021,13 +1021,13 @@ static void lpc31_ep0configure(struct lpc31_usbdev_s *priv)
lpc31_setbits (USBDEV_ENDPTCTRL0_RXE | USBDEV_ENDPTCTRL0_TXE, LPC31_USBDEV_ENDPTCTRL0);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_usbreset
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static void lpc31_usbreset(struct lpc31_usbdev_s *priv)
{
@ -1094,13 +1094,13 @@ static void lpc31_usbreset(struct lpc31_usbdev_s *priv)
LPC31_USBDEV_USBINTR);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_setstate
*
* Description:
* Sets the EP0 state and manages the NAK interrupts
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_ep0state(struct lpc31_usbdev_s *priv, uint16_t state)
{
@ -1120,14 +1120,14 @@ static inline void lpc31_ep0state(struct lpc31_usbdev_s *priv, uint16_t state)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_ep0setup
*
* Description:
* USB Ctrl EP Setup Event. This is logically part of the USB interrupt
* handler. This event occurs when a setup packet is receive on EP0 OUT.
*
*******************************************************************************/
****************************************************************************/
static inline void lpc31_ep0setup(struct lpc31_usbdev_s *priv)
{
@ -1457,13 +1457,13 @@ static inline void lpc31_ep0setup(struct lpc31_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_ep0complete
*
* Description:
* Transfer complete handler for Endpoint 0
*
*******************************************************************************/
****************************************************************************/
static void lpc31_ep0complete(struct lpc31_usbdev_s *priv, uint8_t epphy)
{
@ -1529,13 +1529,13 @@ static void lpc31_ep0complete(struct lpc31_usbdev_s *priv, uint8_t epphy)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_ep0nak
*
* Description:
* Handle a NAK interrupt on EP0
*
*******************************************************************************/
****************************************************************************/
static void lpc31_ep0nak(struct lpc31_usbdev_s *priv, uint8_t epphy)
{
@ -1568,14 +1568,14 @@ static void lpc31_ep0nak(struct lpc31_usbdev_s *priv, uint8_t epphy)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epcomplete
*
* Description:
* Transfer complete handler for Endpoints other than 0
* returns whether the request at the head has completed
*
*******************************************************************************/
****************************************************************************/
bool lpc31_epcomplete(struct lpc31_usbdev_s *priv, uint8_t epphy)
{
@ -1638,13 +1638,13 @@ bool lpc31_epcomplete(struct lpc31_usbdev_s *priv, uint8_t epphy)
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_usbinterrupt
*
* Description:
* USB interrupt handler
*
*******************************************************************************/
****************************************************************************/
static int lpc31_usbinterrupt(int irq, FAR void *context)
{
@ -1803,11 +1803,11 @@ static int lpc31_usbinterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Endpoint operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epconfigure
*
* Description:
@ -1820,7 +1820,7 @@ static int lpc31_usbinterrupt(int irq, FAR void *context)
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
****************************************************************************/
static int lpc31_epconfigure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc,
@ -1890,13 +1890,13 @@ static int lpc31_epconfigure(FAR struct usbdev_ep_s *ep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epdisable
*
* Description:
* The endpoint will no longer be used
*
*******************************************************************************/
****************************************************************************/
static int lpc31_epdisable(FAR struct usbdev_ep_s *ep)
{
@ -1929,13 +1929,13 @@ static int lpc31_epdisable(FAR struct usbdev_ep_s *ep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epallocreq
*
* Description:
* Allocate an I/O request
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_req_s *lpc31_epallocreq(FAR struct usbdev_ep_s *ep)
{
@ -1961,13 +1961,13 @@ static FAR struct usbdev_req_s *lpc31_epallocreq(FAR struct usbdev_ep_s *ep)
return &privreq->req;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epfreereq
*
* Description:
* Free an I/O request
*
*******************************************************************************/
****************************************************************************/
static void lpc31_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -1985,13 +1985,13 @@ static void lpc31_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
kmm_free(privreq);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epallocbuffer
*
* Description:
* Allocate an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void *lpc31_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
@ -2006,13 +2006,13 @@ static void *lpc31_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epfreebuffer
*
* Description:
* Free an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void lpc31_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
@ -2027,13 +2027,13 @@ static void lpc31_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epsubmit
*
* Description:
* Submit an I/O request to the endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc31_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2095,13 +2095,13 @@ static int lpc31_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epcancel
*
* Description:
* Cancel an I/O request previously sent to an endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc31_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2131,13 +2131,13 @@ static int lpc31_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_epstall
*
* Description:
* Stall or resume and endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc31_epstall(FAR struct usbdev_ep_s *ep, bool resume)
{
@ -2172,11 +2172,11 @@ static int lpc31_epstall(FAR struct usbdev_ep_s *ep, bool resume)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc31_allocep
*
* Description:
@ -2190,7 +2190,7 @@ static int lpc31_epstall(FAR struct usbdev_ep_s *ep, bool resume)
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_ep_s *lpc31_allocep(FAR struct usbdev_s *dev, uint8_t eplog,
bool in, uint8_t eptype)
@ -2300,13 +2300,13 @@ static FAR struct usbdev_ep_s *lpc31_allocep(FAR struct usbdev_s *dev, uint8_t e
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_freeep
*
* Description:
* Free the previously allocated endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc31_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
{
@ -2326,13 +2326,13 @@ static void lpc31_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_getframe
*
* Description:
* Returns the current frame number
*
*******************************************************************************/
****************************************************************************/
static int lpc31_getframe(struct usbdev_s *dev)
{
@ -2353,13 +2353,13 @@ static int lpc31_getframe(struct usbdev_s *dev)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_wakeup
*
* Description:
* Tries to wake up the host connected to this device
*
*******************************************************************************/
****************************************************************************/
static int lpc31_wakeup(struct usbdev_s *dev)
{
@ -2373,13 +2373,13 @@ static int lpc31_wakeup(struct usbdev_s *dev)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_selfpowered
*
* Description:
* Sets/clears the device selfpowered feature
*
*******************************************************************************/
****************************************************************************/
static int lpc31_selfpowered(struct usbdev_s *dev, bool selfpowered)
{
@ -2399,13 +2399,13 @@ static int lpc31_selfpowered(struct usbdev_s *dev, bool selfpowered)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc31_pullup
*
* Description:
* Software-controlled connect to/disconnect from USB host
*
*******************************************************************************/
****************************************************************************/
static int lpc31_pullup(struct usbdev_s *dev, bool enable)
{
@ -2420,11 +2420,11 @@ static int lpc31_pullup(struct usbdev_s *dev, bool enable)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_usbinitialize
*
* Description:
@ -2437,7 +2437,7 @@ static int lpc31_pullup(struct usbdev_s *dev, bool enable)
* and P0.23 and PO.31 in PINSEL1 must be configured for Vbus and USB connect
* LED.
*
*******************************************************************************/
****************************************************************************/
void up_usbinitialize(void)
{
@ -2562,9 +2562,9 @@ errout:
up_usbuninitialize();
}
/*******************************************************************************
/****************************************************************************
* Name: up_usbuninitialize
*******************************************************************************/
****************************************************************************/
void up_usbuninitialize(void)
{
@ -2604,14 +2604,14 @@ void up_usbuninitialize(void)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_register
*
* Description:
* Register a USB device class driver. The class driver's bind() method will be
* called to bind it to a USB device driver.
*
*******************************************************************************/
****************************************************************************/
int usbdev_register(struct usbdevclass_driver_s *driver)
{
@ -2666,7 +2666,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_unregister
*
* Description:
@ -2674,7 +2674,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
* it will first disconnect(). The driver is also requested to unbind() and clean
* up any device state, before this procedure finally returns.
*
*******************************************************************************/
****************************************************************************/
int usbdev_unregister(struct usbdevclass_driver_s *driver)
{

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc43xx/lpc43_i2c.c
*
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
@ -44,11 +44,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -160,13 +160,13 @@ struct i2c_ops_s lpc43_i2c_ops =
#endif
};
/*******************************************************************************
/****************************************************************************
* Name: lpc43_i2c_setfrequency
*
* Description:
* Set the frequence for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
struct lpc43_i2cdev_s *priv = (struct lpc43_i2cdev_s *) dev;
@ -191,13 +191,13 @@ static uint32_t i2c_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return frequency;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_i2c_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -212,14 +212,14 @@ static int i2c_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_i2c_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer,
int buflen)
@ -246,14 +246,14 @@ static int i2c_write(FAR struct i2c_dev_s *dev, const uint8_t *buffer,
return (ret == 0 ? 0 : -ETIMEDOUT);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_i2c_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
{
@ -279,13 +279,13 @@ static int i2c_read(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen)
return (ret == 0 ? 0 : -ETIMEDOUT);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_start
*
* Description:
* Perform a I2C transfer start
*
*******************************************************************************/
****************************************************************************/
static int i2c_start(struct lpc43_i2cdev_s *priv)
{
@ -308,13 +308,13 @@ static int i2c_start(struct lpc43_i2cdev_s *priv)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_stop
*
* Description:
* Perform a I2C transfer stop
*
*******************************************************************************/
****************************************************************************/
static void i2c_stop(struct lpc43_i2cdev_s *priv)
{
@ -326,13 +326,13 @@ static void i2c_stop(struct lpc43_i2cdev_s *priv)
sem_post(&priv->wait);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_timeout
*
* Description:
* Watchdog timer for timeout of I2C operation
*
*******************************************************************************/
****************************************************************************/
static void i2c_timeout(int argc, uint32_t arg, ...)
{
@ -344,13 +344,13 @@ static void i2c_timeout(int argc, uint32_t arg, ...)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_transfer
*
* Description:
* Perform a sequence of I2C transfers
*
*******************************************************************************/
****************************************************************************/
static int i2c_transfer(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count)
{
@ -384,13 +384,13 @@ void startStopNextMessage(struct lpc43_i2cdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: i2c_interrupt
*
* Description:
* The I2C Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int i2c_interrupt(int irq, FAR void *context)
{
@ -489,13 +489,13 @@ static int i2c_interrupt(int irq, FAR void *context)
* Public Functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialise an I2C device
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int port)
{
@ -601,13 +601,13 @@ struct i2c_dev_s *up_i2cinitialize(int port)
return &priv->dev;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialise an I2C device
*
*******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/lpc43xx/lpc43_usbdev.c
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
@ -41,11 +41,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -76,9 +76,9 @@
#include "lpc43_cgu.h"
#include "lpc43_rgu.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
@ -272,9 +272,9 @@ struct lpc43_dqh_s
#define lpc43_rqempty(ep) ((ep)->head == NULL)
#define lpc43_rqpeek(ep) ((ep)->head)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* A container for a request so that the request may be retained in a list */
@ -351,9 +351,9 @@ struct lpc43_usbdev_s
#define EP0STATE_DATA_IN 8
#define EP0STATE_DATA_OUT 9
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Register operations ********************************************************/
@ -441,9 +441,9 @@ static int lpc43_wakeup(struct usbdev_s *dev);
static int lpc43_selfpowered(struct usbdev_s *dev, bool selfpowered);
static int lpc43_pullup(struct usbdev_s *dev, bool enable);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* Since there is only a single USB interface, all status information can be
* be simply retained in a single global instance.
@ -479,21 +479,21 @@ static const struct usbdev_ops_s g_devops =
.pullup = lpc43_pullup,
};
/*******************************************************************************
/****************************************************************************
* Public Data
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc43_getreg
*
* Description:
* Get the contents of an LPC433x register
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_LPC43_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static uint32_t lpc43_getreg(uint32_t addr)
@ -549,13 +549,13 @@ static uint32_t lpc43_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc43_putreg
*
* Description:
* Set the contents of an LPC433x register to a value
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_LPC43_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
static void lpc43_putreg(uint32_t val, uint32_t addr)
@ -570,13 +570,13 @@ static void lpc43_putreg(uint32_t val, uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc43_clrbits
*
* Description:
* Clear bits in a register
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_clrbits(uint32_t mask, uint32_t addr)
{
@ -585,13 +585,13 @@ static inline void lpc43_clrbits(uint32_t mask, uint32_t addr)
lpc43_putreg(reg, addr);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_setbits
*
* Description:
* Set bits in a register
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_setbits(uint32_t mask, uint32_t addr)
{
@ -600,13 +600,13 @@ static inline void lpc43_setbits(uint32_t mask, uint32_t addr)
lpc43_putreg(reg, addr);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_chgbits
*
* Description:
* Change bits in a register
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_chgbits(uint32_t mask, uint32_t val, uint32_t addr)
{
@ -616,13 +616,13 @@ static inline void lpc43_chgbits(uint32_t mask, uint32_t val, uint32_t addr)
lpc43_putreg(reg, addr);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_rqdequeue
*
* Description:
* Remove a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static FAR struct lpc43_req_s *lpc43_rqdequeue(FAR struct lpc43_ep_s *privep)
{
@ -642,13 +642,13 @@ static FAR struct lpc43_req_s *lpc43_rqdequeue(FAR struct lpc43_ep_s *privep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_rqenqueue
*
* Description:
* Add a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static bool lpc43_rqenqueue(FAR struct lpc43_ep_s *privep,
FAR struct lpc43_req_s *req)
@ -670,13 +670,13 @@ static bool lpc43_rqenqueue(FAR struct lpc43_ep_s *privep,
return is_empty;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_writedtd
*
* Description:
* Initialise a DTD to transfer the data
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_writedtd(struct lpc43_dtd_s *dtd, const uint8_t *data, uint32_t nbytes)
{
@ -690,13 +690,13 @@ static inline void lpc43_writedtd(struct lpc43_dtd_s *dtd, const uint8_t *data,
dtd->xfer_len = nbytes;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_queuedtd
*
* Description:
* Add the DTD to the device list
*
*******************************************************************************/
****************************************************************************/
static void lpc43_queuedtd(uint8_t epphy, struct lpc43_dtd_s *dtd)
{
@ -714,13 +714,13 @@ static void lpc43_queuedtd(uint8_t epphy, struct lpc43_dtd_s *dtd)
;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_ep0xfer
*
* Description:
* Schedule a short transfer for Endpoint 0 (IN or OUT)
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_ep0xfer(uint8_t epphy, uint8_t *buf, uint32_t nbytes)
{
@ -731,13 +731,13 @@ static inline void lpc43_ep0xfer(uint8_t epphy, uint8_t *buf, uint32_t nbytes)
lpc43_queuedtd(epphy, dtd);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_readsetup
*
* Description:
* Read a Setup packet from the DTD.
*
*******************************************************************************/
****************************************************************************/
static void lpc43_readsetup(uint8_t epphy, struct usb_ctrlreq_s *ctrl)
{
struct lpc43_dqh_s *dqh = &g_qh[epphy];
@ -767,13 +767,13 @@ static void lpc43_readsetup(uint8_t epphy, struct usb_ctrlreq_s *ctrl)
lpc43_putreg (LPC43_ENDPTMASK(LPC43_EP0_OUT), LPC43_USBDEV_ENDPTSETUPSTAT);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_set_address
*
* Description:
* Set the devices USB address
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_set_address(struct lpc43_usbdev_s *priv, uint16_t address)
{
@ -784,13 +784,13 @@ static inline void lpc43_set_address(struct lpc43_usbdev_s *priv, uint16_t addre
LPC43_USBDEV_DEVICEADDR);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_flushep
*
* Description:
* Flush any primed descriptors from this ep
*
*******************************************************************************/
****************************************************************************/
static void lpc43_flushep(struct lpc43_ep_s *privep)
{
@ -805,13 +805,13 @@ static void lpc43_flushep(struct lpc43_ep_s *privep)
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_progressep
*
* Description:
* Progress the Endpoint by priming the first request into the queue head
*
*******************************************************************************/
****************************************************************************/
static int lpc43_progressep(struct lpc43_ep_s *privep)
{
@ -886,13 +886,13 @@ static int lpc43_progressep(struct lpc43_ep_s *privep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_abortrequest
*
* Description:
* Discard a request
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_abortrequest(struct lpc43_ep_s *privep,
struct lpc43_req_s *privreq,
@ -909,13 +909,13 @@ static inline void lpc43_abortrequest(struct lpc43_ep_s *privep,
privreq->req.callback(&privep->ep, &privreq->req);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_reqcomplete
*
* Description:
* Handle termination of the request at the head of the endpoint request queue.
*
*******************************************************************************/
****************************************************************************/
static void lpc43_reqcomplete(struct lpc43_ep_s *privep,
struct lpc43_req_s *privreq, int16_t result)
@ -941,13 +941,13 @@ static void lpc43_reqcomplete(struct lpc43_ep_s *privep,
privep->stalled = stalled;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_cancelrequests
*
* Description:
* Cancel all pending requests for an endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc43_cancelrequests(struct lpc43_ep_s *privep, int16_t status)
{
@ -964,14 +964,14 @@ static void lpc43_cancelrequests(struct lpc43_ep_s *privep, int16_t status)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epfindbyaddr
*
* Description:
* Find the physical endpoint structure corresponding to a logic endpoint
* address
*
*******************************************************************************/
****************************************************************************/
static struct lpc43_ep_s *lpc43_epfindbyaddr(struct lpc43_usbdev_s *priv,
uint16_t eplog)
@ -1007,14 +1007,14 @@ static struct lpc43_ep_s *lpc43_epfindbyaddr(struct lpc43_usbdev_s *priv,
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_dispatchrequest
*
* Description:
* Provide unhandled setup actions to the class driver. This is logically part
* of the USB interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void lpc43_dispatchrequest(struct lpc43_usbdev_s *priv,
const struct usb_ctrlreq_s *ctrl)
@ -1038,13 +1038,13 @@ static void lpc43_dispatchrequest(struct lpc43_usbdev_s *priv,
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_ep0configure
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static void lpc43_ep0configure(struct lpc43_usbdev_s *priv)
{
@ -1066,13 +1066,13 @@ static void lpc43_ep0configure(struct lpc43_usbdev_s *priv)
lpc43_setbits (USBDEV_ENDPTCTRL0_RXE | USBDEV_ENDPTCTRL0_TXE, LPC43_USBDEV_ENDPTCTRL0);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_usbreset
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static void lpc43_usbreset(struct lpc43_usbdev_s *priv)
{
@ -1148,13 +1148,13 @@ static void lpc43_usbreset(struct lpc43_usbdev_s *priv)
LPC43_USBDEV_USBINTR);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_setstate
*
* Description:
* Sets the EP0 state and manages the NAK interrupts
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_ep0state(struct lpc43_usbdev_s *priv, uint16_t state)
{
@ -1176,14 +1176,14 @@ static inline void lpc43_ep0state(struct lpc43_usbdev_s *priv, uint16_t state)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_ep0setup
*
* Description:
* USB Ctrl EP Setup Event. This is logically part of the USB interrupt
* handler. This event occurs when a setup packet is receive on EP0 OUT.
*
*******************************************************************************/
****************************************************************************/
static inline void lpc43_ep0setup(struct lpc43_usbdev_s *priv)
{
@ -1528,13 +1528,13 @@ static inline void lpc43_ep0setup(struct lpc43_usbdev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_ep0complete
*
* Description:
* Transfer complete handler for Endpoint 0
*
*******************************************************************************/
****************************************************************************/
static void lpc43_ep0complete(struct lpc43_usbdev_s *priv, uint8_t epphy)
{
@ -1611,13 +1611,13 @@ static void lpc43_ep0complete(struct lpc43_usbdev_s *priv, uint8_t epphy)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_ep0nak
*
* Description:
* Handle a NAK interrupt on EP0
*
*******************************************************************************/
****************************************************************************/
static void lpc43_ep0nak(struct lpc43_usbdev_s *priv, uint8_t epphy)
{
@ -1652,14 +1652,14 @@ static void lpc43_ep0nak(struct lpc43_usbdev_s *priv, uint8_t epphy)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epcomplete
*
* Description:
* Transfer complete handler for Endpoints other than 0
* returns whether the request at the head has completed
*
*******************************************************************************/
****************************************************************************/
bool lpc43_epcomplete(struct lpc43_usbdev_s *priv, uint8_t epphy)
{
@ -1727,13 +1727,13 @@ bool lpc43_epcomplete(struct lpc43_usbdev_s *priv, uint8_t epphy)
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_usbinterrupt
*
* Description:
* USB interrupt handler
*
*******************************************************************************/
****************************************************************************/
static int lpc43_usbinterrupt(int irq, FAR void *context)
{
@ -1913,11 +1913,11 @@ static int lpc43_usbinterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Endpoint operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epconfigure
*
* Description:
@ -1930,7 +1930,7 @@ static int lpc43_usbinterrupt(int irq, FAR void *context)
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
****************************************************************************/
static int lpc43_epconfigure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc,
@ -2012,13 +2012,13 @@ static int lpc43_epconfigure(FAR struct usbdev_ep_s *ep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epdisable
*
* Description:
* The endpoint will no longer be used
*
*******************************************************************************/
****************************************************************************/
static int lpc43_epdisable(FAR struct usbdev_ep_s *ep)
{
@ -2057,13 +2057,13 @@ static int lpc43_epdisable(FAR struct usbdev_ep_s *ep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epallocreq
*
* Description:
* Allocate an I/O request
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_req_s *lpc43_epallocreq(FAR struct usbdev_ep_s *ep)
{
@ -2089,13 +2089,13 @@ static FAR struct usbdev_req_s *lpc43_epallocreq(FAR struct usbdev_ep_s *ep)
return &privreq->req;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epfreereq
*
* Description:
* Free an I/O request
*
*******************************************************************************/
****************************************************************************/
static void lpc43_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2113,13 +2113,13 @@ static void lpc43_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
kmm_free(privreq);
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epallocbuffer
*
* Description:
* Allocate an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void *lpc43_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
@ -2134,13 +2134,13 @@ static void *lpc43_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epfreebuffer
*
* Description:
* Free an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void lpc43_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
@ -2155,13 +2155,13 @@ static void lpc43_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epsubmit
*
* Description:
* Submit an I/O request to the endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc43_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2227,13 +2227,13 @@ static int lpc43_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epcancel
*
* Description:
* Cancel an I/O request previously sent to an endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc43_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
{
@ -2263,13 +2263,13 @@ static int lpc43_epcancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_epstall
*
* Description:
* Stall or resume and endpoint
*
*******************************************************************************/
****************************************************************************/
static int lpc43_epstall(FAR struct usbdev_ep_s *ep, bool resume)
{
@ -2304,11 +2304,11 @@ static int lpc43_epstall(FAR struct usbdev_ep_s *ep, bool resume)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: lpc43_allocep
*
* Description:
@ -2322,7 +2322,7 @@ static int lpc43_epstall(FAR struct usbdev_ep_s *ep, bool resume)
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_ep_s *lpc43_allocep(FAR struct usbdev_s *dev, uint8_t eplog,
bool in, uint8_t eptype)
@ -2435,13 +2435,13 @@ static FAR struct usbdev_ep_s *lpc43_allocep(FAR struct usbdev_s *dev, uint8_t e
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_freeep
*
* Description:
* Free the previously allocated endpoint
*
*******************************************************************************/
****************************************************************************/
static void lpc43_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
{
@ -2461,13 +2461,13 @@ static void lpc43_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
}
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_getframe
*
* Description:
* Returns the current frame number
*
*******************************************************************************/
****************************************************************************/
static int lpc43_getframe(struct usbdev_s *dev)
{
@ -2489,13 +2489,13 @@ static int lpc43_getframe(struct usbdev_s *dev)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_wakeup
*
* Description:
* Tries to wake up the host connected to this device
*
*******************************************************************************/
****************************************************************************/
static int lpc43_wakeup(struct usbdev_s *dev)
{
@ -2509,13 +2509,13 @@ static int lpc43_wakeup(struct usbdev_s *dev)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_selfpowered
*
* Description:
* Sets/clears the device selfpowered feature
*
*******************************************************************************/
****************************************************************************/
static int lpc43_selfpowered(struct usbdev_s *dev, bool selfpowered)
{
@ -2535,13 +2535,13 @@ static int lpc43_selfpowered(struct usbdev_s *dev, bool selfpowered)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: lpc43_pullup
*
* Description:
* Software-controlled connect to/disconnect from USB host
*
*******************************************************************************/
****************************************************************************/
static int lpc43_pullup(struct usbdev_s *dev, bool enable)
{
@ -2561,11 +2561,11 @@ static int lpc43_pullup(struct usbdev_s *dev, bool enable)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_usbinitialize
*
* Description:
@ -2576,7 +2576,7 @@ static int lpc43_pullup(struct usbdev_s *dev, bool enable)
* - PLL initialization is not performed here but should been in
* the low-level boot logic: PLL0 must be configured for operation at 480MHz
*
*******************************************************************************/
****************************************************************************/
void up_usbinitialize(void)
{
@ -2712,9 +2712,9 @@ errout:
up_usbuninitialize();
}
/*******************************************************************************
/****************************************************************************
* Name: up_usbuninitialize
*******************************************************************************/
****************************************************************************/
void up_usbuninitialize(void)
{
@ -2753,14 +2753,14 @@ void up_usbuninitialize(void)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_register
*
* Description:
* Register a USB device class driver. The class driver's bind() method will be
* called to bind it to a USB device driver.
*
*******************************************************************************/
****************************************************************************/
int usbdev_register(struct usbdevclass_driver_s *driver)
{
@ -2815,7 +2815,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_unregister
*
* Description:
@ -2823,7 +2823,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
* it will first disconnect(). The driver is also requested to unbind() and clean
* up any device state, before this procedure finally returns.
*
*******************************************************************************/
****************************************************************************/
int usbdev_unregister(struct usbdevclass_driver_s *driver)
{

View file

@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/arm/src/moxart/moxart_irq.c
* Driver for MoxaRT IRQ controller
*

View file

@ -108,7 +108,7 @@
* Wait until the console is ready to add another character to the TX
* FIFO.
*
*****************************************************************************/
****************************************************************************/
#ifdef HAVE_SERIAL_CONSOLE
static inline void nuc_console_ready(void)
@ -142,7 +142,7 @@ static inline void nuc_console_ready(void)
* Description:
* Called at the very beginning of _start. Performs low level initialization.
*
*****************************************************************************/
****************************************************************************/
void nuc_lowsetup(void)
{
@ -323,7 +323,7 @@ void nuc_lowsetup(void)
* Description:
* Output one character to the UART using a simple polling method.
*
*****************************************************************************/
****************************************************************************/
void nuc_lowputc(uint32_t ch)
{
@ -353,7 +353,7 @@ void nuc_lowputc(uint32_t ch)
* Here we assume that the default clock source for the UART modules is
* the external high speed crystal.
*
*****************************************************************************/
****************************************************************************/
#ifdef HAVE_UART
void nuc_setbaud(uintptr_t base, uint32_t baud)

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/sam34/sam_twi.c
*
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
@ -40,11 +40,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -72,9 +72,9 @@
#if defined(CONFIG_SAM34_TWI0) || defined(CONFIG_SAM34_TWI1)
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
#ifndef CONFIG_SAM34_TWI0_FREQUENCY
@ -110,9 +110,9 @@
# define i2cllvdbg(x...)
#endif
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
struct twi_dev_s
{
@ -144,9 +144,9 @@ struct twi_dev_s
#endif
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Low-level helper functions */
@ -216,9 +216,9 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv,
static void twi_hw_initialize(struct twi_dev_s *priv, unsigned int pid,
uint32_t frequency);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAM34_TWI0
static struct twi_dev_s g_twi0;
@ -407,7 +407,7 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset,
* I2C transfer helper functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: twi_wait
*
* Description:
@ -416,7 +416,7 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset,
* Assumptions:
* Interrupts are disabled
*
*******************************************************************************/
****************************************************************************/
static int twi_wait(struct twi_dev_s *priv)
{
@ -441,13 +441,13 @@ static int twi_wait(struct twi_dev_s *priv)
return priv->result;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_wakeup
*
* Description:
* A terminal event has occurred. Wake-up the waiting thread
*
*******************************************************************************/
****************************************************************************/
static void twi_wakeup(struct twi_dev_s *priv, int result)
{
@ -465,13 +465,13 @@ static void twi_wakeup(struct twi_dev_s *priv, int result)
twi_givesem(&priv->waitsem);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_interrupt
*
* Description:
* The TWI Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int twi_interrupt(struct twi_dev_s *priv)
{
@ -605,7 +605,7 @@ static int twi1_interrupt(int irq, FAR void *context)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_timeout
*
* Description:
@ -614,7 +614,7 @@ static int twi1_interrupt(int irq, FAR void *context)
* Assumptions:
* Called from the timer interrupt handler with interrupts disabled.
*
*******************************************************************************/
****************************************************************************/
static void twi_timeout(int argc, uint32_t arg, ...)
{
@ -624,13 +624,13 @@ static void twi_timeout(int argc, uint32_t arg, ...)
twi_wakeup(priv, -ETIMEDOUT);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startread
*
* Description:
* Start the next read message
*
*******************************************************************************/
****************************************************************************/
static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -661,13 +661,13 @@ static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
twi_putrel(priv, SAM_TWI_CR_OFFSET, TWI_CR_START);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startwrite
*
* Description:
* Start the next write message
*
*******************************************************************************/
****************************************************************************/
static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -694,13 +694,13 @@ static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg)
twi_putrel(priv, SAM_TWI_IER_OFFSET, TWI_INT_TXRDY | TWI_INT_ERRORS);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startmessage
*
* Description:
* Start the next write message
*
*******************************************************************************/
****************************************************************************/
static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -714,17 +714,17 @@ static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
}
}
/*******************************************************************************
/****************************************************************************
* I2C device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: twi_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t twi_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
@ -744,13 +744,13 @@ static uint32_t twi_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return actual;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int twi_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -772,14 +772,14 @@ static int twi_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int twi_write(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer, int wbuflen)
{
@ -838,14 +838,14 @@ static int twi_write(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer, int wbuf
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int twi_read(FAR struct i2c_dev_s *dev, uint8_t *rbuffer, int rbuflen)
{
@ -904,12 +904,12 @@ static int twi_read(FAR struct i2c_dev_s *dev, uint8_t *rbuffer, int rbuflen)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_writeread
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_WRITEREAD
static int twi_writeread(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer,
@ -971,12 +971,12 @@ static int twi_writeread(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_setownaddress
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_SLAVE
static int twi_setownaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
@ -986,12 +986,12 @@ static int twi_setownaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_registercallback
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_SLAVE
static int twi_registercallback(FAR struct i2c_dev_s *dev,
@ -1002,14 +1002,14 @@ static int twi_registercallback(FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_transfer
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_TRANSFER
static int twi_transfer(FAR struct i2c_dev_s *dev,
@ -1055,17 +1055,17 @@ static int twi_transfer(FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Initialization
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: twi_hw_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
{
@ -1115,13 +1115,13 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
return actual;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_hw_initialize
*
* Description:
* Initialize one TWI peripheral for I2C operation
*
*******************************************************************************/
****************************************************************************/
static void twi_hw_initialize(struct twi_dev_s *priv, unsigned int pid,
uint32_t frequency)
@ -1191,17 +1191,17 @@ static void twi_hw_initialize(struct twi_dev_s *priv, unsigned int pid,
(void)twi_hw_setfrequency(priv, frequency);
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialize a TWI device for I2C operation
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int bus)
{
@ -1305,13 +1305,13 @@ struct i2c_dev_s *up_i2cinitialize(int bus)
return &priv->dev;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialise an I2C device
*
*******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s * dev)
{

View file

@ -594,13 +594,13 @@ const struct trace_msg_t g_usb_trace_strings_intdecode[] =
/****************************************************************************
* Register Operations
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: sam_printreg
*
* Description:
* Print the contents of a SAM34 UDP registers
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAM34_UDP_REGDEBUG
static void sam_printreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
@ -609,14 +609,14 @@ static void sam_printreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_checkreg
*
* Description:
* Check if it is time to output debug information for accesses to a SAM34
* UDP registers
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAM34_UDP_REGDEBUG
static void sam_checkreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
@ -674,13 +674,13 @@ static void sam_checkreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_getreg
*
* Description:
* Get the contents of an SAM34 register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAM34_UDP_REGDEBUG
static uint32_t sam_getreg(uintptr_t regaddr)
@ -701,13 +701,13 @@ static inline uint32_t sam_getreg(uintptr_t regaddr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_putreg
*
* Description:
* Set the contents of an SAM34 register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAM34_UDP_REGDEBUG
static void sam_putreg(uint32_t regval, uintptr_t regaddr)

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/sama5/sam_ohci.c
*
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -75,9 +75,9 @@
#ifdef CONFIG_SAMA5_OHCI
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
/* Pre-requisites */
@ -207,9 +207,9 @@
#define RHPNDX(rh) ((rh)->hport.hport.port)
#define RHPORT(rh) (RHPNDX(rh)+1)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* This structure contains one endpoint list. The main reason for the existence
* of this structure is to contain the sem_t value associated with the ED. It
* doesn't work well within the ED itself because then the semaphore counter
@ -335,9 +335,9 @@ struct sam_list_s
/* Variable length buffer data follows */
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Register operations ********************************************************/
@ -463,9 +463,9 @@ static int sam_connect(struct usbhost_driver_s *drvr,
static void sam_disconnect(struct usbhost_driver_s *drvr,
struct usbhost_hubport_s *hport);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* In this driver implementation, support is provided for only a single a single
* USB device. All status information can be simply retained in a single global
@ -505,21 +505,21 @@ static struct sam_gtd_s g_tdalloc[SAMA5_OHCI_NTDS]
static uint8_t g_bufalloc[SAM_BUFALLOC]
__attribute__ ((aligned (SAMA5_DMA_ALIGN)));
/*******************************************************************************
/****************************************************************************
* Public Data
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: sam_printreg
*
* Description:
* Print the contents of an SAMA5 OHCI register operation
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_OHCI_REGDEBUG
static void sam_printreg(uint32_t addr, uint32_t val, bool iswrite)
@ -528,13 +528,13 @@ static void sam_printreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_checkreg
*
* Description:
* Get the contents of an SAMA5 OHCI register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_OHCI_REGDEBUG
static void sam_checkreg(uint32_t addr, uint32_t val, bool iswrite)
@ -592,13 +592,13 @@ static void sam_checkreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_getreg
*
* Description:
* Get the contents of an SAMA5 register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_OHCI_REGDEBUG
static uint32_t sam_getreg(uint32_t addr)
@ -614,13 +614,13 @@ static uint32_t sam_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_putreg
*
* Description:
* Set the contents of an SAMA5 register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_OHCI_REGDEBUG
static void sam_putreg(uint32_t val, uint32_t addr)
@ -642,7 +642,7 @@ static void sam_putreg(uint32_t val, uint32_t addr)
* This is just a wrapper to handle the annoying behavior of semaphore
* waits that return due to the receipt of a signal.
*
*******************************************************************************/
****************************************************************************/
static void sam_takesem(sem_t *sem)
{
@ -664,7 +664,7 @@ static void sam_takesem(sem_t *sem)
* Description:
* Get a (possibly unaligned) 16-bit little endian value.
*
*******************************************************************************/
****************************************************************************/
static inline uint16_t sam_getle16(const uint8_t *val)
{
@ -677,7 +677,7 @@ static inline uint16_t sam_getle16(const uint8_t *val)
* Description:
* Put a (possibly unaligned) 16-bit little endian value.
*
*******************************************************************************/
****************************************************************************/
#if 0 /* Not used */
static void sam_putle16(uint8_t *dest, uint16_t val)
@ -687,13 +687,13 @@ static void sam_putle16(uint8_t *dest, uint16_t val)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_edalloc
*
* Description:
* Allocate an endpoint descriptor by removing it from the free list
*
*******************************************************************************/
****************************************************************************/
static struct sam_ed_s *sam_edalloc(void)
{
@ -710,13 +710,13 @@ static struct sam_ed_s *sam_edalloc(void)
return ed;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_edfree
*
* Description:
* Free an endpoint descriptor by returning to the free list
*
*******************************************************************************/
****************************************************************************/
static inline void sam_edfree(struct sam_ed_s *ed)
{
@ -728,7 +728,7 @@ static inline void sam_edfree(struct sam_ed_s *ed)
g_edfree = entry;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_tdalloc
*
* Description:
@ -740,7 +740,7 @@ static inline void sam_edfree(struct sam_ed_s *ed)
* handler
* - Protection from re-entrance must be assured by the caller
*
*******************************************************************************/
****************************************************************************/
static struct sam_gtd_s *sam_tdalloc(void)
{
@ -762,7 +762,7 @@ static struct sam_gtd_s *sam_tdalloc(void)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_tdfree
*
* Description:
@ -772,7 +772,7 @@ static struct sam_gtd_s *sam_tdalloc(void)
* - Only called from the WDH interrupt handler (and during initialization).
* - Interrupts are disabled in any case.
*
*******************************************************************************/
****************************************************************************/
static void sam_tdfree(struct sam_gtd_s *td)
{
@ -783,7 +783,7 @@ static void sam_tdfree(struct sam_gtd_s *td)
g_tdfree = tdfree;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_tballoc
*
* Description:
@ -793,7 +793,7 @@ static void sam_tdfree(struct sam_gtd_s *td)
* - Never called from an interrupt handler.
* - Protection from re-entrance must be assured by the caller
*
*******************************************************************************/
****************************************************************************/
static uint8_t *sam_tballoc(void)
{
@ -806,13 +806,13 @@ static uint8_t *sam_tballoc(void)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_tbfree
*
* Description:
* Return an request/descriptor transfer buffer to the free list
*
*******************************************************************************/
****************************************************************************/
static void sam_tbfree(uint8_t *buffer)
{
@ -825,13 +825,13 @@ static void sam_tbfree(uint8_t *buffer)
}
}
/*******************************************************************************
/****************************************************************************
* Name: sam_addctrled
*
* Description:
* Helper function to add an ED to the control list.
*
*******************************************************************************/
****************************************************************************/
static int sam_addctrled(struct sam_ed_s *ed)
{
@ -866,13 +866,13 @@ static int sam_addctrled(struct sam_ed_s *ed)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_remctrled
*
* Description:
* Helper function remove an ED from the control list.
*
*******************************************************************************/
****************************************************************************/
static inline int sam_remctrled(struct sam_ed_s *ed)
{
@ -942,13 +942,13 @@ static inline int sam_remctrled(struct sam_ed_s *ed)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_addbulked
*
* Description:
* Helper function to add an ED to the bulk list.
*
*******************************************************************************/
****************************************************************************/
static inline int sam_addbulked(struct sam_ed_s *ed)
{
@ -987,13 +987,13 @@ static inline int sam_addbulked(struct sam_ed_s *ed)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: sam_rembulked
*
* Description:
* Helper function remove an ED from the bulk list.
*
*******************************************************************************/
****************************************************************************/
static inline int sam_rembulked(struct sam_ed_s *ed)
{
@ -1067,13 +1067,13 @@ static inline int sam_rembulked(struct sam_ed_s *ed)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: sam_getinterval
*
* Description:
* Convert the endpoint polling interval into a HCCA table increment
*
*******************************************************************************/
****************************************************************************/
#if !defined(CONFIG_USBHOST_INT_DISABLE) || !defined(CONFIG_USBHOST_ISOC_DISABLE)
static unsigned int sam_getinterval(uint8_t interval)
@ -1106,14 +1106,14 @@ static unsigned int sam_getinterval(uint8_t interval)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_setinttab
*
* Description:
* Set the interrupt table to the selected value using the provided interval
* and offset.
*
*******************************************************************************/
****************************************************************************/
#if !defined(CONFIG_USBHOST_INT_DISABLE) || !defined(CONFIG_USBHOST_ISOC_DISABLE)
static void sam_setinttab(uint32_t value, unsigned int interval, unsigned int offset)
@ -1135,7 +1135,7 @@ static void sam_setinttab(uint32_t value, unsigned int interval, unsigned int of
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_addinted
*
* Description:
@ -1153,7 +1153,7 @@ static void sam_setinttab(uint32_t value, unsigned int interval, unsigned int of
* 1. The minimum support polling rate is 2MS, and
* 2. Some devices may get polled at a much higher rate than they request.
*
*******************************************************************************/
****************************************************************************/
static inline int sam_addinted(const struct usbhost_epdesc_s *epdesc,
struct sam_ed_s *ed)
@ -1254,7 +1254,7 @@ static inline int sam_addinted(const struct usbhost_epdesc_s *epdesc,
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: sam_reminted
*
* Description:
@ -1272,7 +1272,7 @@ static inline int sam_addinted(const struct usbhost_epdesc_s *epdesc,
* 1. The minimum support polling rate is 2MS, and
* 2. Some devices may get polled at a much higher rate than they request.
*
*******************************************************************************/
****************************************************************************/
static inline int sam_reminted(struct sam_ed_s *ed)
{
@ -1409,13 +1409,13 @@ static inline int sam_reminted(struct sam_ed_s *ed)
#endif
}
/*******************************************************************************
/****************************************************************************
* Name: sam_addisoced
*
* Description:
* Helper functions to add an ED to the periodic table.
*
*******************************************************************************/
****************************************************************************/
static inline int sam_addisoced(const struct usbhost_epdesc_s *epdesc,
struct sam_ed_s *ed)
@ -1427,13 +1427,13 @@ static inline int sam_addisoced(const struct usbhost_epdesc_s *epdesc,
}
/*******************************************************************************
/****************************************************************************
* Name: sam_remisoced
*
* Description:
* Helper functions to remove an ED from the periodic table.
*
*******************************************************************************/
****************************************************************************/
static inline int sam_remisoced(struct sam_ed_s *ed)
{
@ -1443,14 +1443,14 @@ static inline int sam_remisoced(struct sam_ed_s *ed)
return -ENOSYS;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_enqueuetd
*
* Description:
* Enqueue a transfer descriptor. Notice that this function only supports
* queue on TD per ED.
*
*******************************************************************************/
****************************************************************************/
static int sam_enqueuetd(struct sam_rhport_s *rhport, struct sam_eplist_s *eplist,
struct sam_ed_s *ed, uint32_t dirpid, uint32_t toggle,
@ -1531,7 +1531,7 @@ static int sam_enqueuetd(struct sam_rhport_s *rhport, struct sam_eplist_s *eplis
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_ep0enqueue
*
* Description:
@ -1544,7 +1544,7 @@ static int sam_enqueuetd(struct sam_rhport_s *rhport, struct sam_eplist_s *eplis
* Returned Values:
* None
*
*******************************************************************************/
****************************************************************************/
static int sam_ep0enqueue(struct sam_rhport_s *rhport)
{
@ -1616,7 +1616,7 @@ static int sam_ep0enqueue(struct sam_rhport_s *rhport)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_ep0dequeue
*
* Description:
@ -1630,7 +1630,7 @@ static int sam_ep0enqueue(struct sam_rhport_s *rhport)
* Returned Values:
* None
*
*******************************************************************************/
****************************************************************************/
static void sam_ep0dequeue(struct sam_eplist_s *ep0)
{
@ -1727,7 +1727,7 @@ static void sam_ep0dequeue(struct sam_eplist_s *ep0)
ep0->tail = NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_wdhwait
*
* Description:
@ -1736,7 +1736,7 @@ static void sam_ep0dequeue(struct sam_eplist_s *ep0)
* We do this to minimize race conditions. This logic would have to be
* expanded if we want to have more than one packet in flight at a time!
*
*******************************************************************************/
****************************************************************************/
static int sam_wdhwait(struct sam_rhport_s *rhport, struct sam_ed_s *ed,
uint8_t *buffer, uint16_t buflen)
@ -1773,7 +1773,7 @@ static int sam_wdhwait(struct sam_rhport_s *rhport, struct sam_ed_s *ed,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_wdhasynch
*
* Description:
@ -1782,7 +1782,7 @@ static int sam_wdhwait(struct sam_rhport_s *rhport, struct sam_ed_s *ed,
* transfer). We do this to minimize race conditions. This logic would have
* to be expanded if we want to have more than one packet in flight at a time!
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBHOST_ASYNCH
static int sam_wdhasynch(struct sam_rhport_s *rhport, struct sam_ed_s *ed,
@ -1820,7 +1820,7 @@ static int sam_wdhasynch(struct sam_rhport_s *rhport, struct sam_ed_s *ed,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_ctrltd
*
* Description:
@ -1832,7 +1832,7 @@ static int sam_wdhasynch(struct sam_rhport_s *rhport, struct sam_ed_s *ed,
* These are blocking methods; these functions will not return until the
* control transfer has completed.
*
*******************************************************************************/
****************************************************************************/
static int sam_ctrltd(struct sam_rhport_s *rhport, struct sam_eplist_s *eplist,
uint32_t dirpid, uint8_t *buffer, size_t buflen)
@ -1926,13 +1926,13 @@ static int sam_ctrltd(struct sam_rhport_s *rhport, struct sam_eplist_s *eplist,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_rhsc_bottomhalf
*
* Description:
* OHCI root hub status change interrupt handler
*
*******************************************************************************/
****************************************************************************/
static void sam_rhsc_bottomhalf(void)
{
@ -2074,13 +2074,13 @@ static void sam_rhsc_bottomhalf(void)
}
}
/*******************************************************************************
/****************************************************************************
* Name: sam_wdh_bottomhalf
*
* Description:
* OHCI write done head interrupt handler
*
*******************************************************************************/
****************************************************************************/
static void sam_wdh_bottomhalf(void)
{
@ -2224,7 +2224,7 @@ static void sam_wdh_bottomhalf(void)
}
}
/*******************************************************************************
/****************************************************************************
* Name: sam_ohci_bottomhalf
*
* Description:
@ -2234,7 +2234,7 @@ static void sam_wdh_bottomhalf(void)
* disabled when this function is scheduled so no further interrupts can
* occur until this work re-enables OHCI interrupts
*
*******************************************************************************/
****************************************************************************/
static void sam_ohci_bottomhalf(void *arg)
{
@ -2301,11 +2301,11 @@ static void sam_ohci_bottomhalf(void *arg)
sam_givesem(&g_ohci.exclsem);
}
/*******************************************************************************
/****************************************************************************
* USB Host Controller Operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: sam_wait
*
* Description:
@ -2328,7 +2328,7 @@ static void sam_ohci_bottomhalf(void *arg)
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int sam_wait(struct usbhost_connection_s *conn,
struct usbhost_hubport_s **hport)
@ -2416,7 +2416,7 @@ static int sam_wait(struct usbhost_connection_s *conn,
}
}
/*******************************************************************************
/****************************************************************************
* Name: sam_enumerate
*
* Description:
@ -2442,7 +2442,7 @@ static int sam_wait(struct usbhost_connection_s *conn,
* Assumptions:
* This function will *not* be called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int sam_rh_enumerate(struct usbhost_connection_s *conn,
struct usbhost_hubport_s *hport)
@ -2894,7 +2894,7 @@ static int sam_epfree(struct usbhost_driver_s *drvr, usbhost_ep_t ep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_alloc
*
* Description:
@ -2924,7 +2924,7 @@ static int sam_epfree(struct usbhost_driver_s *drvr, usbhost_ep_t ep)
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int sam_alloc(struct usbhost_driver_s *drvr,
uint8_t **buffer, size_t *maxlen)
@ -2947,7 +2947,7 @@ static int sam_alloc(struct usbhost_driver_s *drvr,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_free
*
* Description:
@ -2968,7 +2968,7 @@ static int sam_alloc(struct usbhost_driver_s *drvr,
* Assumptions:
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int sam_free(struct usbhost_driver_s *drvr, uint8_t *buffer)
{
@ -3053,7 +3053,7 @@ static int sam_iofree(struct usbhost_driver_s *drvr, uint8_t *buffer)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_ctrlin and sam_ctrlout
*
* Description:
@ -3087,7 +3087,7 @@ static int sam_iofree(struct usbhost_driver_s *drvr, uint8_t *buffer)
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int sam_ctrlin(struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
const struct usb_ctrlreq_s *req,
@ -3183,7 +3183,7 @@ static int sam_ctrlout(struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_transfer_common
*
* Description:
@ -3207,7 +3207,7 @@ static int sam_ctrlout(struct usbhost_driver_s *drvr, usbhost_ep_t ep0,
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static int sam_transfer_common(struct sam_rhport_s *rhport,
struct sam_eplist_s *eplist,
@ -3267,7 +3267,7 @@ static int sam_transfer_common(struct sam_rhport_s *rhport,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_transfer
*
* Description:
@ -3302,7 +3302,7 @@ static int sam_transfer_common(struct sam_rhport_s *rhport,
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static ssize_t sam_transfer(struct usbhost_driver_s *drvr, usbhost_ep_t ep,
uint8_t *buffer, size_t buflen)
@ -3425,7 +3425,7 @@ errout:
return (ssize_t)ret;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_asynch_completion
*
* Description:
@ -3443,7 +3443,7 @@ errout:
* Assumptions:
* - Called from the interrupt level
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBHOST_ASYNCH
static void sam_asynch_completion(struct sam_eplist_s *eplist)
@ -3522,7 +3522,7 @@ static void sam_asynch_completion(struct sam_eplist_s *eplist)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_asynch
*
* Description:
@ -3555,7 +3555,7 @@ static void sam_asynch_completion(struct sam_eplist_s *eplist)
* - Called from a single thread so no mutual exclusion is required.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBHOST_ASYNCH
static int sam_asynch(struct usbhost_driver_s *drvr, usbhost_ep_t ep,
@ -3807,7 +3807,7 @@ static int sam_connect(struct usbhost_driver_s *drvr,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_disconnect
*
* Description:
@ -3830,7 +3830,7 @@ static int sam_connect(struct usbhost_driver_s *drvr,
* - Only a single class bound to a single device is supported.
* - Never called from an interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void sam_disconnect(struct usbhost_driver_s *drvr,
struct usbhost_hubport_s *hport)
@ -3858,11 +3858,11 @@ static void sam_disconnect(struct usbhost_driver_s *drvr,
hport->devclass = NULL;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: sam_ohci_initialize
*
* Description:
@ -3885,7 +3885,7 @@ static void sam_disconnect(struct usbhost_driver_s *drvr,
* - Class drivers should be initialized prior to calling this function.
* Otherwise, there is a race condition if the device is already connected.
*
*******************************************************************************/
****************************************************************************/
struct usbhost_connection_s *sam_ohci_initialize(int controller)
{
@ -4157,7 +4157,7 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller)
return &g_ohciconn;
}
/*******************************************************************************
/****************************************************************************
* Name: sam_ohci_tophalf
*
* Description:
@ -4165,7 +4165,7 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller)
* EHCI will manage the common UHPHS interrupt and will forward the interrupt
* event to this function.
*
*******************************************************************************/
****************************************************************************/
int sam_ohci_tophalf(int irq, void *context)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/sama5/sam_twi.c
*
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
@ -40,11 +40,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -74,9 +74,9 @@
#if defined(CONFIG_SAMA5_TWI0) || defined(CONFIG_SAMA5_TWI1) || \
defined(CONFIG_SAMA5_TWI2) || defined(CONFIG_SAMA5_TWI3)
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
#ifndef CONFIG_SAMA5_TWI0_FREQUENCY
@ -138,9 +138,9 @@
# define i2cllvdbg(x...)
#endif
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* Invariant attributes of a TWI bus */
struct twi_attr_s
@ -185,9 +185,9 @@ struct twi_dev_s
#endif
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Low-level helper functions */
@ -262,9 +262,9 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv,
uint32_t frequency);
static void twi_hw_initialize(struct twi_dev_s *priv, uint32_t frequency);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_TWI0
static const struct twi_attr_s g_twi0attr =
@ -505,7 +505,7 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset,
* I2C transfer helper functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: twi_wait
*
* Description:
@ -514,7 +514,7 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset,
* Assumptions:
* Interrupts are disabled
*
*******************************************************************************/
****************************************************************************/
static int twi_wait(struct twi_dev_s *priv, unsigned int size)
{
@ -557,13 +557,13 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size)
return priv->result;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_wakeup
*
* Description:
* A terminal event has occurred. Wake-up the waiting thread
*
*******************************************************************************/
****************************************************************************/
static void twi_wakeup(struct twi_dev_s *priv, int result)
{
@ -581,13 +581,13 @@ static void twi_wakeup(struct twi_dev_s *priv, int result)
twi_givesem(&priv->waitsem);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_interrupt
*
* Description:
* The TWI Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int twi_interrupt(struct twi_dev_s *priv)
{
@ -734,7 +734,7 @@ static int twi3_interrupt(int irq, FAR void *context)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_timeout
*
* Description:
@ -743,7 +743,7 @@ static int twi3_interrupt(int irq, FAR void *context)
* Assumptions:
* Called from the timer interrupt handler with interrupts disabled.
*
*******************************************************************************/
****************************************************************************/
static void twi_timeout(int argc, uint32_t arg, ...)
{
@ -753,13 +753,13 @@ static void twi_timeout(int argc, uint32_t arg, ...)
twi_wakeup(priv, -ETIMEDOUT);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startread
*
* Description:
* Start the next read message
*
*******************************************************************************/
****************************************************************************/
static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -791,13 +791,13 @@ static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
twi_putrel(priv, SAM_TWI_CR_OFFSET, TWI_CR_START);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startwrite
*
* Description:
* Start the next write message
*
*******************************************************************************/
****************************************************************************/
static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -824,13 +824,13 @@ static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg)
twi_putrel(priv, SAM_TWI_IER_OFFSET, TWI_INT_TXRDY | TWI_INT_ERRORS);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startmessage
*
* Description:
* Start the next write message
*
*******************************************************************************/
****************************************************************************/
static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -844,17 +844,17 @@ static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
}
}
/*******************************************************************************
/****************************************************************************
* I2C device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: twi_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t twi_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
@ -874,13 +874,13 @@ static uint32_t twi_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return actual;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int twi_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -902,14 +902,14 @@ static int twi_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int twi_write(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer, int wbuflen)
{
@ -960,14 +960,14 @@ static int twi_write(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer, int wbuf
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int twi_read(FAR struct i2c_dev_s *dev, uint8_t *rbuffer, int rbuflen)
{
@ -1018,12 +1018,12 @@ static int twi_read(FAR struct i2c_dev_s *dev, uint8_t *rbuffer, int rbuflen)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_writeread
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_WRITEREAD
static int twi_writeread(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer,
@ -1095,12 +1095,12 @@ static int twi_writeread(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_setownaddress
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_SLAVE
static int twi_setownaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
@ -1110,12 +1110,12 @@ static int twi_setownaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_registercallback
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_SLAVE
static int twi_registercallback((FAR struct i2c_dev_s *dev,
@ -1126,7 +1126,7 @@ static int twi_registercallback((FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_transfer
*
* Description:
@ -1136,7 +1136,7 @@ static int twi_registercallback((FAR struct i2c_dev_s *dev,
* Returned Value:
* Returns zero on success; a negated errno value on failure.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_TRANSFER
static int twi_transfer(FAR struct i2c_dev_s *dev,
@ -1196,9 +1196,9 @@ static int twi_transfer(FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Initialization
*******************************************************************************/
****************************************************************************/
/****************************************************************************
* Name: twi_enableclk
@ -1227,13 +1227,13 @@ static void twi_enableclk(struct twi_dev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: twi_hw_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
{
@ -1287,7 +1287,7 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
return actual;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_hw_initialize
*
* Description:
@ -1295,7 +1295,7 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
* repeatable initialization after either (1) the one-time initialization, or
* (2) after each bus reset.
*
*******************************************************************************/
****************************************************************************/
static void twi_hw_initialize(struct twi_dev_s *priv, uint32_t frequency)
{
@ -1384,17 +1384,17 @@ static void twi_hw_initialize(struct twi_dev_s *priv, uint32_t frequency)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialize a TWI device for I2C operation
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int bus)
{
@ -1512,13 +1512,13 @@ errout_with_irq:
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialize an I2C device
*
*******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s *dev)
{

View file

@ -660,13 +660,13 @@ const struct trace_msg_t g_usb_trace_strings_intdecode[] =
/****************************************************************************
* Register Operations
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: sam_printreg
*
* Description:
* Print the contents of a SAMA5 UDPHS register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_UDPHS_REGDEBUG
static void sam_printreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
@ -675,14 +675,14 @@ static void sam_printreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_checkreg
*
* Description:
* Check if it is time to output debug information for accesses to a SAMA5
* UDPHS register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_UDPHS_REGDEBUG
static void sam_checkreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
@ -740,13 +740,13 @@ static void sam_checkreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_getreg
*
* Description:
* Get the contents of an SAMA5 register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_UDPHS_REGDEBUG
static uint32_t sam_getreg(uintptr_t regaddr)
@ -767,13 +767,13 @@ static inline uint32_t sam_getreg(uintptr_t regaddr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_putreg
*
* Description:
* Set the contents of an SAMA5 register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMA5_UDPHS_REGDEBUG
static void sam_putreg(uint32_t regval, uintptr_t regaddr)

View file

@ -291,7 +291,7 @@ sam_pad_configure(const struct sam_usart_config_s * const config)
* This configures the SERCOM as a USART, but does not configure USART
* interrupts or enable the USART.
*
*****************************************************************************/
****************************************************************************/
#ifdef SAMDL_HAVE_USART
int sam_usart_internal(const struct sam_usart_config_s * const config)
@ -398,7 +398,7 @@ void sam_lowsetup(void)
* This configures the SERCOM as a USART, but does not configure USART
* interrupts or enable the USART.
*
*****************************************************************************/
****************************************************************************/
#ifdef SAMDL_HAVE_USART
int sam_usart_initialize(const struct sam_usart_config_s * const config)
@ -428,7 +428,7 @@ int sam_usart_initialize(const struct sam_usart_config_s * const config)
* Reset the USART SERCOM. This restores all SERCOM register to the
* initial state and disables the SERCOM.
*
*****************************************************************************/
****************************************************************************/
#ifdef SAMDL_HAVE_USART
void sam_usart_reset(const struct sam_usart_config_s * const config)
@ -457,7 +457,7 @@ void sam_usart_reset(const struct sam_usart_config_s * const config)
* Description:
* Output one character to the USART using a simple polling method.
*
*****************************************************************************/
****************************************************************************/
#ifdef HAVE_SERIAL_CONSOLE
void sam_lowputc(uint32_t ch)

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/samv7/sam_twihs.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
@ -40,11 +40,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -74,9 +74,9 @@
#if defined(CONFIG_SAMV7_TWIHS0) || defined(CONFIG_SAMV7_TWIHS1) || \
defined(CONFIG_SAMV7_TWIHS2)
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
#ifndef CONFIG_SAMV7_TWIHS0_FREQUENCY
@ -135,9 +135,9 @@
# define i2cllvdbg(x...)
#endif
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* Invariant attributes of a TWIHS bus */
struct twi_attr_s
@ -183,9 +183,9 @@ struct twi_dev_s
#endif
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Low-level helper functions */
@ -257,9 +257,9 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv,
uint32_t frequency);
static void twi_hw_initialize(struct twi_dev_s *priv, uint32_t frequency);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMV7_TWIHS0
static const struct twi_attr_s g_twi0attr =
@ -485,7 +485,7 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset,
* I2C transfer helper functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: twi_wait
*
* Description:
@ -494,7 +494,7 @@ static inline void twi_putrel(struct twi_dev_s *priv, unsigned int offset,
* Assumptions:
* Interrupts are disabled
*
*******************************************************************************/
****************************************************************************/
static int twi_wait(struct twi_dev_s *priv, unsigned int size)
{
@ -537,13 +537,13 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size)
return priv->result;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_wakeup
*
* Description:
* A terminal event has occurred. Wake-up the waiting thread
*
*******************************************************************************/
****************************************************************************/
static void twi_wakeup(struct twi_dev_s *priv, int result)
{
@ -561,13 +561,13 @@ static void twi_wakeup(struct twi_dev_s *priv, int result)
twi_givesem(&priv->waitsem);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_interrupt
*
* Description:
* The TWIHS Interrupt Handler
*
*******************************************************************************/
****************************************************************************/
static int twi_interrupt(struct twi_dev_s *priv)
{
@ -761,7 +761,7 @@ static int twi2_interrupt(int irq, FAR void *context)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_timeout
*
* Description:
@ -770,7 +770,7 @@ static int twi2_interrupt(int irq, FAR void *context)
* Assumptions:
* Called from the timer interrupt handler with interrupts disabled.
*
*******************************************************************************/
****************************************************************************/
static void twi_timeout(int argc, uint32_t arg, ...)
{
@ -780,13 +780,13 @@ static void twi_timeout(int argc, uint32_t arg, ...)
twi_wakeup(priv, -ETIMEDOUT);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startread
*
* Description:
* Start the next read message
*
*******************************************************************************/
****************************************************************************/
static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -818,13 +818,13 @@ static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
twi_putrel(priv, SAM_TWIHS_CR_OFFSET, TWIHS_CR_START);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startwrite
*
* Description:
* Start the next write message
*
*******************************************************************************/
****************************************************************************/
static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -851,13 +851,13 @@ static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg)
twi_putrel(priv, SAM_TWIHS_IER_OFFSET, TWIHS_INT_TXRDY | TWIHS_INT_ERRORS);
}
/*******************************************************************************
/****************************************************************************
* Name: twi_startmessage
*
* Description:
* Start the next write message
*
*******************************************************************************/
****************************************************************************/
static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
@ -871,17 +871,17 @@ static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg)
}
}
/*******************************************************************************
/****************************************************************************
* I2C device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: twi_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t twi_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
{
@ -901,13 +901,13 @@ static uint32_t twi_setfrequency(FAR struct i2c_dev_s *dev, uint32_t frequency)
return actual;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_setaddress
*
* Description:
* Set the I2C slave address for a subsequent read/write
*
*******************************************************************************/
****************************************************************************/
static int twi_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
{
@ -929,14 +929,14 @@ static int twi_setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_write
*
* Description:
* Send a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int twi_write(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer, int wbuflen)
{
@ -987,14 +987,14 @@ static int twi_write(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer, int wbuf
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_read
*
* Description:
* Receive a block of data on I2C using the previously selected I2C
* frequency and slave address.
*
*******************************************************************************/
****************************************************************************/
static int twi_read(FAR struct i2c_dev_s *dev, uint8_t *rbuffer, int rbuflen)
{
@ -1045,12 +1045,12 @@ static int twi_read(FAR struct i2c_dev_s *dev, uint8_t *rbuffer, int rbuflen)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_writeread
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_WRITEREAD
static int twi_writeread(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer,
@ -1122,12 +1122,12 @@ static int twi_writeread(FAR struct i2c_dev_s *dev, const uint8_t *wbuffer,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_setownaddress
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_SLAVE
static int twi_setownaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
@ -1137,12 +1137,12 @@ static int twi_setownaddress(FAR struct i2c_dev_s *dev, int addr, int nbits)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_registercallback
*
* Description:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_SLAVE
static int twi_registercallback((FAR struct i2c_dev_s *dev,
@ -1153,7 +1153,7 @@ static int twi_registercallback((FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: twi_transfer
*
* Description:
@ -1163,7 +1163,7 @@ static int twi_registercallback((FAR struct i2c_dev_s *dev,
* Returned Value:
* Returns zero on success; a negated errno value on failure.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_I2C_TRANSFER
static int twi_transfer(FAR struct i2c_dev_s *dev,
@ -1223,9 +1223,9 @@ static int twi_transfer(FAR struct i2c_dev_s *dev,
}
#endif
/*******************************************************************************
/****************************************************************************
* Initialization
*******************************************************************************/
****************************************************************************/
/****************************************************************************
* Name: twi_enableclk
@ -1254,13 +1254,13 @@ static void twi_enableclk(struct twi_dev_s *priv)
}
}
/*******************************************************************************
/****************************************************************************
* Name: twi_hw_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
*******************************************************************************/
****************************************************************************/
static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
{
@ -1314,7 +1314,7 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
return actual;
}
/*******************************************************************************
/****************************************************************************
* Name: twi_hw_initialize
*
* Description:
@ -1322,7 +1322,7 @@ static uint32_t twi_hw_setfrequency(struct twi_dev_s *priv, uint32_t frequency)
* repeatable initialization after either (1) the one-time initialization, or
* (2) after each bus reset.
*
*******************************************************************************/
****************************************************************************/
static void twi_hw_initialize(struct twi_dev_s *priv, uint32_t frequency)
{
@ -1411,17 +1411,17 @@ static void twi_hw_initialize(struct twi_dev_s *priv, uint32_t frequency)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_i2cinitialize
*
* Description:
* Initialize a TWIHS device for I2C operation
*
*******************************************************************************/
****************************************************************************/
struct i2c_dev_s *up_i2cinitialize(int bus)
{
@ -1535,13 +1535,13 @@ errout_with_irq:
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: up_i2cuninitalize
*
* Description:
* Uninitialize an I2C device
*
*******************************************************************************/
****************************************************************************/
int up_i2cuninitialize(FAR struct i2c_dev_s *dev)
{

View file

@ -709,13 +709,13 @@ const struct trace_msg_t g_usb_trace_strings_intdecode[] =
/****************************************************************************
* Register Operations
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: sam_printreg
*
* Description:
* Print the contents of a SAMV7 USBHS register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMV7_USBHS_REGDEBUG
static void sam_printreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
@ -724,14 +724,14 @@ static void sam_printreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_checkreg
*
* Description:
* Check if it is time to output debug information for accesses to a SAMV7
* USBHS register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMV7_USBHS_REGDEBUG
static void sam_checkreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
@ -789,13 +789,13 @@ static void sam_checkreg(uintptr_t regaddr, uint32_t regval, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_getreg
*
* Description:
* Get the contents of an SAMV7 register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMV7_USBHS_REGDEBUG
static uint32_t sam_getreg(uintptr_t regaddr)
@ -816,13 +816,13 @@ static inline uint32_t sam_getreg(uintptr_t regaddr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: sam_putreg
*
* Description:
* Set the contents of an SAMV7 register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMV7_USBHS_REGDEBUG
static void sam_putreg(uint32_t regval, uintptr_t regaddr)

View file

@ -1077,7 +1077,7 @@ static void adc_rccreset(struct stm32_dev_s *priv, bool reset)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: adc_power_down_idle
*
* Description : Enables or disables power down during the idle phase.
@ -1091,7 +1091,7 @@ static void adc_rccreset(struct stm32_dev_s *priv, bool reset)
* Returned Value:
* None.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_STM32_STM32L15XX
static void adc_power_down_idle(FAR struct stm32_dev_s *priv, bool pdi_high)
@ -1118,7 +1118,7 @@ static void adc_power_down_idle(FAR struct stm32_dev_s *priv, bool pdi_high)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: adc_power_down_delay
*
* Description : Enables or disables power down during the delay phase.
@ -1132,7 +1132,7 @@ static void adc_power_down_idle(FAR struct stm32_dev_s *priv, bool pdi_high)
* Returned Value:
* None.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_STM32_STM32L15XX
static void adc_power_down_delay(FAR struct stm32_dev_s *priv, bool pdd_high)
@ -1159,7 +1159,7 @@ static void adc_power_down_delay(FAR struct stm32_dev_s *priv, bool pdd_high)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: adc_dels_after_conversion
*
* Description : Defines the length of the delay which is applied
@ -1173,7 +1173,7 @@ static void adc_power_down_delay(FAR struct stm32_dev_s *priv, bool pdd_high)
*
* Returned Value:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_STM32_STM32L15XX
static void adc_dels_after_conversion(FAR struct stm32_dev_s *priv,
@ -1190,7 +1190,7 @@ static void adc_dels_after_conversion(FAR struct stm32_dev_s *priv,
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: adc_select_ch_bank
*
* Description : Selects the bank of channels to be converted
@ -1204,7 +1204,7 @@ static void adc_dels_after_conversion(FAR struct stm32_dev_s *priv,
*
* Returned Value:
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_STM32_STM32L15XX
static void adc_select_ch_bank(FAR struct stm32_dev_s *priv, bool chb_selected)
@ -1228,7 +1228,7 @@ static void adc_select_ch_bank(FAR struct stm32_dev_s *priv, bool chb_selected)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: adc_enable
*
* Description : Enables or disables the specified ADC peripheral.
@ -1242,7 +1242,7 @@ static void adc_select_ch_bank(FAR struct stm32_dev_s *priv, bool chb_selected)
*
* Returned Value:
*
*******************************************************************************/
****************************************************************************/
static void adc_enable(FAR struct stm32_dev_s *priv, bool enable)
{
@ -2693,7 +2693,7 @@ static int adc123_interrupt(int irq, void *context)
* Public Functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: adc_change_sample_time
*
* Description : Changes sample times for specified channels. This method
@ -2712,7 +2712,7 @@ static int adc123_interrupt(int irq, void *context)
* Returned Value:
* None.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_STM32_STM32L15XX
void stm32_adcchange_sample_time(FAR struct adc_dev_s *dev,

View file

@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/arm/src/stm32/stm32_dma2d.c
*
* Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
@ -34,11 +34,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -63,9 +63,9 @@
#include "chip/stm32_ccm.h"
#include "stm32_dma2d.h"
/******************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************/
****************************************************************************/
/* output, foreground and background layer */
@ -158,9 +158,9 @@
# error "Enable CONFIG_STM32_CCMEXCLUDE from the heap allocation"
#endif
/******************************************************************************
/****************************************************************************
* Private Types
******************************************************************************/
****************************************************************************/
/* DMA2D General layer information */
@ -275,9 +275,9 @@ static const uintptr_t stm32_cmar_layer_t[DMA2D_NLAYERS - 1] =
STM32_DMA2D_BGCMAR
};
/******************************************************************************
/****************************************************************************
* Private Function Prototypes
******************************************************************************/
****************************************************************************/
/* Private functions */
@ -348,9 +348,9 @@ static int stm32_dma2dblend(FAR struct dma2d_layer_s *dest,
static int stm32_dma2dfillarea(FAR struct dma2d_layer_s *layer,
FAR const struct ltdc_area_s *area, uint32_t color);
/******************************************************************************
/****************************************************************************
* Private Data
******************************************************************************/
****************************************************************************/
/* Remember the layer references for alloc/deallocation */
@ -384,15 +384,15 @@ static struct stm32_interrupt_s g_interrupt =
.sem = &g_semirq
};
/******************************************************************************
/****************************************************************************
* Public Data
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_control
*
* Description:
@ -477,7 +477,7 @@ static int stm32_dma2dirq(int irq, void *context)
return OK;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_waitforirq
*
* Description:
@ -522,7 +522,7 @@ static int stm32_dma2d_waitforirq(void)
#ifdef CONFIG_STM32_DMA2D_L8
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_loadclut
*
* Description:
@ -568,7 +568,7 @@ static int stm32_dma2d_loadclut(uintptr_t pfcreg)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_start
*
* Description:
@ -610,7 +610,7 @@ static int stm32_dma2d_start(void)
return ret;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_memaddress
*
* Description:
@ -622,7 +622,7 @@ static int stm32_dma2d_start(void)
* Return:
* memory address
*
*****************************************************************************/
****************************************************************************/
static uint32_t stm32_dma2d_memaddress(FAR const struct stm32_dma2d_s *layer,
fb_coord_t xpos, fb_coord_t ypos)
@ -636,7 +636,7 @@ static uint32_t stm32_dma2d_memaddress(FAR const struct stm32_dma2d_s *layer,
return ((uint32_t) pinfo->fbmem) + offset;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lineoffset
*
* Description:
@ -648,7 +648,7 @@ static uint32_t stm32_dma2d_memaddress(FAR const struct stm32_dma2d_s *layer,
* Return:
* line offset
*
*****************************************************************************/
****************************************************************************/
static fb_coord_t stm32_dma2d_lineoffset(FAR const struct stm32_dma2d_s *layer,
FAR const struct ltdc_area_s *area)
@ -659,7 +659,7 @@ static fb_coord_t stm32_dma2d_lineoffset(FAR const struct stm32_dma2d_s *layer,
return layer->vinfo.xres - area->xres;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_pixelformat
*
* Description:
@ -673,7 +673,7 @@ static fb_coord_t stm32_dma2d_lineoffset(FAR const struct stm32_dma2d_s *layer,
* On success - OK
* On error - -EINVAL
*
*****************************************************************************/
****************************************************************************/
static int stm32_dma2d_pixelformat(uint8_t fmt, uint8_t *fmtmap)
{
@ -718,7 +718,7 @@ static int stm32_dma2d_pixelformat(uint8_t fmt, uint8_t *fmtmap)
return OK;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_bpp
*
* Description:
@ -732,7 +732,7 @@ static int stm32_dma2d_pixelformat(uint8_t fmt, uint8_t *fmtmap)
* On success - OK
* On error - -EINVAL
*
*****************************************************************************/
****************************************************************************/
static int stm32_dma2d_bpp(uint8_t fmt, uint8_t *bpp)
{
@ -763,7 +763,7 @@ static int stm32_dma2d_bpp(uint8_t fmt, uint8_t *bpp)
return OK;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lfreelid
*
* Description:
@ -773,7 +773,7 @@ static int stm32_dma2d_bpp(uint8_t fmt, uint8_t *bpp)
* The number of the free layer
* -1 if no free layer is available
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2d_lfreelid(void)
{
@ -790,7 +790,7 @@ static int stm32_dma2d_lfreelid(void)
return -1;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lalloc
*
* Description:
@ -799,7 +799,7 @@ static int stm32_dma2d_lfreelid(void)
* Return:
* A new allocated layer structure or NULL on error.
*
******************************************************************************/
****************************************************************************/
static FAR struct stm32_dma2d_s * stm32_dma2d_lalloc(void)
{
@ -823,7 +823,7 @@ static FAR struct stm32_dma2d_s * stm32_dma2d_lalloc(void)
return layer;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lfree
*
* Description:
@ -832,7 +832,7 @@ static FAR struct stm32_dma2d_s * stm32_dma2d_lalloc(void)
* Input Parameters:
* A previous allocated layer structure
*
******************************************************************************/
****************************************************************************/
static void stm32_dma2d_lfree(FAR struct stm32_dma2d_s *layer)
{
@ -853,13 +853,13 @@ static void stm32_dma2d_lfree(FAR struct stm32_dma2d_s *layer)
}
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_llayerscleanup
*
* Description:
* Cleanup all allocated layers
*
******************************************************************************/
****************************************************************************/
static void stm32_dma2d_llayerscleanup(void)
{
@ -879,7 +879,7 @@ static void stm32_dma2d_llayerscleanup(void)
}
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lvalidate
*
* Description:
@ -888,7 +888,7 @@ static void stm32_dma2d_llayerscleanup(void)
* Return:
* true if validates otherwise false
*
******************************************************************************/
****************************************************************************/
static inline bool stm32_dma2d_lvalidate(FAR const struct stm32_dma2d_s *layer)
{
@ -921,7 +921,7 @@ static bool stm32_dma2d_lvalidatesize(FAR const struct stm32_dma2d_s *layer,
area->xres * area->yres);
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_linit
*
* Description:
@ -930,7 +930,7 @@ static bool stm32_dma2d_lvalidatesize(FAR const struct stm32_dma2d_s *layer,
* Parameter:
*
*
******************************************************************************/
****************************************************************************/
static void stm32_dma2d_linit(FAR struct stm32_dma2d_s *layer,
int lid, uint8_t fmt)
@ -968,7 +968,7 @@ static void stm32_dma2d_linit(FAR struct stm32_dma2d_s *layer,
layer->lock = &g_lock;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lfifo
*
* Description:
@ -992,7 +992,7 @@ static void stm32_dma2d_lfifo(FAR const struct stm32_dma2d_s *layer, int lid,
putreg32(stm32_dma2d_lineoffset(layer, area), stm32_or_layer_t[lid]);
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lcolor
*
* Description:
@ -1010,7 +1010,7 @@ static void stm32_dma2d_lcolor(FAR const struct stm32_dma2d_s *layer,
putreg32(color, stm32_color_layer_t[lid]);
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_llnr
*
* Description:
@ -1034,7 +1034,7 @@ static void stm32_dma2d_llnr(FAR struct stm32_dma2d_s *layer,
putreg32(nlrreg, STM32_DMA2D_NLR);
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_loutpfc
*
* Description:
@ -1067,7 +1067,7 @@ static int stm32_dma2d_loutpfc(FAR const struct stm32_dma2d_s *layer)
return OK;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2d_lpfc
*
* Description:
@ -1147,11 +1147,11 @@ static void stm32_dma2d_lpfc(FAR const struct stm32_dma2d_s *layer,
putreg32(pfccrreg, stm32_pfccr_layer_t[lid]);
}
/******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dgetvideoinfo
*
* Description:
@ -1165,7 +1165,7 @@ static void stm32_dma2d_lpfc(FAR const struct stm32_dma2d_s *layer,
* On success - OK
* On error - -EINVAL
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2dgetvideoinfo(FAR struct dma2d_layer_s *layer,
FAR struct fb_videoinfo_s *vinfo)
@ -1187,7 +1187,7 @@ static int stm32_dma2dgetvideoinfo(FAR struct dma2d_layer_s *layer,
return -ENOSYS;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dgetplaneinfo
*
* Description:
@ -1202,7 +1202,7 @@ static int stm32_dma2dgetvideoinfo(FAR struct dma2d_layer_s *layer,
* On success - OK
* On error - -EINVAL
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2dgetplaneinfo(FAR struct dma2d_layer_s *layer, int planeno,
FAR struct fb_planeinfo_s *pinfo)
@ -1224,7 +1224,7 @@ static int stm32_dma2dgetplaneinfo(FAR struct dma2d_layer_s *layer, int planeno,
return -EINVAL;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dgetlid
*
* Description:
@ -1238,7 +1238,7 @@ static int stm32_dma2dgetplaneinfo(FAR struct dma2d_layer_s *layer, int planeno,
* On success - OK
* On error - -EINVAL
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2dgetlid(FAR struct dma2d_layer_s *layer, int *lid)
{
@ -1259,7 +1259,7 @@ static int stm32_dma2dgetlid(FAR struct dma2d_layer_s *layer, int *lid)
}
#ifdef CONFIG_STM32_DMA2D_L8
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dsetclut
*
* Description:
@ -1274,7 +1274,7 @@ static int stm32_dma2dgetlid(FAR struct dma2d_layer_s *layer, int *lid)
* On success - OK
* On error - -EINVAL
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2dsetclut(FAR struct dma2d_layer_s *layer,
const FAR struct fb_cmap_s *cmap)
@ -1378,7 +1378,7 @@ static int stm32_dma2dsetclut(FAR struct dma2d_layer_s *layer,
return -EINVAL;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dgetclut
*
* Description:
@ -1393,7 +1393,7 @@ static int stm32_dma2dsetclut(FAR struct dma2d_layer_s *layer,
* On success - OK
* On error - -EINVAL
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2dgetclut(FAR struct dma2d_layer_s *layer,
FAR struct fb_cmap_s *cmap)
@ -1466,7 +1466,7 @@ static int stm32_dma2dgetclut(FAR struct dma2d_layer_s *layer,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dsetalpha
*
* Description:
@ -1485,7 +1485,7 @@ static int stm32_dma2dgetclut(FAR struct dma2d_layer_s *layer,
* On success - OK
* On error - -EINVAL
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2dsetalpha(FAR struct dma2d_layer_s *layer, uint8_t alpha)
{
@ -1506,7 +1506,7 @@ static int stm32_dma2dsetalpha(FAR struct dma2d_layer_s *layer, uint8_t alpha)
return -EINVAL;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dgetalpha
*
* Description:
@ -1520,7 +1520,7 @@ static int stm32_dma2dsetalpha(FAR struct dma2d_layer_s *layer, uint8_t alpha)
* On success - OK
* On error - -EINVAL
*
*****************************************************************************/
****************************************************************************/
static int stm32_dma2dgetalpha(FAR struct dma2d_layer_s *layer, uint8_t *alpha)
{
@ -1541,7 +1541,7 @@ static int stm32_dma2dgetalpha(FAR struct dma2d_layer_s *layer, uint8_t *alpha)
return -EINVAL;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dsetblendmode
*
* Description:
@ -1570,7 +1570,7 @@ static int stm32_dma2dgetalpha(FAR struct dma2d_layer_s *layer, uint8_t *alpha)
* the constant alpha value. This is only useful for ARGB8888
* color format.
*
******************************************************************************/
****************************************************************************/
static int stm32_dma2dsetblendmode(FAR struct dma2d_layer_s *layer,
uint32_t mode)
@ -1592,7 +1592,7 @@ static int stm32_dma2dsetblendmode(FAR struct dma2d_layer_s *layer,
return -EINVAL;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_getblendmode
*
* Description:
@ -1606,7 +1606,7 @@ static int stm32_dma2dsetblendmode(FAR struct dma2d_layer_s *layer,
* On success - OK
* On error - -EINVAL
*
*****************************************************************************/
****************************************************************************/
static int stm32_dma2dgetblendmode(FAR struct dma2d_layer_s *layer,
uint32_t *mode)
@ -1628,7 +1628,7 @@ static int stm32_dma2dgetblendmode(FAR struct dma2d_layer_s *layer,
return -EINVAL;
}
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dblit
*
* Description:
@ -1927,7 +1927,7 @@ static int stm32_dma2dfillarea(FAR struct dma2d_layer_s *layer,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: up_dma2dgetlayer
*
* Description:
@ -1940,7 +1940,7 @@ static int stm32_dma2dfillarea(FAR struct dma2d_layer_s *layer,
* Reference to the dma2d layer control structure on success or Null if no
* related exist.
*
******************************************************************************/
****************************************************************************/
FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
{
@ -1959,7 +1959,7 @@ FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
return NULL;
}
/******************************************************************************
/****************************************************************************
* Name: up_dma2dcreatelayer
*
* Description:
@ -1977,7 +1977,7 @@ FAR struct dma2d_layer_s * up_dma2dgetlayer(int lid)
* -ENOMEM if no memory available or exceeds
* CONFIG_STM32_DMA2D_NLAYERS
*
******************************************************************************/
****************************************************************************/
FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
fb_coord_t height,
@ -2088,7 +2088,7 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
return (FAR struct dma2d_layer_s *)layer;
}
/******************************************************************************
/****************************************************************************
* Name: up_dma2dremovelayer
*
* Description:
@ -2101,7 +2101,7 @@ FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
* On success - OK
* On error - -EINVAL
*
*****************************************************************************/
****************************************************************************/
int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer)
{
@ -2133,7 +2133,7 @@ int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer)
return ret;
}
/******************************************************************************
/****************************************************************************
* Name: up_dma2dinitialize
*
* Description:
@ -2143,7 +2143,7 @@ int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer)
* OK - On success
* An error if initializing failed.
*
******************************************************************************/
****************************************************************************/
int up_dma2dinitialize(void)
{
@ -2207,13 +2207,13 @@ int up_dma2dinitialize(void)
return OK;
}
/******************************************************************************
/****************************************************************************
* Name: up_dma2duninitialize
*
* Description:
* Uninitialize the dma2d controller
*
******************************************************************************/
****************************************************************************/
void up_dma2duninitialize(void)
{
@ -2236,7 +2236,7 @@ void up_dma2duninitialize(void)
}
#ifdef CONFIG_STM32_LTDC_INTERFACE
/******************************************************************************
/****************************************************************************
* Name: stm32_dma2dinitltdc
*
* Description:
@ -2256,7 +2256,7 @@ void up_dma2duninitialize(void)
* On error - NULL and errno is set to
* -EINVAL if one of the parameter is invalid
*
******************************************************************************/
****************************************************************************/
FAR struct dma2d_layer_s * stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer)
{

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1324,7 +1324,7 @@ static void stm32_epwrite(struct stm32_usbdev_s *priv,
* Description:
* Handle the ep0 state on writes.
*
*****************************************************************************/
****************************************************************************/
inline static int stm32_wrrequest_ep0(struct stm32_usbdev_s *priv,
struct stm32_ep_s *privep)
@ -1438,7 +1438,7 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: stm32_ep0_rdrequest
*
* Description:
@ -1446,7 +1446,7 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive
* is EP0STATE_SETUP_OUT and uppon new incoming data is available in the endpoint
* 0's buffer. This function will simply copy the OUT data into ep0data.
*
*******************************************************************************/
****************************************************************************/
static inline int stm32_ep0_rdrequest(struct stm32_usbdev_s *priv)
{

View file

@ -44,7 +44,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This is part of revision 2.1.0.12573 of the Tiva Peripheral Driver Library.
*****************************************************************************/
****************************************************************************/
/****************************************************************************
* Included Files

View file

@ -44,7 +44,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This is part of revision 2.1.0.12573 of the Tiva Peripheral Driver Library.
*****************************************************************************/
****************************************************************************/
/* Keep in mind that for every step there should be another entry in the
* CONFIG_ADC_FIFOSIZE value.

View file

@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/avr/src/at32uc3/at32uc3_lowconsole.c
*
* Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include "at32uc3_config.h"
@ -53,9 +53,9 @@
#include "at32uc3_usart.h"
#include "at32uc3_pinmux.h"
/******************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************/
****************************************************************************/
/* Select USART parameters for the selected console */
@ -81,33 +81,33 @@
# error "No CONFIG_USARTn_SERIAL_CONSOLE Setting"
#endif
/******************************************************************************
/****************************************************************************
* Private Types
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Function Prototypes
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Public Data
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Variables
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: usart_putreg
*
* Description:
* Write a value to a USART register
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_RS232_DEVICE
static inline void usart_putreg(uintptr_t usart_base, unsigned int offset, uint32_t value)
@ -116,13 +116,13 @@ static inline void usart_putreg(uintptr_t usart_base, unsigned int offset, uint3
}
#endif
/******************************************************************************
/****************************************************************************
* Name: usart_getreg
*
* Description:
* Get a value from a USART register
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_RS232_DEVICE
static inline uint32_t usart_getreg(uintptr_t usart_base, unsigned int offset)
@ -131,13 +131,13 @@ static inline uint32_t usart_getreg(uintptr_t usart_base, unsigned int offset)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: usart_setbaudrate
*
* Description:
* Configure the UART baud rate.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_RS232_DEVICE
static void usart_setbaudrate(uintptr_t usart_base, uint32_t baudrate)
@ -186,17 +186,17 @@ static void usart_setbaudrate(uintptr_t usart_base, uint32_t baudrate)
}
#endif
/******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: usart_reset
*
* Description:
* Reset a USART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_RS232_DEVICE
void usart_reset(uintptr_t usart_base)
@ -223,13 +223,13 @@ void usart_reset(uintptr_t usart_base)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: usart_configure
*
* Description:
* Configure a USART as a RS-232 UART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_RS232_DEVICE
void usart_configure(uintptr_t usart_base, uint32_t baud, unsigned int parity,
@ -290,7 +290,7 @@ void usart_configure(uintptr_t usart_base, uint32_t baud, unsigned int parity,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: up_consoleinit
*
* Description:
@ -298,7 +298,7 @@ void usart_configure(uintptr_t usart_base, uint32_t baud, unsigned int parity,
* early in the initialization sequence to configure the serial console uart
* (only).
*
******************************************************************************/
****************************************************************************/
void up_consoleinit(void)
{
@ -368,13 +368,13 @@ void up_consoleinit(void)
#endif
}
/******************************************************************************
/****************************************************************************
* Name: up_lowputc
*
* Description:
* Output one byte on the serial console
*
******************************************************************************/
****************************************************************************/
void up_lowputc(char ch)
{

View file

@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/avr/src/at90usb/at90usb_lowconsole.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include "at90usb_config.h"
@ -52,9 +52,9 @@
#include "at90usb_internal.h"
/******************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************/
****************************************************************************/
/* Baud rate settings for normal and double speed modes */
@ -116,37 +116,37 @@
# endif
#endif
/******************************************************************************
/****************************************************************************
* Private Types
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Function Prototypes
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Public Data
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Variables
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: usart1_reset
*
* Description:
* Reset a USART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_USART_DEVICE
void usart1_reset(void)
@ -168,13 +168,13 @@ void usart1_reset(void)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: usart1_configure
*
* Description:
* Configure USART1.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_USART_DEVICE
void usart1_configure(void)
@ -249,7 +249,7 @@ void usart1_configure(void)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: up_consoleinit
*
* Description:
@ -257,7 +257,7 @@ void usart1_configure(void)
* early in the initialization sequence to configure the serial console uart
* (only).
*
******************************************************************************/
****************************************************************************/
void up_consoleinit(void)
{
@ -266,13 +266,13 @@ void up_consoleinit(void)
#endif
}
/******************************************************************************
/****************************************************************************
* Name: up_lowputc
*
* Description:
* Output one byte on the serial console
*
******************************************************************************/
****************************************************************************/
void up_lowputc(char ch)
{

View file

@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* arch/arm/src/at90usb/at90usb_usbdev.c
*
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Included Files
*******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -62,9 +62,9 @@
#include "up_arch.h"
#include "up_internal.h"
/*******************************************************************************
/****************************************************************************
* Pre-processor Definitions
*******************************************************************************/
****************************************************************************/
/* Configuration ***************************************************************/
/* PLL Settings are based on F_CPU frequency which is defined in the board.h file */
@ -195,9 +195,9 @@
#define avr_rqempty(ep) ((ep)->head == NULL)
#define avr_rqpeek(ep) ((ep)->head)
/*******************************************************************************
/****************************************************************************
* Private Types
*******************************************************************************/
****************************************************************************/
/* A container for a request so that the request may be retained in a list */
@ -261,9 +261,9 @@ struct avr_usbdev_s
struct avr_ep_s eplist[AVR_NENDPOINTS];
};
/*******************************************************************************
/****************************************************************************
* Private Function Prototypes
*******************************************************************************/
****************************************************************************/
/* Request queue operations ****************************************************/
@ -331,9 +331,9 @@ static int avr_wakeup(struct usbdev_s *dev);
static int avr_selfpowered(struct usbdev_s *dev, bool selfpowered);
static int avr_pullup(struct usbdev_s *dev, bool enable);
/*******************************************************************************
/****************************************************************************
* Private Data
*******************************************************************************/
****************************************************************************/
/* Since there is only a single USB interface, all status information can be
* be simply retained in a single global instance.
@ -366,21 +366,21 @@ static const struct usbdev_ops_s g_devops =
.pullup = avr_pullup,
};
/*******************************************************************************
/****************************************************************************
* Public Data
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Private Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: avr_rqdequeue
*
* Description:
* Remove a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static FAR struct avr_req_s *avr_rqdequeue(FAR struct avr_ep_s *privep)
{
@ -400,13 +400,13 @@ static FAR struct avr_req_s *avr_rqdequeue(FAR struct avr_ep_s *privep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_rqenqueue
*
* Description:
* Add a request from an endpoint request queue
*
*******************************************************************************/
****************************************************************************/
static inline void avr_rqenqueue(FAR struct avr_ep_s *privep,
FAR struct avr_req_s *req)
@ -424,13 +424,13 @@ static inline void avr_rqenqueue(FAR struct avr_ep_s *privep,
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_txready
*
* Description:
* Wait for the selected endpoint to be ready for an IN (TX) transfer
*
*******************************************************************************/
****************************************************************************/
static void avr_txready(void)
{
@ -438,13 +438,13 @@ static void avr_txready(void)
while (((UEINTX & (1 << TXINI)) == 0) && retries-- > 0);
}
/*******************************************************************************
/****************************************************************************
* Name: avr_fifoready
*
* Description:
* Wait for the selected endpoint FIFO to be ready
*
*******************************************************************************/
****************************************************************************/
static int avr_fifoready(int timeout)
{
@ -496,7 +496,7 @@ static int avr_fifoready(int timeout)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_ep0send
*
* Description:
@ -505,7 +505,7 @@ static int avr_fifoready(int timeout)
* Assumptions:
* - Endpoint 0 is already selected.
*
*******************************************************************************/
****************************************************************************/
static void avr_ep0send(FAR const uint8_t *buffer, uint16_t buflen)
{
@ -577,13 +577,13 @@ static void avr_ep0send(FAR const uint8_t *buffer, uint16_t buflen)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epNsend
*
* Description:
* Perform a TX transfer for Endpoint N
*
*******************************************************************************/
****************************************************************************/
static inline int avr_epNsend(FAR struct avr_ep_s *privep,
FAR struct avr_req_s *privreq)
@ -744,13 +744,13 @@ static inline int avr_epNsend(FAR struct avr_ep_s *privep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epNrecv
*
* Description:
* Perform an RX transfer for Endpoint N
*
*******************************************************************************/
****************************************************************************/
static inline int avr_epNrecv(FAR struct avr_ep_s *privep,
FAR struct usbdev_req_s *req)
@ -826,7 +826,7 @@ static inline int avr_epNrecv(FAR struct avr_ep_s *privep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epINqueue
*
* Description:
@ -835,7 +835,7 @@ static inline int avr_epNrecv(FAR struct avr_ep_s *privep,
* interrupt occurs. Thus function is also called from the requeust enqueuing
* logic BUT with interrupts disabled.
*
*******************************************************************************/
****************************************************************************/
static int avr_epINqueue(FAR struct avr_ep_s *privep)
{
@ -887,7 +887,7 @@ static int avr_epINqueue(FAR struct avr_ep_s *privep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epOUTqueue
*
* Description:
@ -895,7 +895,7 @@ static int avr_epINqueue(FAR struct avr_ep_s *privep)
* from interrupt handling logic for an endpoint when the RXOUT endpoint
* interrupt occurs.
*
*******************************************************************************/
****************************************************************************/
static int avr_epOUTqueue(FAR struct avr_ep_s *privep)
{
@ -926,13 +926,13 @@ static int avr_epOUTqueue(FAR struct avr_ep_s *privep)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_reqcomplete
*
* Description:
* Handle termination of the request at the head of the endpoint request queue.
*
*******************************************************************************/
****************************************************************************/
static void avr_reqcomplete(FAR struct avr_ep_s *privep, FAR struct avr_req_s *privreq,
int result)
@ -959,13 +959,13 @@ static void avr_reqcomplete(FAR struct avr_ep_s *privep, FAR struct avr_req_s *p
privep->stalled = stalled;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_cancelrequests
*
* Description:
* Cancel all pending requests for an endpoint
*
*******************************************************************************/
****************************************************************************/
static void avr_cancelrequests(FAR struct avr_ep_s *privep, int status)
{
@ -998,13 +998,13 @@ static void avr_cancelrequests(FAR struct avr_ep_s *privep, int status)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_cancelall
*
* Description:
* Cancel all pending requests for an endpoint
*
*******************************************************************************/
****************************************************************************/
static void avr_cancelall(int status)
{
@ -1021,14 +1021,14 @@ static void avr_cancelall(int status)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epfindbyaddr
*
* Description:
* Find the physical endpoint structure corresponding to a logic endpoint
* address
*
*******************************************************************************/
****************************************************************************/
static struct avr_ep_s *avr_epfindbyaddr(uint8_t epno)
{
@ -1063,14 +1063,14 @@ static struct avr_ep_s *avr_epfindbyaddr(uint8_t epno)
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_dispatchrequest
*
* Description:
* Provide unhandled setup actions to the class driver. This is logically part
* of the USB interrupt handler.
*
*******************************************************************************/
****************************************************************************/
static void avr_dispatchrequest(FAR const struct usb_ctrlreq_s *ctrl)
{
@ -1093,13 +1093,13 @@ static void avr_dispatchrequest(FAR const struct usb_ctrlreq_s *ctrl)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_ep0configure
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static int avr_ep0configure(void)
{
@ -1139,7 +1139,7 @@ static int avr_ep0configure(void)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epreset
*
* Description:
@ -1148,7 +1148,7 @@ static int avr_ep0configure(void)
* Input Parameters:
* epno - The endpoint to be reset
*
*******************************************************************************/
****************************************************************************/
static void avr_epreset(FAR struct avr_ep_s *privep, int status)
{
@ -1172,13 +1172,13 @@ static void avr_epreset(FAR struct avr_ep_s *privep, int status)
privep->stalled = false;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_usbreset
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
****************************************************************************/
static void avr_usbreset(void)
{
@ -1273,13 +1273,13 @@ static void avr_usbreset(void)
UDIEN |= ((1 << SUSPE) | (1 << EORSTE));
}
/*******************************************************************************
/****************************************************************************
* Name: avr_usbshutdown
*
* Description:
* Shutdown the USB interface and put the hardare in a known state
*
*******************************************************************************/
****************************************************************************/
void avr_usbshutdown(void)
{
@ -1322,13 +1322,13 @@ void avr_usbshutdown(void)
USBCON &= ~(1 << OTGPADE);
}
/*******************************************************************************
/****************************************************************************
* Name: avr_setaddress
*
* Description:
* Set the devices USB address
*
*******************************************************************************/
****************************************************************************/
static inline void avr_setaddress(uint8_t address)
{
@ -1352,14 +1352,14 @@ static inline void avr_setaddress(uint8_t address)
UDADDR = ((1 << ADDEN) | address);
}
/*******************************************************************************
/****************************************************************************
* Name: avr_ep0setup
*
* Description:
* USB Ctrl EP Setup Event. This is logically part of the USB interrupt
* handler. This event occurs when a setup packet is receive on EP0 OUT.
*
*******************************************************************************/
****************************************************************************/
static inline void avr_ep0setup(void)
{
@ -1759,13 +1759,13 @@ static inline void avr_ep0setup(void)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_ep0interrupt
*
* Description:
* USB endpoint/pipe IN interrupt handler
*
*******************************************************************************/
****************************************************************************/
static inline void avr_ep0interrupt(void)
{
@ -1796,13 +1796,13 @@ static inline void avr_ep0interrupt(void)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epNinterrupt
*
* Description:
* USB endpoint/pipe IN interrupt handler
*
*******************************************************************************/
****************************************************************************/
static inline void avr_epNinterrupt(void)
{
@ -1868,13 +1868,13 @@ static inline void avr_epNinterrupt(void)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epinterrupt
*
* Description:
* USB endpoint/pipe interrupt handler
*
*******************************************************************************/
****************************************************************************/
static int avr_epinterrupt(int irq, FAR void *context)
{
@ -1892,14 +1892,14 @@ static int avr_epinterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_genvbus
*
* Description:
* A change in VBUS has been detected. Check if the device has been
* connected to or disconnected from a host.
*
*******************************************************************************/
****************************************************************************/
static void avr_genvbus(void)
{
@ -1944,13 +1944,13 @@ static void avr_genvbus(void)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_gensuspend
*
* Description:
* The USB controller has been put in suspend mode.
*
*******************************************************************************/
****************************************************************************/
static inline void avr_gensuspend(void)
{
@ -1979,13 +1979,13 @@ static inline void avr_gensuspend(void)
PLLCSR = 0;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_genwakeup
*
* Description:
* Resume from suspend mode.
*
*******************************************************************************/
****************************************************************************/
static void avr_genwakeup(void)
{
@ -2011,13 +2011,13 @@ static void avr_genwakeup(void)
}
}
/*******************************************************************************
/****************************************************************************
* Name: avr_geneor
*
* Description:
* Handle an end-of-reset interrupt
*
*******************************************************************************/
****************************************************************************/
static inline void avr_geneor(void)
{
@ -2052,13 +2052,13 @@ static inline void avr_geneor(void)
UEIENX |= (1 << RXSTPE);
}
/*******************************************************************************
/****************************************************************************
* Name: avr_geninterrupt
*
* Description:
* USB general interrupt handler
*
*******************************************************************************/
****************************************************************************/
static int avr_geninterrupt(int irq, FAR void *context)
{
@ -2100,7 +2100,7 @@ static int avr_geninterrupt(int irq, FAR void *context)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epconfigure
*
* Description:
@ -2113,7 +2113,7 @@ static int avr_geninterrupt(int irq, FAR void *context)
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
****************************************************************************/
static int avr_epconfigure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc, bool last)
@ -2233,13 +2233,13 @@ static int avr_epconfigure(FAR struct usbdev_ep_s *ep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epdisable
*
* Description:
* The endpoint will no longer be used
*
*******************************************************************************/
****************************************************************************/
static int avr_epdisable(FAR struct usbdev_ep_s *ep)
{
@ -2266,13 +2266,13 @@ static int avr_epdisable(FAR struct usbdev_ep_s *ep)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epallocreq
*
* Description:
* Allocate an I/O request
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_req_s *avr_epallocreq(FAR struct usbdev_ep_s *ep)
{
@ -2298,13 +2298,13 @@ static FAR struct usbdev_req_s *avr_epallocreq(FAR struct usbdev_ep_s *ep)
return &privreq->req;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epfreereq
*
* Description:
* Free an I/O request
*
*******************************************************************************/
****************************************************************************/
static void avr_epfreereq(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
@ -2323,13 +2323,13 @@ static void avr_epfreereq(FAR struct usbdev_ep_s *ep,
kmm_free(privreq);
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epallocbuffer
*
* Description:
* Allocate an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void *avr_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
@ -2344,13 +2344,13 @@ static void *avr_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: avr_epfreebuffer
*
* Description:
* Free an I/O buffer
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USBDEV_DMA
static void avr_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
@ -2365,13 +2365,13 @@ static void avr_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: avr_epsubmit
*
* Description:
* Submit an I/O request to the endpoint
*
*******************************************************************************/
****************************************************************************/
static int avr_epsubmit(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
@ -2469,13 +2469,13 @@ static int avr_epsubmit(FAR struct usbdev_ep_s *ep,
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epcancel
*
* Description:
* Cancel an I/O request previously sent to an endpoint
*
*******************************************************************************/
****************************************************************************/
static int avr_epcancel(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
@ -2503,13 +2503,13 @@ static int avr_epcancel(FAR struct usbdev_ep_s *ep,
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_epstall
*
* Description:
* Stall or resume and endpoint
*
*******************************************************************************/
****************************************************************************/
static int avr_epstall(FAR struct usbdev_ep_s *ep, bool resume)
{
@ -2537,11 +2537,11 @@ static int avr_epstall(FAR struct usbdev_ep_s *ep, bool resume)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Device operations
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: avr_allocep
*
* Description:
@ -2555,7 +2555,7 @@ static int avr_epstall(FAR struct usbdev_ep_s *ep, bool resume)
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
*
*******************************************************************************/
****************************************************************************/
static FAR struct usbdev_ep_s *avr_allocep(FAR struct usbdev_s *dev,
uint8_t epno, bool in,
@ -2650,13 +2650,13 @@ static FAR struct usbdev_ep_s *avr_allocep(FAR struct usbdev_s *dev,
return NULL;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_freeep
*
* Description:
* Free the previously allocated endpoint
*
*******************************************************************************/
****************************************************************************/
static void avr_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
{
@ -2676,13 +2676,13 @@ static void avr_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: avr_getframe
*
* Description:
* Returns the current frame number
*
*******************************************************************************/
****************************************************************************/
static int avr_getframe(struct usbdev_s *dev)
{
@ -2692,13 +2692,13 @@ static int avr_getframe(struct usbdev_s *dev)
return (int)UDFNUMH << 8 | (int)UDFNUML;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_wakeup
*
* Description:
* Tries to wake up the host connected to this device
*
*******************************************************************************/
****************************************************************************/
static int avr_wakeup(struct usbdev_s *dev)
{
@ -2712,13 +2712,13 @@ static int avr_wakeup(struct usbdev_s *dev)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_selfpowered
*
* Description:
* Sets/clears the device selfpowered feature
*
*******************************************************************************/
****************************************************************************/
static int avr_selfpowered(struct usbdev_s *dev, bool selfpowered)
{
@ -2736,13 +2736,13 @@ static int avr_selfpowered(struct usbdev_s *dev, bool selfpowered)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_pullup
*
* Description:
* Software-controlled connect to/disconnect from USB host
*
*******************************************************************************/
****************************************************************************/
static int avr_pullup(struct usbdev_s *dev, bool enable)
{
@ -2750,11 +2750,11 @@ static int avr_pullup(struct usbdev_s *dev, bool enable)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Public Functions
*******************************************************************************/
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: up_usbinitialize
*
* Description:
@ -2767,7 +2767,7 @@ static int avr_pullup(struct usbdev_s *dev, bool enable)
* and P0.23 and PO.31 in PINSEL1 must be configured for Vbus and USB connect
* LED.
*
*******************************************************************************/
****************************************************************************/
void up_usbinitialize(void)
{
@ -2823,9 +2823,9 @@ errout:
up_usbuninitialize();
}
/*******************************************************************************
/****************************************************************************
* Name: up_usbuninitialize
*******************************************************************************/
****************************************************************************/
void up_usbuninitialize(void)
{
@ -2856,14 +2856,14 @@ void up_usbuninitialize(void)
irqrestore(flags);
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_register
*
* Description:
* Register a USB device class driver. The class driver's bind() method will be
* called to bind it to a USB device driver.
*
*******************************************************************************/
****************************************************************************/
int usbdev_register(struct usbdevclass_driver_s *driver)
{
@ -2912,7 +2912,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
return ret;
}
/*******************************************************************************
/****************************************************************************
* Name: usbdev_unregister
*
* Description:
@ -2920,7 +2920,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
* it will first disconnect(). The driver is also requested to unbind() and clean
* up any device state, before this procedure finally returns.
*
*******************************************************************************/
****************************************************************************/
int usbdev_unregister(struct usbdevclass_driver_s *driver)
{
@ -2944,7 +2944,7 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
return OK;
}
/*******************************************************************************
/****************************************************************************
* Name: avr_pollvbus
*
* Description:
@ -2955,7 +2955,7 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
* (especially if a relay is used to switch VBUS!). This poll is, then,
* simply a failsafe to assure that VBUS connection events are never missed.
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_USB_NOISYVBUS
void avr_pollvbus(void)

View file

@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/avr/src/atmega/atmega_lowconsole.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include "atmega_config.h"
@ -51,9 +51,9 @@
#include "up_internal.h"
#include "atmega_internal.h"
/******************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************/
****************************************************************************/
/* USART0 Baud rate settings for normal and double speed modes */
@ -175,29 +175,29 @@
# endif
#endif
/******************************************************************************
/****************************************************************************
* Private Types
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Function Prototypes
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Public Data
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Variables
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/****************************************************************************
* Name: usart0_reset and usart1_reset
@ -431,7 +431,7 @@ void usart1_configure(void)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: up_consoleinit
*
* Description:
@ -439,7 +439,7 @@ void usart1_configure(void)
* early in the initialization sequence to configure the serial console uart
* (only).
*
******************************************************************************/
****************************************************************************/
void up_consoleinit(void)
{
@ -452,13 +452,13 @@ void up_consoleinit(void)
#endif
}
/******************************************************************************
/****************************************************************************
* Name: up_lowputc
*
* Description:
* Output one byte on the serial console
*
******************************************************************************/
****************************************************************************/
void up_lowputc(char ch)
{

View file

@ -477,13 +477,13 @@ static void pic32mx_ethreset(struct pic32mx_driver_s *priv);
* Private Functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: pic32mx_printreg
*
* Description:
* Print the contents of an PIC32MX register operation
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void pic32mx_printreg(uint32_t addr, uint32_t val, bool iswrite)
@ -492,13 +492,13 @@ static void pic32mx_printreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mx_checkreg
*
* Description:
* Get the contents of an PIC32MX register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void pic32mx_checkreg(uint32_t addr, uint32_t val, bool iswrite)
@ -556,13 +556,13 @@ static void pic32mx_checkreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mx_getreg
*
* Description:
* Get the contents of an PIC32MX register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static uint32_t pic32mx_getreg(uint32_t addr)
@ -578,13 +578,13 @@ static uint32_t pic32mx_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mx_putreg
*
* Description:
* Set the contents of an PIC32MX register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void pic32mx_putreg(uint32_t val, uint32_t addr)
@ -2401,7 +2401,7 @@ static int pic32mx_rmmac(struct net_driver_s *dev, const uint8_t *mac)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mx_showmii
*
* Description:
@ -2415,7 +2415,7 @@ static int pic32mx_rmmac(struct net_driver_s *dev, const uint8_t *mac)
*
* Assumptions:
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_NET_REGDEBUG) && defined(PIC32MX_HAVE_PHY)
static void pic32mx_showmii(uint8_t phyaddr, const char *msg)

View file

@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/mips/src/pic32mx/pic32mx-lowconsole.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -51,9 +51,9 @@
#include "pic32mx-config.h"
#include "pic32mx-internal.h"
/******************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************/
****************************************************************************/
/* Select UART parameters for the selected console */
@ -99,33 +99,33 @@
# endif
#endif
/******************************************************************************
/****************************************************************************
* Private Types
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Function Prototypes
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Public Data
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Variables
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: pic32mx_putreg
*
* Description:
* Write a value to a UART register
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
static inline void pic32mx_putreg(uintptr_t uart_base, unsigned int offset,
@ -135,13 +135,13 @@ static inline void pic32mx_putreg(uintptr_t uart_base, unsigned int offset,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mx_getreg
*
* Description:
* Get a value from a UART register
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
static inline uint32_t pic32mx_getreg(uintptr_t uart_base,
@ -151,7 +151,7 @@ static inline uint32_t pic32mx_getreg(uintptr_t uart_base,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mx_uartsetbaud
*
* Description:
@ -165,7 +165,7 @@ static inline uint32_t pic32mx_getreg(uintptr_t uart_base,
* BRG = PBCLK / 4 / BAUD - 1
*
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
static void pic32mx_uartsetbaud(uintptr_t uart_base, uint32_t baudrate)
@ -203,17 +203,17 @@ static void pic32mx_uartsetbaud(uintptr_t uart_base, uint32_t baudrate)
}
#endif
/******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: pic32mx_uartreset
*
* Description:
* Reset hardware and disable Rx and Tx.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void pic32mx_uartreset(uintptr_t uart_base)
@ -226,13 +226,13 @@ void pic32mx_uartreset(uintptr_t uart_base)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mx_uartconfigure
*
* Description:
* Configure a UART as a RS-232 UART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void pic32mx_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
@ -316,7 +316,7 @@ void pic32mx_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mx_consoleinit
*
* Description:
@ -324,7 +324,7 @@ void pic32mx_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
* very early in the initialization sequence to configure the serial console
* UART (only).
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_SERIAL_CONSOLE
void pic32mx_consoleinit(void)
@ -335,13 +335,13 @@ void pic32mx_consoleinit(void)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: up_lowputc
*
* Description:
* Output one byte on the serial console.
*
******************************************************************************/
****************************************************************************/
void up_lowputc(char ch)
{

View file

@ -495,13 +495,13 @@ static void pic32mz_ethreset(struct pic32mz_driver_s *priv);
* Private Functions
****************************************************************************/
/*******************************************************************************
/****************************************************************************
* Name: pic32mz_printreg
*
* Description:
* Print the contents of an PIC32MZ register operation
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void pic32mz_printreg(uint32_t addr, uint32_t val, bool iswrite)
@ -510,13 +510,13 @@ static void pic32mz_printreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mz_checkreg
*
* Description:
* Get the contents of an PIC32MZ register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void pic32mz_checkreg(uint32_t addr, uint32_t val, bool iswrite)
@ -574,13 +574,13 @@ static void pic32mz_checkreg(uint32_t addr, uint32_t val, bool iswrite)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mz_getreg
*
* Description:
* Get the contents of an PIC32MZ register
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static uint32_t pic32mz_getreg(uint32_t addr)
@ -596,13 +596,13 @@ static uint32_t pic32mz_getreg(uint32_t addr)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mz_putreg
*
* Description:
* Set the contents of an PIC32MZ register to a value
*
*******************************************************************************/
****************************************************************************/
#ifdef CONFIG_NET_REGDEBUG
static void pic32mz_putreg(uint32_t val, uint32_t addr)
@ -2425,7 +2425,7 @@ static int pic32mz_rmmac(struct net_driver_s *dev, const uint8_t *mac)
}
#endif
/*******************************************************************************
/****************************************************************************
* Name: pic32mz_showmii
*
* Description:
@ -2439,7 +2439,7 @@ static int pic32mz_rmmac(struct net_driver_s *dev, const uint8_t *mac)
*
* Assumptions:
*
*******************************************************************************/
****************************************************************************/
#if defined(CONFIG_NET_REGDEBUG) && defined(PIC32MZ_HAVE_PHY)
static void pic32mz_showmii(uint8_t phyaddr, const char *msg)

View file

@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/mips/src/pic32mz/pic32mz-lowconsole.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -53,9 +53,9 @@
#include <arch/board/board.h>
/******************************************************************************
/****************************************************************************
* Pre-processor Definitions
******************************************************************************/
****************************************************************************/
/* Select UART parameters for the selected console */
@ -101,33 +101,33 @@
# endif
#endif
/******************************************************************************
/****************************************************************************
* Private Types
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Function Prototypes
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Public Data
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Variables
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Private Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: pic32mz_putreg
*
* Description:
* Write a value to a UART register
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
static inline void pic32mz_putreg(uintptr_t uart_base, unsigned int offset,
@ -137,13 +137,13 @@ static inline void pic32mz_putreg(uintptr_t uart_base, unsigned int offset,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mz_getreg
*
* Description:
* Get a value from a UART register
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
static inline uint32_t pic32mz_getreg(uintptr_t uart_base,
@ -153,7 +153,7 @@ static inline uint32_t pic32mz_getreg(uintptr_t uart_base,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mz_uartsetbaud
*
* Description:
@ -167,7 +167,7 @@ static inline uint32_t pic32mz_getreg(uintptr_t uart_base,
* BRG = PBCLK2 / 4 / BAUD - 1
*
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
static void pic32mz_uartsetbaud(uintptr_t uart_base, uint32_t baudrate)
@ -205,17 +205,17 @@ static void pic32mz_uartsetbaud(uintptr_t uart_base, uint32_t baudrate)
}
#endif
/******************************************************************************
/****************************************************************************
* Public Functions
******************************************************************************/
****************************************************************************/
/******************************************************************************
/****************************************************************************
* Name: pic32mz_uartreset
*
* Description:
* Reset hardware and disable Rx and Tx.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void pic32mz_uartreset(uintptr_t uart_base)
@ -228,13 +228,13 @@ void pic32mz_uartreset(uintptr_t uart_base)
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mz_uartconfigure
*
* Description:
* Configure a UART as a RS-232 UART.
*
******************************************************************************/
****************************************************************************/
#ifdef HAVE_UART_DEVICE
void pic32mz_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
@ -313,7 +313,7 @@ void pic32mz_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
}
#endif
/******************************************************************************
/****************************************************************************
* Name: pic32mz_consoleinit
*
* Description:
@ -321,7 +321,7 @@ void pic32mz_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
* very early in the initialization sequence to configure the serial console
* UART (only).
*
******************************************************************************/
****************************************************************************/
void pic32mz_consoleinit(void)
{
@ -469,13 +469,13 @@ void pic32mz_consoleinit(void)
#endif /* HAVE_UART_DEVICE */
}
/******************************************************************************
/****************************************************************************
* Name: up_lowputc
*
* Description:
* Output one byte on the serial console.
*
******************************************************************************/
****************************************************************************/
void up_lowputc(char ch)
{