A little STM32 logic in the PIC32 USB driver

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4235 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-12-28 19:40:37 +00:00
parent 3de52617ef
commit d9351bb9af
4 changed files with 605 additions and 932 deletions

View File

@ -389,8 +389,8 @@ static inline uint16_t
stm32_geteptxstatus(uint8_t epno);
static inline uint16_t
stm32_geteprxstatus(uint8_t epno);
static uint16_t stm32_eptxstalled(uint8_t epno);
static uint16_t stm32_eprxstalled(uint8_t epno);
static bool stm32_eptxstalled(uint8_t epno);
static bool stm32_eprxstalled(uint8_t epno);
static void stm32_setimask(struct stm32_usbdev_s *priv, uint16_t setbits,
uint16_t clrbits);
@ -595,7 +595,7 @@ static void stm32_putreg(uint16_t val, uint32_t addr)
/* Write the value */
putreg32(val, addr);
putreg16(val, addr);
}
#endif
@ -983,7 +983,7 @@ static void stm32_seteprxstatus(uint8_t epno, uint16_t state)
* Name: stm32_eptxstalled
****************************************************************************/
static inline uint16_t stm32_eptxstalled(uint8_t epno)
static inline bool stm32_eptxstalled(uint8_t epno)
{
return (stm32_geteptxstatus(epno) == USB_EPR_STATTX_STALL);
}
@ -992,7 +992,7 @@ static inline uint16_t stm32_eptxstalled(uint8_t epno)
* Name: stm32_eprxstalled
****************************************************************************/
static inline uint16_t stm32_eprxstalled(uint8_t epno)
static inline bool stm32_eprxstalled(uint8_t epno)
{
return (stm32_geteprxstatus(epno) == USB_EPR_STATRX_STALL);
}

View File

@ -551,32 +551,33 @@ EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *r
#endif
#endif
/************************************************************************************
/****************************************************************************
* Name: pic32mx_usbpullup
*
* Description:
* If USB is supported and the board supports a pullup via GPIO (for USB software
* connect and disconnect), then the board software must provide stm32_pullup.
* See include/nuttx/usb/usbdev.h for additional description of this method.
* Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
* NULL.
* If USB is supported and the board supports a pullup via GPIO (for USB
* software connect and disconnect), then the board software must provide
* stm32_pullup. See include/nuttx/usb/usbdev.h for additional description
* of this method. Alternatively, if no pull-up GPIO the following EXTERN
* can be redefined to be NULL.
*
************************************************************************************/
****************************************************************************/
#ifdef CONFIG_PIC32MX_USBDEV
struct usbdev_s;
EXTERN int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
#endif
/************************************************************************************
/****************************************************************************
* Name: pic32mx_usbsuspend
*
* Description:
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
* used. This function is called whenever the USB enters or leaves suspend mode.
* This is an opportunity for the board logic to shutdown clocks, power, etc.
* while the USB is suspended.
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver
* is used. This function is called whenever the USB enters or leaves
* suspend mode. This is an opportunity for the board logic to shutdown
* clocks, power, etc. while the USB is suspended.
*
************************************************************************************/
****************************************************************************/
#ifdef CONFIG_PIC32MX_USBDEV
EXTERN void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);

File diff suppressed because it is too large Load Diff

View File

@ -209,6 +209,12 @@
#define USB_STAT_ENDPT_MASK (15 << USB_STAT_ENDPT_SHIFT)
# define USB_STAT_ENDPT(n) ((n) << USB_STAT_ENDPT_SHIFT) /* Endpoint n, n=0..15 */
#define USB_STAT_PPBI_ODD USB_STAT_PPBI /* The last transaction was to the ODD BD bank */
#define USB_STAT_PPBI_EVEN 0 /* The last transaction was to the EVEN BD bank */
#define USB_STAT_DIR_IN USB_STAT_DIR /* Last transaction was a transmit transfer (TX) */
#define USB_STAT_DIR_OUT 0 /* Last transaction was a receive transfer (RX) */
/* USB Module Control Register */
#define USB_CON_USBEN (1 << 0) /* Bit 0: USB Module Enable */