arch: arm: cm320: fix nxstyle errors

Fix nxstyle errors to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2021-03-24 09:19:10 +01:00 committed by Xiang Xiao
parent 17af7179a6
commit cf2aed1810
17 changed files with 413 additions and 287 deletions

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/chip.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,14 +16,14 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_CHIP_H
#define __ARCH_ARM_SRC_DM320_CHIP_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include "dm320_memorymap.h"
#include "dm320_clkc.h"
@ -35,12 +35,12 @@
#include "dm320_gio.h"
#include "dm320_usb.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#endif /* __ARCH_ARM_SRC_DM320_CHIP_H */

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_ahb.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,20 +16,20 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_AHB_H
#define __ARCH_ARM_SRC_DM320_DM320_AHB_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* AHB Bus Controller (AHBBUSC) Registers *******************************************/
/* AHB Bus Controller (AHBBUSC) Registers ***********************************/
#define DM320_AHB_SDRAMSA (DM320_AHB_VADDR+0x0f00) /* SDRAM start address */
#define DM320_AHB_SDRAMEA (DM320_AHB_VADDR+0x0f04) /* SDRAM end address */
@ -37,8 +37,8 @@
#define DM320_AHB_RSV1 (DM320_AHB_VADDR+0x0f0c) /* Reserved */
#define DM320_AHB_USBCTL (DM320_AHB_VADDR+0x0f10) /* USB control register (ES1.1) */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#endif /* __ARCH_ARM_SRC_DM320_DM320_AHB_H */

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_boot.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
@ -32,9 +32,9 @@
#include <nuttx/board.h>
/************************************************************************************
/****************************************************************************
* Private Types
************************************************************************************/
****************************************************************************/
struct section_mapping_s
{
@ -44,16 +44,16 @@ struct section_mapping_s
uint32_t nsections; /* Number of mappings in the region */
};
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
extern uint32_t _vector_start; /* Beginning of vector block */
extern uint32_t _vector_end; /* End+1 of vector block */
/************************************************************************************
/****************************************************************************
* Private Data
************************************************************************************/
****************************************************************************/
static const struct section_mapping_s section_mapping[] =
{
@ -76,15 +76,16 @@ static const struct section_mapping_s section_mapping[] =
};
#define NMAPPINGS (sizeof(section_mapping) / sizeof(struct section_mapping_s))
/************************************************************************************
/****************************************************************************
* Private Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: up_setlevel1entry
************************************************************************************/
****************************************************************************/
static inline void up_setlevel1entry(uint32_t paddr, uint32_t vaddr, uint32_t mmuflags)
static inline void up_setlevel1entry(uint32_t paddr,
uint32_t vaddr, uint32_t mmuflags)
{
uint32_t *pgtable = (uint32_t *)PGTABLE_BASE_VADDR;
uint32_t index = vaddr >> 20;
@ -94,12 +95,13 @@ static inline void up_setlevel1entry(uint32_t paddr, uint32_t vaddr, uint32_t mm
pgtable[index] = (paddr | mmuflags);
}
/************************************************************************************
/****************************************************************************
* Name: up_setlevel2coarseentry
************************************************************************************/
****************************************************************************/
static inline void up_setlevel2coarseentry(uint32_t ctabvaddr, uint32_t paddr,
uint32_t vaddr, uint32_t mmuflags)
static inline void
up_setlevel2coarseentry(uint32_t ctabvaddr, uint32_t paddr,
uint32_t vaddr, uint32_t mmuflags)
{
uint32_t *ctable = (uint32_t *)ctabvaddr;
uint32_t index;
@ -116,13 +118,14 @@ static inline void up_setlevel2coarseentry(uint32_t ctabvaddr, uint32_t paddr,
ctable[index] = (paddr | mmuflags);
}
/************************************************************************************
/****************************************************************************
* Name: up_setupmappings
************************************************************************************/
****************************************************************************/
static void up_setupmappings(void)
{
int i, j;
int i;
int j;
for (i = 0; i < NMAPPINGS; i++)
{
@ -139,9 +142,9 @@ static void up_setupmappings(void)
}
}
/************************************************************************************
/****************************************************************************
* Name: up_vectormapping
************************************************************************************/
****************************************************************************/
static void up_vectormapping(void)
{
@ -149,27 +152,34 @@ static void up_vectormapping(void)
uint32_t vector_vaddr = DM320_VECTOR_VADDR;
uint32_t end_paddr = vector_paddr + DM320_IRAM_SIZE;
/* We want to keep our interrupt vectors and interrupt-related logic in zero-wait
* state internal RAM (IRAM). The DM320 has 16Kb of IRAM positioned at physical
* address 0x0000:0000; we need to map this to 0xffff:0000.
/* We want to keep our interrupt vectors and interrupt-related logic in
* zero-wait state internal RAM (IRAM). The DM320 has 16Kb of IRAM
* positioned at physical address 0x0000:0000;
* we need to map this to 0xffff:0000.
*/
while (vector_paddr < end_paddr)
{
up_setlevel2coarseentry(PGTABLE_L2_COARSE_VBASE, vector_paddr, vector_vaddr,
up_setlevel2coarseentry(PGTABLE_L2_COARSE_VBASE,
vector_paddr,
vector_vaddr,
MMU_L2_VECTORFLAGS);
vector_paddr += 4096;
vector_vaddr += 4096;
}
/* Now set the level 1 descriptor to refer to the level 2 coarse page table. */
/* Now set the level 1 descriptor to refer to the level 2 coarse page
* table.
*/
up_setlevel1entry(PGTABLE_L2_COARSE_PBASE, DM320_VECTOR_VCOARSE, MMU_L1_VECTORFLAGS);
up_setlevel1entry(PGTABLE_L2_COARSE_PBASE,
DM320_VECTOR_VCOARSE,
MMU_L1_VECTORFLAGS);
}
/************************************************************************************
/****************************************************************************
* Name: up_copyvectorblock
************************************************************************************/
****************************************************************************/
static void up_copyvectorblock(void)
{
@ -183,20 +193,20 @@ static void up_copyvectorblock(void)
}
}
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
void arm_boot(void)
{
/* __start provided the basic MMU mappings for SDRAM. Now provide mappings for all
* IO regions (Including the vector region).
/* __start provided the basic MMU mappings for SDRAM.
* Now provide mappings for all IO regions (Including the vector region).
*/
up_setupmappings();
/* Provide a special mapping for the IRAM interrupt vector positioned in high
* memory.
/* Provide a special mapping for the IRAM interrupt vector positioned in
* high memory.
*/
up_vectormapping();

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_busc.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,28 +16,28 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_BUSC_H
#define __ARCH_ARM_SRC_DM320_DM320_BUSC_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Bus Controller Register Map (BUSC) ***********************************************/
/* Bus Controller Register Map (BUSC) ***************************************/
#define DM320_BUSC_ECR (DM320_BUSC_REGISTER_BASE+0x0000) /* Endian Conversion Register */
#define DM320_BUSC_EBYTER (DM320_BUSC_REGISTER_BASE+0x0002) /* Endian Byte Reverse Register */
#define DM320_BUSC_EBITR (DM320_BUSC_REGISTER_BASE+0x0004) /* Endian Bit Reverse Register */
#define DM320_BUSC_REVR (DM320_BUSC_REGISTER_BASE+0x0006) /* Device Revision Register */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#endif /* __ARCH_ARM_SRC_DM320_DM320_BUSC_H */

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_clkc.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,20 +16,20 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_CLKC_H
#define __ARCH_ARM_SRC_DM320_DM320_CLKC_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Clock Controller Register Map (CLKC) *********************************************/
/* Clock Controller Register Map (CLKC) *************************************/
#define DM320_CLKC_PLLA (DM320_CLKC_REGISTER_BASE+0x0000) /* PLLA Configuration */
#define DM320_CLKC_PLLB (DM320_CLKC_REGISTER_BASE+0x0002) /* PLLB Configuration */
@ -59,8 +59,8 @@
#define DM320_CLKC_TEST0 (DM320_CLKC_REGISTER_BASE+0x08FE) /* Test #0 */
#define DM320_CLKC_TEST1 (DM320_CLKC_REGISTER_BASE+0x08FE) /* Test #1 */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#endif /* __ARCH_ARM_SRC_DM320_DM320_CLKC_H */

View File

@ -1,4 +1,4 @@
/********************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_decodeirq.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*
********************************************************************************/
****************************************************************************/
/********************************************************************************
/****************************************************************************
* Included Files
********************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -36,9 +36,9 @@
#include "group/group.h"
/********************************************************************************
/****************************************************************************
* Public Functions
********************************************************************************/
****************************************************************************/
uint32_t *arm_decodeirq(uint32_t *regs)
{
@ -52,7 +52,9 @@ uint32_t *arm_decodeirq(uint32_t *regs)
uint16_t irqentry = getreg16(DM320_INTC_IRQENTRY0);
/* The irqentry value is an offset into a table. Zero means no interrupt. */
/* The irqentry value is an offset into a table.
* Zero means no interrupt.
*/
if (irqentry != 0)
{
@ -68,8 +70,10 @@ uint32_t *arm_decodeirq(uint32_t *regs)
arm_ack_irq(irq);
/* Current regs non-zero indicates that we are processing an interrupt;
* CURRENT_REGS is also used to manage interrupt level context switches.
/* Current regs non-zero indicates that we are processing an
* interrupt;
* CURRENT_REGS is also used to manage interrupt level context
* switches.
*
* Nested interrupts are not supported.
*/

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_emif.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,18 +16,18 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_EMIF_H
#define __ARCH_ARM_SRC_DM320_DM320_EMIF_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* External Memory Interface (EMIF) Registers */
@ -82,9 +82,9 @@
#define DM320_EMIF_DMACTL (DM320_PERIPHERALS_VADDR + 0x0A60) /* DMA Control Register */
#define DM320_EMIF_TEST (DM320_PERIPHERALS_VADDR + 0x0A62) /* Test Register.Do not use */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__

View File

@ -43,7 +43,7 @@
* Pre-processor Definitions
****************************************************************************/
/* Configuration ********************************************************/
/* Configuration ************************************************************/
/* Video (X,Y) base offset */
@ -206,7 +206,7 @@
# endif
#endif
/* DM320 ****************************************************************/
/* DM320 ********************************************************************/
/* Video planes. This long messy conditional compilation results in
* consecutive plane numbers assigned for enable planes and the total
@ -478,28 +478,44 @@ static void dm320_hwinitialize(void);
/* Framebuffer interface methods */
#ifndef CONFIG_DM320_VID0_DISABLE
static int dm320_getvid0videoinfo(FAR struct fb_vtable_s *vtable, FAR struct fb_videoinfo_s *vinfo);
static int dm320_getvid0planeinfo(FAR struct fb_vtable_s *vtable, int planeno, FAR struct fb_planeinfo_s *pinfo);
static int dm320_getvid0videoinfo(FAR struct fb_vtable_s *vtable,
FAR struct fb_videoinfo_s *vinfo);
static int dm320_getvid0planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo);
#endif
#ifndef CONFIG_DM320_VID1_DISABLE
static int dm320_getvid1videoinfo(FAR struct fb_vtable_s *vtable, FAR struct fb_videoinfo_s *vinfo);
static int dm320_getvid1planeinfo(FAR struct fb_vtable_s *vtable, int planeno, FAR struct fb_planeinfo_s *pinfo);
static int dm320_getvid1videoinfo(FAR struct fb_vtable_s *vtable,
FAR struct fb_videoinfo_s *vinfo);
static int dm320_getvid1planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo);
#endif
#ifndef CONFIG_DM320_OSD0_DISABLE
static int dm320_getosd0videoinfo(FAR struct fb_vtable_s *vtable, FAR struct fb_videoinfo_s *vinfo);
static int dm320_getosd0planeinfo(FAR struct fb_vtable_s *vtable, int planeno, FAR struct fb_planeinfo_s *pinfo);
static int dm320_getosd0videoinfo(FAR struct fb_vtable_s *vtable,
FAR struct fb_videoinfo_s *vinfo);
static int dm320_getosd0planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo);
#endif
#ifndef CONFIG_DM320_OSD1_DISABLE
static int dm320_getosd1videoinfo(FAR struct fb_vtable_s *vtable, FAR struct fb_videoinfo_s *vinfo);
static int dm320_getosd1planeinfo(FAR struct fb_vtable_s *vtable, int planeno, FAR struct fb_planeinfo_s *pinfo);
static int dm320_getosd1videoinfo(FAR struct fb_vtable_s *vtable,
FAR struct fb_videoinfo_s *vinfo);
static int dm320_getosd1planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo);
#endif
#if defined(CONFIG_FB_CMAP) && (!defined(CONFIG_DM320_OSD0_DISABLE) && !defined(CONFIG_DM320_OSD1_DISABLE))
static int dm320_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap);
static int dm320_putcmap(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s *cmap);
static int dm320_getcmap(FAR struct fb_vtable_s *vtable,
FAR struct fb_cmap_s *cmap);
static int dm320_putcmap(FAR struct fb_vtable_s *vtable,
FAR const struct fb_cmap_s *cmap);
#endif
#ifdef CONFIG_FB_HWCURSOR
static int dm320_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursorattrib_s *attrib);
static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *settings);
static int dm320_getcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_cursorattrib_s *attrib);
static int dm320_setcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_setcursor_s *settings);
#endif
/****************************************************************************
@ -788,7 +804,6 @@ static void dm320_hwinitialize(void)
ginfo("Setup framebuffer addresses:\n");
putreg16(((dm320_osd1upperoffset() << 8) |
dm320_osd0upperoffset()), DM320_OSD_OSDWINADH);
putreg16(dm320_osd0loweroffset(), DM320_OSD_OSDWIN0ADL);
@ -801,7 +816,8 @@ static void dm320_hwinitialize(void)
/* Set up VID WIN0 */
#if defined(CONFIG_DM320_VID0_DISABLE) || defined(CONFIG_DM320_VID1_DISABLE)
putreg16(((dm320_vid1upperoffset() << 8) | dm320_vid0upperoffset()), DM320_OSD_VIDWINADH);
putreg16(((dm320_vid1upperoffset() << 8) |
dm320_vid0upperoffset()), DM320_OSD_VIDWINADH);
#endif
#ifndef CONFIG_DM320_VID0_DISABLE
@ -923,10 +939,13 @@ static void dm320_hwinitialize(void)
/* DM320_RECTCURSOR_SETUP:
*
* Bit 0: 0=rectangular cursor inactive 1=on 0
* Bits 113: Vertical line height: {1,2,4,6,8,10,12,14} CONFIG_DM320_CURSORLINEHEIGHT
* 4:6: Horizontal line width: {1,4,8,16,20,24,28} CONFIG_DM320_CURSORLINEWIDTH
* Bits 113: Vertical line height: {1,2,4,6,8,10,12,14}
* CONFIG_DM320_CURSORLINEHEIGHT
* 4:6: Horizontal line width: {1,4,8,16,20,24,28}
* CONFIG_DM320_CURSORLINEWIDTH
* 7: 0=ROM lookup table, 1=RAM lookup table 0
* 8:15: Rectangular cursor color palette address CONFIG_DM320_CURSORCLUT
* 8:15: Rectangular cursor color palette address
* CONFIG_DM320_CURSORCLUT
*/
putreg16(DM320_RECTCURSOR_SETUP, DM320_OSD_RECTCUR);
@ -985,7 +1004,8 @@ static int dm320_getvid0videoinfo(FAR struct fb_vtable_s *vtable,
****************************************************************************/
#ifndef CONFIG_DM320_VID0_DISABLE
static int dm320_getvid0planeinfo(FAR struct fb_vtable_s *vtable, int planeno,
static int dm320_getvid0planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo)
{
#ifdef CONFIG_DEBUG_FEATURES
@ -1032,7 +1052,8 @@ static int dm320_getvid1videoinfo(FAR struct fb_vtable_s *vtable,
****************************************************************************/
#ifndef CONFIG_DM320_VID1_DISABLE
static int dm320_getvid1planeinfo(FAR struct fb_vtable_s *vtable, int planeno,
static int dm320_getvid1planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo)
{
#ifdef CONFIG_DEBUG_FEATURES
@ -1083,7 +1104,8 @@ static int dm320_getosd0videoinfo(FAR struct fb_vtable_s *vtable,
****************************************************************************/
#ifndef CONFIG_DM320_OSD0_DISABLE
static int dm320_getosd0planeinfo(FAR struct fb_vtable_s *vtable, int planeno,
static int dm320_getosd0planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo)
{
#ifdef CONFIG_DEBUG_FEATURES
@ -1134,7 +1156,8 @@ static int dm320_getosd1videoinfo(FAR struct fb_vtable_s *vtable,
****************************************************************************/
#ifndef CONFIG_DM320_OSD1_DISABLE
static int dm320_getosd1planeinfo(FAR struct fb_vtable_s *vtable, int planeno,
static int dm320_getosd1planeinfo(FAR struct fb_vtable_s *vtable,
int planeno,
FAR struct fb_planeinfo_s *pinfo)
{
#ifdef CONFIG_DEBUG_FEATURES
@ -1158,7 +1181,8 @@ static int dm320_getosd1planeinfo(FAR struct fb_vtable_s *vtable, int planeno,
****************************************************************************/
#if defined(CONFIG_FB_CMAP) && (!defined(CONFIG_DM320_OSD0_DISABLE) && !defined(CONFIG_DM320_OSD1_DISABLE))
static int dm320_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap)
static int dm320_getcmap(FAR struct fb_vtable_s *vtable,
FAR struct fb_cmap_s *cmap)
{
/* I don't think the RAM clut is readable */
@ -1171,7 +1195,8 @@ static int dm320_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *c
****************************************************************************/
#if defined(CONFIG_FB_CMAP) && (!defined(CONFIG_DM320_OSD0_DISABLE) && !defined(CONFIG_DM320_OSD1_DISABLE))
static int dm320_putcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap)
static int dm320_putcmap(FAR struct fb_vtable_s *vtable,
FAR struct fb_cmap_s *cmap)
{
irqstate_t flags;
uint16_t regval;
@ -1198,7 +1223,7 @@ static int dm320_putcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *c
/* Program the CLUT */
while (getreg16(DM320_OSD_MISCCTL) & 0x8);
putreg16(((uint16_t)y) << 8 | uint16_t(u)), DM320_OSD_CLUTRAMYCB);
putreg16((((uint16_t)y) << 8 | uint16_t(u)), DM320_OSD_CLUTRAMYCB);
putreg16(((uint16_t)v << 8 | i), DM320_OSD_CLUTRAMCR);
}
@ -1226,7 +1251,8 @@ static int dm320_putcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *c
****************************************************************************/
#ifdef CONFIG_FB_HWCURSOR
static int dm320_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursorattrib_s *attrib)
static int dm320_getcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_cursorattrib_s *attrib)
{
irqstate_t flags;
@ -1268,7 +1294,8 @@ static int dm320_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursora
****************************************************************************/
#ifdef CONFIG_FB_HWCURSOR
static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *settings)
static int dm320_setcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_setcursor_s *settings)
{
irqstate_t flags;
uint16_t regval;
@ -1386,7 +1413,8 @@ int up_fbinitialize(int display)
*
* Description:
* Return a a reference to the framebuffer object for the specified video
* plane of the specified plane. Many OSDs support multiple planes of video.
* plane of the specified plane.
* Many OSDs support multiple planes of video.
*
* Input Parameters:
* display - In the case of hardware with multiple displays, this
@ -1422,6 +1450,7 @@ FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane)
default:
break;
}
return NULL;
}

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_gio.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,23 +16,23 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_GIO_H
#define __ARCH_ARM_SRC_DM320_DM320_GIO_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
# include "arm_arch.h"
#endif
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* General I/O Registers */
@ -150,9 +150,9 @@
putreg16((getreg16(DM320_GIO_INV0) & ~(1<<(pin))), DM320_GIO_INV0); \
}
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_intc.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,18 +16,18 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_INTC_H
#define __ARCH_ARM_SRC_DM320_DM320_INTC_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Interrupt Controller Registers */
@ -75,9 +75,9 @@
#define DM320_INTC_INTPRI18 (DM320_PERIPHERALS_VADDR + 0x0564) /* Interrupt Priority Register #18 */
#define DM320_INTC_INTPRI19 (DM320_PERIPHERALS_VADDR + 0x0566) /* Interrupt Priority Register #19 */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__

View File

@ -131,7 +131,8 @@ void up_disable_irq(int irq)
* Clear the associated bit to disable the interrupt
*/
putreg16((getreg16(DM320_INTC_EINT0) & ~(1 << irq)), DM320_INTC_EINT0);
putreg16((getreg16(DM320_INTC_EINT0) &
~(1 << irq)), DM320_INTC_EINT0);
}
else if (irq < 32)
{
@ -139,7 +140,8 @@ void up_disable_irq(int irq)
* Clear the associated bit to disable the interrupt
*/
putreg16((getreg16(DM320_INTC_EINT1) & ~(1 << (irq-16))), DM320_INTC_EINT1);
putreg16((getreg16(DM320_INTC_EINT1) &
~(1 << (irq - 16))), DM320_INTC_EINT1);
}
else
{
@ -147,7 +149,8 @@ void up_disable_irq(int irq)
* Clear the associated bit to disable the interrupt
*/
putreg16((getreg16(DM320_INTC_EINT2) & ~(1 << (irq-32))), DM320_INTC_EINT2);
putreg16((getreg16(DM320_INTC_EINT2) &
~(1 << (irq - 32))), DM320_INTC_EINT2);
}
}
@ -171,7 +174,8 @@ void up_enable_irq(int irq)
* Set the associated bit to enable the interrupt
*/
putreg16((getreg16(DM320_INTC_EINT0) | (1 << irq)), DM320_INTC_EINT0);
putreg16((getreg16(DM320_INTC_EINT0) |
(1 << irq)), DM320_INTC_EINT0);
}
else if (irq < 32)
{
@ -179,7 +183,8 @@ void up_enable_irq(int irq)
* Set the associated bit to enable the interrupt
*/
putreg16((getreg16(DM320_INTC_EINT1) | (1 << (irq-16))), DM320_INTC_EINT1);
putreg16((getreg16(DM320_INTC_EINT1) |
(1 << (irq - 16))), DM320_INTC_EINT1);
}
else
{
@ -187,7 +192,8 @@ void up_enable_irq(int irq)
* Set the associated bit to enable the interrupt
*/
putreg16((getreg16(DM320_INTC_EINT2) | (1 << (irq-32))), DM320_INTC_EINT2);
putreg16((getreg16(DM320_INTC_EINT2) |
(1 << (irq - 32))), DM320_INTC_EINT2);
}
}
@ -215,12 +221,12 @@ void arm_ack_irq(int irq)
{
/* Set the associated status bit to clear the interrupt */
putreg16((1 << (irq-16)), DM320_INTC_IRQ1);
putreg16((1 << (irq - 16)), DM320_INTC_IRQ1);
}
else
{
/* Set the associated status bit to clear the interrupt */
putreg16((1 << (irq-32)), DM320_INTC_IRQ2);
putreg16((1 << (irq - 32)), DM320_INTC_IRQ2);
}
}

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_memorymap.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,25 +16,25 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_MEMORYMAP_H
#define __ARCH_ARM_SRC_DM320_DM320_MEMORYMAP_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <arch/board/board.h>
#include "arm.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Mapped base of all registers *****************************************************/
/* Mapped base of all registers *********************************************/
/* DM320 Physical Memory Map, where:
*
@ -43,19 +43,20 @@
* -- = Neither
*
* NOTE:
* 1. Most DM320 memory sections can be programmed to lie at different locations in
* the memory map. Therefore, much of the DM320 physical memory map is really
* board-specific and, as such, really belongs in the
* 1. Most DM320 memory sections can be programmed to lie at different
* locations in the memory map. Therefore, much of the DM320 physical
* memory map is really board-specific and, as such, really belongs in the
* boards/arm/dm320/<board-name>/include/board.h file rather than here.
*
* To handle all cases, this file defines a "default" physical memory map, but
* section address for most regions can be overridden if the same setting is
* defined in the board.h file (These defaults correspond to the product Neuros
* OSD memory configuration).
* To handle all cases, this file defines a "default" physical memory map,
* but section address for most regions can be overridden if the same
* setting is defined in the board.h file (These defaults correspond to
* the product Neuros OSD memory configuration).
*
* 2. The DM320 only has a single control line for external peripherals. To support
* more than one peripheral, most hardware will use external memory decode logic,
* so that physical memory regions is in the board-specific files.
* 2. The DM320 only has a single control line for external peripherals. To
* support more than one peripheral, most hardware will use external
* memory decode logic, so that physical memory regions is in the
* board-specific files.
*/
/* Section/Region Name Phys Address Size TLB Entry CW */
@ -129,6 +130,7 @@
/* Section/Region Name Virt Address End Size CW */
#define DM320_SDRAM_VSECTION 0x00000000 /* 0x1effffff 496Mb CW */
#define DM320_SDRAM_VADDR 0x00000000 /* 0x1effffff 496Mb CW */
/* 0x1f000000 0xdfffffff UNMAPPED */
#define DM320_FLASH_VSECTION 0xc0000000 /* 0xc0ffffff 16Mb -- */
#define DM320_EXT_MEM_VADDR 0xc0000000 /* 0xc0ffffff 16Mb -- */
@ -150,14 +152,17 @@
#define DM320_DSP_ONCHIP_RAM_VADDR 0xf0040000 /* 0xf005ffff 128Kb -- */
#define DM320_AHB_VADDR 0xf0060000 /* 0xf0060fff 4Kb -- */
#define DM320_COPRO_SUB_VADDR 0xf0080000 /* 0xf009ffff 128Kb -- */
/* 0xf0100000 0xffefffff UNMAPPED */
#define DM320_VECTOR_VCOARSE 0xfff00000 /* 0xffffffff 1Mb -- */
/* 0xfff00000 0xfffeffff UNMAPPED */
#define DM320_VECTOR_VADDR 0xffff0000 /* 0xffff3fff 16Kb -- */
/* 0xffff4000 0xffffffff UNMAPPED */
/* The NuttX entry point starts at an offset from the virtual beginning of DRAM.
* This offset reserves space for the MMU page cache.
/* The NuttX entry point starts at an offset from the virtual beginning
* of DRAM. This offset reserves space for the MMU page cache.
*/
#define NUTTX_START_VADDR (DM320_SDRAM_VADDR+PGTABLE_SIZE)
@ -238,9 +243,9 @@
#define DM320_VLYNQ_REGISTER_BASE (DM320_AHB_VADDR + 0x0300) /* VLYNQ */
#define DM320_AHBBUSC_REGISTER_BASE (DM320_AHB_VADDR + 0x0F00) /* AHBBUSC */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_osd.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,20 +16,20 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_OSD_H
#define __ARCH_ARM_SRC_DM320_DM320_OSD_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* On Screen Display Register Map (OSD) *********************************************/
/* On Screen Display Register Map (OSD) *************************************/
#define DM320_OSD_OSDMODE (DM320_OSD_REGISTER_BASE+0x0000) /* OSD Mode Setup */
#define DM320_OSD_VIDWINMD (DM320_OSD_REGISTER_BASE+0x0002) /* Video Window Mode Setup */
@ -92,8 +92,8 @@
#define DM320_OSD_PPVWIN0ADH (DM320_OSD_REGISTER_BASE+0x007c) /* Ping-Pong Video Window 0 Address (High) */
#define DM320_OSD_PPVWIN0ADL (DM320_OSD_REGISTER_BASE+0x007e) /* Ping-Pong Video Window 0 Address (Low) */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#endif /* __ARCH_ARM_SRC_DM320_DM320_OSD_H */

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_timer.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,18 +16,18 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_TIMER_H
#define __ARCH_ARM_SRC_DM320_DM320_TIMER_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Timer Registers */
@ -82,9 +82,9 @@
#define DM320_TMR_COUNT_MASK 0xffff /* Bits 0:15=Current counter value */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_uart.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,24 +16,24 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_UART_H
#define __ARCH_ARM_SRC_DM320_DM320_UART_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* UART definitions *****************************************************************/
/* UART definitions *********************************************************/
/* UART Registers (offsets from the register base) */
@ -55,6 +55,7 @@
#define UART_DTRR_DTR_MASK 0x00ff /* Data transmit/receive */
/* UART BRSR register bit definitions */
/* The UART module is clocked by either the AHB clock or PLLIN / 16 */
#ifdef CONFIG_DM320_UARTPPLIN
@ -154,8 +155,8 @@
#define UART_SR_CTSS 0x1000 /* CTS status */
#define UART_SR_DSRS 0x8000 /* DSR status */
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#endif /* __ARCH_ARM_SRC_DM320_DM320_UART_H */

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/dm320/dm320_usb.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,20 +16,20 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_DM320_DM320_USB_H
#define __ARCH_ARM_SRC_DM320_DM320_USB_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* USB Controller Registers *********************************************************/
/* USB Controller Registers *************************************************/
#define DM320_USB_FADDR (DM320_USBOTG_VADDR+0x0000) /* Peripheral Address */
#define DM320_USB_POWER (DM320_USBOTG_VADDR+0x0001) /* Power Control */
@ -90,7 +90,7 @@
#define DM320_USB_DMAADDR4 (DM320_USBOTG_VADDR+0x0238) /* DMA Channel4 Address */
#define DM320_USB_DMACOUNT4 (DM320_USBOTG_VADDR+0x023c) /* DMA Channel4 Byte Count */
/* POWER register bit settings ******************************************************/
/* POWER register bit settings **********************************************/
#define USB_POWER_ENSUS (0x00000001)
#define USB_POWER_SUSPEND (0x00000002)
@ -101,7 +101,7 @@
#define USB_POWER_VBUSVAL (0x00000040)
#define USB_POWER_ISO (0x00000080)
/* USB interrupt bits **************************************************************/
/* USB interrupt bits *******************************************************/
#define USB_INT_NOINTERRUPT (0x00000000)
#define USB_INT_SUSPEND (0x00000001)
@ -135,11 +135,11 @@
#define USB_EP2_RX (0x04)
#define USB_EP1_RX (0x02)
/* Endpoint control register index *************************************************/
/* Endpoint control register index ******************************************/
#define USB_EP0_SELECT (0x00)
/* DEVCTL register bit settings ****************************************************/
/* DEVCTL register bit settings *********************************************/
#define USB_DEVCTL_CID (0x80)
#define USB_DEVCTL_FSDEV (0x40)
@ -150,7 +150,7 @@
#define USB_DEVCTL_HOSTREQ (0x02)
#define USB_DEVCTL_SESSREQ (0x01)
/* PERCSR0 register bit settings ***************************************************/
/* PERCSR0 register bit settings ********************************************/
#define USB_PERCSR0_CLRSETEND (0x80)
#define USB_PERCSR0_CLRRXRDY (0x40)
@ -161,7 +161,7 @@
#define USB_PERCSR0_TXPKTRDY (0x02)
#define USB_PERCSR0_RXPKTRDY (0x01)
/* TXCSR1 register bit settings ****************************************************/
/* TXCSR1 register bit settings *********************************************/
#define USB_TXCSR1_CLRDATTOG (0x40)
#define USB_TXCSR1_SENTST (0x20)
@ -171,11 +171,11 @@
#define USB_TXCSR1_FIFOEMP (0x02)
#define USB_TXCSR1_TXPKTRDY (0x01)
/* CSR2 register bit settings ******************************************************/
/* CSR2 register bit settings ***********************************************/
#define USB_CSR2_FLFIFO (0x01)
/* TXCSR2 register bit settings ****************************************************/
/* TXCSR2 register bit settings *********************************************/
#define USB_TXCSR2_AUTOSET (0x80)
#define USB_TXCSR2_ISO (0x40)
@ -184,7 +184,7 @@
#define USB_TXCSR2_FRDATTOG (0x08)
#define USB_TXCSR2_DMAMODE1 (0x04)
/* PERRXCSR1 register bit settings *************************************************/
/* PERRXCSR1 register bit settings ******************************************/
#define USB_PERRXCSR1_CLRDATTOG (0x80)
#define USB_PERRXCSR1_SENTST (0x40)
@ -195,14 +195,14 @@
#define USB_PERRXCSR1_FIFOFUL (0x02)
#define USB_PERRXCSR1_RXPKTRDY (0x01)
/* PERRXCSR2 register bit settings *************************************************/
/* PERRXCSR2 register bit settings ******************************************/
#define USB_PERPXCSR2_AUTOCLR (0x80)
#define USB_PERPXCSR2_ISO (0x40)
#define USB_PERPXCSR2_DMAEN (0x20)
#define USB_PERPXCSR2_DMAMODE1 (0x10)
/* TXFIFO2 register bit settings **************************************************/
/* TXFIFO2 register bit settings ********************************************/
#define USB_TXFIF02_SZMASK (0xe0)
#define USB_TXFIFO2_SZ_8 (0x00)
@ -216,19 +216,19 @@
#define USB_TXFIFO2_SINGLE_BUF (0x00)
#define USB_TXFIFO2_DOUBLE_BUF (0x10)
/* RXFIFO2 register bit settings **************************************************/
/* RXFIFO2 register bit settings ********************************************/
#define USB_RXFIF02_DPB (0x10)
/* USBDMA control register bit settings ********************************************/
/* USBDMA control register bit settings *************************************/
#define USBDMA_CNTL_DMAEN (0x01)
#define USBDMA_CNTL_DIR_IN (0x02)
#define USBDMA_CNTL_DMAMODE1 (0x04)
#define USBDMA_CNTL_INTREN (0x08)
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#endif /* __ARCH_ARM_SRC_DM320_DM320_USB_H */

View File

@ -82,7 +82,7 @@
#undef CONFIG_DM320_USBDEV_REGDEBUG
/* Debug ***********************************************************************/
/* Debug ********************************************************************/
/* Trace error codes */
@ -142,7 +142,7 @@
#define DM320_TRACEINTID_USBCTLR 0x001d
#define DM320_TRACEINTID_VBUSERR 0x001f
/* Hardware interface **********************************************************/
/* Hardware interface *******************************************************/
/* The DM320 hardware supports 8 configurable endpoints EP1-4, IN and OUT
* (in addition to EP0 IN and OUT). This driver, however, does not exploit
@ -164,7 +164,7 @@
#define DM320_EPBULKOUT 2 /* Bulk EP for recv to host */
#define DM320_EPINTRIN 3 /* Intr EP for host poll */
/* Request queue operations ****************************************************/
/* Request queue operations *************************************************/
#define dm320_rqempty(ep) ((ep)->head == NULL)
#define dm320_rqpeek(ep) ((ep)->head)
@ -269,10 +269,13 @@ static void dm320_putreg32(uint32_t val, uint32_t addr);
# define dm320_putreg32(val,addr) putreg32(val,addr)
#endif
/* Request queue operations ****************************************************/
/* Request queue operations *************************************************/
static FAR struct dm320_req_s *dm320_rqdequeue(FAR struct dm320_ep_s *privep);
static void dm320_rqenqueue(FAR struct dm320_ep_s *privep, FAR struct dm320_req_s *req);
static FAR struct
dm320_req_s *dm320_rqdequeue(FAR struct dm320_ep_s *privep);
static void dm320_rqenqueue(FAR struct dm320_ep_s *privep,
FAR struct dm320_req_s *req);
/* Low level data transfers and request operations */
@ -309,19 +312,24 @@ static int dm320_epconfigure(FAR struct usbdev_ep_s *ep,
const struct usb_epdesc_s *desc, bool last);
static int dm320_epdisable(FAR struct usbdev_ep_s *ep);
static FAR struct usbdev_req_s *dm320_epallocreq(FAR struct usbdev_ep_s *ep);
static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req);
static void dm320_epfreereq(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req);
#ifdef CONFIG_USBDEV_DMA
static FAR void *dm320_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbytes);
static FAR void *dm320_epallocbuffer(FAR struct usbdev_ep_s *ep,
uint16_t nbytes);
static void dm320_epfreebuffer(FAR struct usbdev_ep_s *ep, void *buf);
#endif
static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, struct usbdev_req_s *privreq);
static int dm320_epcancel(FAR struct usbdev_ep_s *ep, struct usbdev_req_s *privreq);
static int dm320_epsubmit(FAR struct usbdev_ep_s *ep,
struct usbdev_req_s *privreq);
static int dm320_epcancel(FAR struct usbdev_ep_s *ep,
struct usbdev_req_s *privreq);
/* USB device controller methods */
static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev,
uint8_t epno, bool in, uint8_t eptype);
static void dm320_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep);
static void dm320_freeep(FAR struct usbdev_s *dev,
FAR struct usbdev_ep_s *ep);
static int dm320_getframe(struct usbdev_s *dev);
static int dm320_wakeup(struct usbdev_s *dev);
static int dm320_selfpowered(struct usbdev_s *dev, bool selfpowered);
@ -361,7 +369,9 @@ static const struct usbdev_ops_s g_devops =
#endif
};
/* There is only one, single, pre-allocated instance of the driver structure */
/* There is only one, single, pre-allocated instance of the driver
* structure
*/
static struct dm320_usbdev_s g_usbdev;
@ -418,8 +428,8 @@ static uint8_t dm320_getreg8(uint32_t addr)
uint8_t val = getreg8(addr);
/* Is this the same value that we read from the same register last time? Are
* we polling the register? If so, suppress some of the output.
/* Is this the same value that we read from the same register last time?
* Are we polling the register? If so, suppress some of the output.
*/
if (addr == prevaddr || val == preval)
@ -445,7 +455,7 @@ static uint8_t dm320_getreg8(uint32_t addr)
{
/* Yes.. then show how many times the value repeated */
uinfo("[repeats %d more times]\n", count-3);
uinfo("[repeats %d more times]\n", count - 3);
}
/* Save the new address, value, and count */
@ -481,8 +491,8 @@ static uint32_t dm320_getreg16(uint32_t addr)
uint16_t val = getreg16(addr);
/* Is this the same value that we read from the same register last time? Are
* we polling the register? If so, suppress some of the output.
/* Is this the same value that we read from the same register last time?
* Are we polling the register? If so, suppress some of the output.
*/
if (addr == prevaddr || val == preval)
@ -508,7 +518,7 @@ static uint32_t dm320_getreg16(uint32_t addr)
{
/* Yes.. then show how many times the value repeated */
uinfo("[repeats %d more times]\n", count-3);
uinfo("[repeats %d more times]\n", count - 3);
}
/* Save the new address, value, and count */
@ -544,8 +554,8 @@ static uint32_t dm320_getreg32(uint32_t addr)
uint32_t val = getreg32(addr);
/* Is this the same value that we read from the same register last time? Are
* we polling the register? If so, suppress some of the output.
/* Is this the same value that we read from the same register last time?
* Are we polling the register? If so, suppress some of the output.
*/
if (addr == prevaddr || val == preval)
@ -571,7 +581,7 @@ static uint32_t dm320_getreg32(uint32_t addr)
{
/* Yes.. then show how many times the value repeated */
uinfo("[repeats %d more times]\n", count-3);
uinfo("[repeats %d more times]\n", count - 3);
}
/* Save the new address, value, and count */
@ -754,6 +764,7 @@ static int dm320_epwrite(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
{
return ret;
}
dm320_putreg8(epphy, DM320_USB_INDEX);
if (epphy == USB_EP0_SELECT)
@ -773,9 +784,11 @@ static int dm320_epwrite(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
if (dm320_getreg8(DM320_USB_PERTXCSR1) & USB_TXCSR1_FIFOEMP)
{
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) | USB_TXCSR1_TXPKTRDY, DM320_USB_PERTXCSR1);
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) |
USB_TXCSR1_TXPKTRDY, DM320_USB_PERTXCSR1);
while (dm320_getreg8(DM320_USB_PERTXCSR1) & USB_TXCSR1_TXPKTRDY);
dm320_putreg8((dm320_getreg8(DM320_USB_PERTXCSR1) | USB_TXCSR1_FLFIFO), DM320_USB_PERTXCSR1);
dm320_putreg8((dm320_getreg8(DM320_USB_PERTXCSR1) |
USB_TXCSR1_FLFIFO), DM320_USB_PERTXCSR1);
}
while (bytesleft > 0)
@ -783,7 +796,9 @@ static int dm320_epwrite(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
*fifo = *buf++;
bytesleft--;
}
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) | USB_TXCSR1_TXPKTRDY, DM320_USB_PERTXCSR1);
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) |
USB_TXCSR1_TXPKTRDY, DM320_USB_PERTXCSR1);
return ret;
}
@ -805,6 +820,7 @@ static int dm320_epread(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
{
return ret;
}
dm320_putreg8(epphy, DM320_USB_INDEX);
if (epphy == USB_EP0_SELECT)
@ -837,7 +853,8 @@ static int dm320_epread(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
/* Clear RXPKTRDY bit in PER_RXCSR1 */
dm320_putreg8(dm320_getreg8(DM320_USB_PERRXCSR1) & ~(USB_PERRXCSR1_RXPKTRDY), DM320_USB_PERRXCSR1);
dm320_putreg8(dm320_getreg8(DM320_USB_PERRXCSR1) &
~(USB_PERRXCSR1_RXPKTRDY), DM320_USB_PERRXCSR1);
return ret;
}
@ -853,7 +870,8 @@ static inline void dm320_abortrequest(struct dm320_ep_s *privep,
struct dm320_req_s *privreq,
int16_t result)
{
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_REQABORTED), (uint16_t)privep->epphy);
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_REQABORTED),
(uint16_t)privep->epphy);
/* Save the result in the request structure */
@ -1047,7 +1065,8 @@ static int dm320_rdrequest(struct dm320_ep_s *privep)
*/
privreq->req.xfrd += nbytesread;
if (privreq->req.len < privreq->req.xfrd || nbytesread < privep->ep.maxpacket)
if (privreq->req.len < privreq->req.xfrd ||
nbytesread < privep->ep.maxpacket)
{
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
dm320_reqcomplete(privep, OK);
@ -1228,7 +1247,8 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
* len: 2; data = status
*/
dm320_putreg8(USB_PERCSR0_CLRRXRDY | USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
dm320_putreg8(USB_PERCSR0_CLRRXRDY |
USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_GETSTATUS), 0);
if (len != 2 || (ctrl.type & USB_REQ_DIR_IN) == 0 || value != 0)
@ -1246,7 +1266,8 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
privep = dm320_epfindbyaddr(priv, index);
if (!privep)
{
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDGETSTEP), ctrl.type);
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDGETSTEP),
ctrl.type);
priv->stalled = 1;
}
}
@ -1259,7 +1280,8 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
default:
{
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDGETSTRECIP), ctrl.type);
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDGETSTRECIP),
ctrl.type);
priv->stalled = 1;
}
break;
@ -1276,8 +1298,10 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
* len: zero, data = none
*/
dm320_putreg8(USB_PERCSR0_CLRRXRDY | USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_CLEARFEATURE), (uint16_t)ctrl.req);
dm320_putreg8(USB_PERCSR0_CLRRXRDY |
USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_CLEARFEATURE),
(uint16_t)ctrl.req);
if (ctrl.type != USB_REQ_RECIPIENT_ENDPOINT)
{
dm320_dispatchrequest(priv, &ctrl);
@ -1293,7 +1317,8 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
}
else
{
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDCLRFEATURE), ctrl.type);
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDCLRFEATURE),
ctrl.type);
priv->stalled = 1;
}
}
@ -1307,9 +1332,11 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
* len: 0; data = none
*/
dm320_putreg8(USB_PERCSR0_CLRRXRDY | USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
dm320_putreg8(USB_PERCSR0_CLRRXRDY |
USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_SETFEATURE), 0);
if (ctrl.type == USB_REQ_RECIPIENT_DEVICE && value == USB_FEATURE_TESTMODE)
if (ctrl.type == USB_REQ_RECIPIENT_DEVICE &&
value == USB_FEATURE_TESTMODE)
{
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_TESTMODE), index);
}
@ -1324,7 +1351,8 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
}
else
{
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDSETFEATURE), ctrl.type);
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_STALLEDSETFEATURE),
ctrl.type);
priv->stalled = 1;
}
}
@ -1346,17 +1374,21 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
break;
case USB_REQ_GETDESCRIPTOR:
/* type: device-to-host; recipient = device
* value: descriptor type and index
* index: 0 or language ID;
* len: descriptor len; data = descriptor
*/
case USB_REQ_SETDESCRIPTOR:
/* type: host-to-device; recipient = device
* value: descriptor type and index
* index: 0 or language ID;
* len: descriptor len; data = descriptor
*/
{
dm320_putreg8(USB_PERCSR0_CLRRXRDY, DM320_USB_PERCSR0);
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_GETSETDESC), 0);
@ -1365,24 +1397,31 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
break;
case USB_REQ_GETCONFIGURATION:
/* type: device-to-host; recipient = device
* value: 0;
* index: 0;
* len: 1; data = configuration value
*/
case USB_REQ_SETCONFIGURATION:
/* type: host-to-device; recipient = device
* value: configuration value
* index: 0;
* len: 0; data = none
*/
case USB_REQ_GETINTERFACE:
/* type: device-to-host; recipient = interface
* value: 0
* index: interface;
* len: 1; data = alt interface
*/
case USB_REQ_SETINTERFACE:
/* type: host-to-device; recipient = interface
* value: alternate setting
* index: interface;
@ -1513,6 +1552,7 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context, FAR void *arg)
intstatus = ((uint32_t)dm320_getreg8(DM320_USB_INTRTX1) << 12) |
(((uint32_t)dm320_getreg8(DM320_USB_INTRRX1) >> 1) << 8) |
(uint32_t)dm320_getreg8(DM320_USB_INTRUSB);
/* Then process each interrupt source, highest priority first */
do
@ -1576,7 +1616,8 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context, FAR void *arg)
}
else if ((csr0 & USB_PERCSR0_SETEND) != 0)
{
usbtrace(TRACE_INTENTRY(DM320_TRACEINTID_TXFIFOSETEND), csr0);
usbtrace(TRACE_INTENTRY(DM320_TRACEINTID_TXFIFOSETEND),
csr0);
dm320_putreg8(USB_PERCSR0_CLRSETEND, DM320_USB_PERCSR0);
}
else if ((csr0 & USB_PERCSR0_TXPKTRDY) != 0)
@ -1587,7 +1628,8 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context, FAR void *arg)
{
/* Now ignore these unknown interrupts */
dm320_putreg8(USB_PERCSR0_CLRRXRDY | USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
dm320_putreg8(USB_PERCSR0_CLRRXRDY |
USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
usbtrace(TRACE_INTENTRY(DM320_TRACEINTID_UNKNOWN), csr0);
}
}
@ -1616,14 +1658,18 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context, FAR void *arg)
dm320_putreg8(DM320_EPBULKIN, DM320_USB_INDEX);
if (dm320_getreg8(DM320_USB_PERTXCSR1) & USB_TXCSR1_SENTST)
{
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) & ~USB_TXCSR1_SENTST, DM320_USB_PERTXCSR1);
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) & ~USB_TXCSR1_SENDST, DM320_USB_PERTXCSR1);
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) &
~USB_TXCSR1_SENTST, DM320_USB_PERTXCSR1);
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) &
~USB_TXCSR1_SENDST, DM320_USB_PERTXCSR1);
}
#endif
if (priv->usbdev.speed == USB_SPEED_UNKNOWN)
{
priv->usbdev.speed = USB_SPEED_FULL;
}
privep = &priv->eplist[DM320_EPBULKIN];
if (!dm320_rqempty(privep))
@ -1651,8 +1697,8 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context, FAR void *arg)
}
intstatus = intstatus & ~priorityint;
}
while (intstatus != USB_INT_NOINTERRUPT);
return OK;
}
@ -1687,7 +1733,8 @@ static int dm320_attachinterrupt(int irq, FAR void *context, FAR void *arg)
priv->usbdev.speed = USB_SPEED_UNKNOWN;
priv->attached = 0;
dm320_putreg16(dm320_getreg16(DM320_CLKC_LPCTL1) | 0x0010, DM320_CLKC_LPCTL1);
dm320_putreg16(dm320_getreg16(DM320_CLKC_LPCTL1) |
0x0010, DM320_CLKC_LPCTL1);
if ((dm320_getreg8(DM320_USB_PERTXCSR1) & USB_TXCSR1_FIFOEMP))
{
dm320_putreg8(USB_TXCSR1_FLFIFO, DM320_USB_PERTXCSR1);
@ -1704,14 +1751,17 @@ static int dm320_attachinterrupt(int irq, FAR void *context, FAR void *arg)
priv->usbdev.speed = USB_SPEED_UNKNOWN;
dm320_ctrlinitialize(priv);
dm320_putreg16(dm320_getreg16(DM320_INTC_FISEL0) & 0x7f, DM320_INTC_FISEL0);
dm320_putreg16(dm320_getreg16(DM320_INTC_EINT0) | 0x80, DM320_INTC_EINT0);
dm320_putreg16(dm320_getreg16(DM320_INTC_FISEL0) &
0x7f, DM320_INTC_FISEL0);
dm320_putreg16(dm320_getreg16(DM320_INTC_EINT0) |
0x80, DM320_INTC_EINT0);
priv->usbdev.speed = USB_SPEED_UNKNOWN;
priv->paddrset = 0;
priv->paddr = 0;
priv->attached = 1;
}
return OK;
}
@ -1722,7 +1772,8 @@ static int dm320_attachinterrupt(int irq, FAR void *context, FAR void *arg)
static void dm320_epreset(unsigned int index)
{
dm320_putreg8(index, DM320_USB_INDEX);
dm320_putreg8(USB_PERCSR0_CLRSETEND | USB_PERCSR0_CLRRXRDY, DM320_USB_PERCSR0);
dm320_putreg8(USB_PERCSR0_CLRSETEND |
USB_PERCSR0_CLRRXRDY, DM320_USB_PERCSR0);
dm320_putreg8(USB_CSR2_FLFIFO, DM320_USB_CSR2);
dm320_putreg8(USB_CSR2_FLFIFO, DM320_USB_CSR2);
}
@ -1737,7 +1788,7 @@ static void dm320_epreset(unsigned int index)
static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
{
uint16_t offset; /* Full USB buffer offset */
uint16_t offset; /* Full USB buffer offset */
uint8_t addrhi; /* MS bytes of offset */
uint8_t addrlo; /* LS bytes of offset */
int i;
@ -1811,12 +1862,14 @@ static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
/* FIFO address, max packet size, dual/single buffered */
dm320_putreg8(addrhi, DM320_USB_RXFIFO1);
dm320_putreg8(addrhi | g_epinfo[i].fifo | USB_RXFIF02_DPB, DM320_USB_RXFIFO2);
dm320_putreg8(addrhi | g_epinfo[i].fifo |
USB_RXFIF02_DPB, DM320_USB_RXFIFO2);
/* RX endpoint max packet size */
dm320_putreg8(g_epinfo[i].maxpacket >> 3, DM320_USB_RXMAXP);
}
offset += g_epinfo[i].maxpacket;
}
}
@ -1831,14 +1884,17 @@ static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
{
/* Setup the USB controller for operation as a periperhal *******************/
/* Setup the USB controller for operation as a periperhal *****************/
/* Enable USB clock */
dm320_putreg16(dm320_getreg16(DM320_CLKC_MOD2) | 0x0060, DM320_CLKC_MOD2);
dm320_putreg16(dm320_getreg16(DM320_CLKC_MOD2) |
0x0060, DM320_CLKC_MOD2);
/* Disable USB Power down mode */
dm320_putreg16(dm320_getreg16(DM320_CLKC_LPCTL1) & 0xFFEF, DM320_CLKC_LPCTL1);
dm320_putreg16(dm320_getreg16(DM320_CLKC_LPCTL1) &
0xffef, DM320_CLKC_LPCTL1);
/* Put USB controller in peripheral mode */
@ -1850,7 +1906,7 @@ static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
dm320_putreg8(0x00, DM320_USB_FADDR); /* Reset peripheral address register */
dm320_putreg8(0x00, DM320_USB_POWER); /* Reset power control register */
/* Initialize interrupts *****************************************************/
/* Initialize interrupts **************************************************/
arm_ack_irq(DM320_IRQ_USB0); /* Clear USB controller interrupt */
arm_ack_irq(DM320_IRQ_USB1); /* Clear USB DMA interrupt flag */
@ -1868,7 +1924,7 @@ static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
USB_INT_SESSRQ | USB_INT_SOF,
DM320_USB_INTRUSBE);
/* Initialize endpoints ******************************************************/
/* Initialize endpoints ***************************************************/
dm320_epinitialize(priv);
@ -1935,6 +1991,7 @@ static int dm320_epdisable(FAR struct usbdev_ep_s *ep)
return -EINVAL;
}
#endif
usbtrace(TRACE_EPDISABLE, privep->epphy);
/* Cancel any ongoing activity and reset the endpoint */
@ -1965,6 +2022,7 @@ static FAR struct usbdev_req_s *dm320_epallocreq(FAR struct usbdev_ep_s *ep)
return NULL;
}
#endif
usbtrace(TRACE_EPALLOCREQ, ((FAR struct dm320_ep_s *)ep)->epphy);
privreq = (FAR struct dm320_req_s *)kmm_malloc(sizeof(struct dm320_req_s));
@ -1986,7 +2044,8 @@ static FAR struct usbdev_req_s *dm320_epallocreq(FAR struct usbdev_ep_s *ep)
*
****************************************************************************/
static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
static void dm320_epfreereq(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
{
FAR struct dm320_req_s *privreq = (FAR struct dm320_req_s *)req;
@ -2052,7 +2111,8 @@ static void dm320_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
*
****************************************************************************/
static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
static int dm320_epsubmit(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
{
FAR struct dm320_req_s *privreq = (FAR struct dm320_req_s *)req;
FAR struct dm320_ep_s *privep = (FAR struct dm320_ep_s *)ep;
@ -2067,6 +2127,7 @@ static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
return -EINVAL;
}
#endif
usbtrace(TRACE_EPSUBMIT, privep->epphy);
priv = privep->dev;
@ -2085,7 +2146,8 @@ static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
if (req->len == 0 && (privep->in || privep->epphy == 3))
{
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_NULLPACKET), 0);
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) | USB_TXCSR1_TXPKTRDY, DM320_USB_PERTXCSR1);
dm320_putreg8(dm320_getreg8(DM320_USB_PERTXCSR1) |
USB_TXCSR1_TXPKTRDY, DM320_USB_PERTXCSR1);
dm320_abortrequest(privep, privreq, OK);
}
@ -2149,7 +2211,8 @@ static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
*
****************************************************************************/
static int dm320_epcancel(struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
static int dm320_epcancel(struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req)
{
FAR struct dm320_ep_s *privep = (FAR struct dm320_ep_s *)ep;
FAR struct dm320_usbdev_s *priv;
@ -2183,16 +2246,18 @@ static int dm320_epcancel(struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
* Allocate an endpoint matching the parameters
*
* Input Parameters:
* eplog - 7-bit logical endpoint number (direction bit ignored). Zero means
* that any endpoint matching the other requirements will suffice. The
* assigned endpoint can be found in the eplog field.
* eplog - 7-bit logical endpoint number (direction bit ignored). Zero
* means that any endpoint matching the other requirements will
* suffice. The assigned endpoint can be found in the eplog
* field.
* in - true: IN (device-to-host) endpoint requested
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
* 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,
static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev,
uint8_t eplog,
bool in, uint8_t eptype)
{
FAR struct dm320_usbdev_s *priv = (FAR struct dm320_usbdev_s *)dev;
@ -2254,7 +2319,8 @@ static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev, uint8_t e
*
****************************************************************************/
static void dm320_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
static void dm320_freeep(FAR struct usbdev_s *dev,
FAR struct usbdev_ep_s *ep)
{
FAR struct dm320_ep_s *privep = (FAR struct dm320_ep_s *)ep;
usbtrace(TRACE_DEVFREEEP, (uint16_t)privep->epphy);
@ -2408,7 +2474,9 @@ void arm_usbinitialize(void)
/* Enable USB clock & GIO clock */
dm320_putreg16(dm320_getreg16(DM320_CLKC_MOD2) | 0x0060, DM320_CLKC_MOD2);
dm320_putreg16(dm320_getreg16(DM320_CLKC_DIV4) | (((4) - 1) << 8) | ((1) - 1), DM320_CLKC_DIV4);
dm320_putreg16(dm320_getreg16(DM320_CLKC_DIV4) |
(((4) - 1) << 8) | ((1) - 1),
DM320_CLKC_DIV4);
/* Initialize D+ pullup control GIO */
@ -2419,7 +2487,8 @@ void arm_usbinitialize(void)
GIO_INTERRUPT(CONFIG_DM320_GIO_USBATTACH);
GIO_BOTHEDGES(CONFIG_DM320_GIO_USBATTACH);
dm320_putreg16(dm320_getreg16(DM320_GIO_CHAT0) | (1 << CONFIG_DM320_GIO_USBATTACH), DM320_GIO_CHAT0);
dm320_putreg16(dm320_getreg16(DM320_GIO_CHAT0) |
(1 << CONFIG_DM320_GIO_USBATTACH), DM320_GIO_CHAT0);
/* Attach host attach GIO interrupt */
@ -2503,7 +2572,8 @@ void arm_usbuninitialize(void)
}
priv->usbdev.speed = USB_SPEED_UNKNOWN;
dm320_putreg16(dm320_getreg16(DM320_CLKC_LPCTL1) | 0x0010, DM320_CLKC_LPCTL1);
dm320_putreg16(dm320_getreg16(DM320_CLKC_LPCTL1) | 0x0010,
DM320_CLKC_LPCTL1);
/* Disable and detach IRQs */
@ -2514,14 +2584,14 @@ void arm_usbuninitialize(void)
irq_detach(DM320_IRQ_USB1);
}
/************************************************************************************
/****************************************************************************
* Name: usbdevclass_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.
* 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(FAR struct usbdevclass_driver_s *driver)
{
@ -2573,15 +2643,16 @@ int usbdev_register(FAR struct usbdevclass_driver_s *driver)
return OK;
}
/************************************************************************************
/****************************************************************************
* Name: usbdev_unregister
*
* Description:
* Un-register usbdev class driver.If the USB device is connected to a USB host,
* it will first disconnect(). The driver is also requested to unbind() and clean
* up any device state, before this procedure finally returns.
* Un-register usbdev class driver.If the USB device is connected to a USB
* host, 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(FAR struct usbdevclass_driver_s *driver)
{