Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
ab5c1654
Commit
ab5c1654
authored
Aug 14, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usb-debug: Cleaned up code of usbdcdc
parent
a601d517
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
145 additions
and
675 deletions
+145
-675
Changes_usb.txt
sw/common/usb/Changes_usb.txt
+0
-0
ReadMe_usb.txt
sw/common/usb/ReadMe_usb.txt
+0
-0
Silabs_License_Agreement.txt
sw/common/usb/Silabs_License_Agreement.txt
+0
-0
em_usb.h
sw/common/usb/inc/em_usb.h
+0
-0
em_usbd.h
sw/common/usb/inc/em_usbd.h
+0
-0
em_usbh.h
sw/common/usb/inc/em_usbh.h
+0
-0
em_usbhal.h
sw/common/usb/inc/em_usbhal.h
+0
-0
em_usbtypes.h
sw/common/usb/inc/em_usbtypes.h
+0
-0
em_usbd.c
sw/common/usb/src/em_usbd.c
+0
-0
em_usbdch9.c
sw/common/usb/src/em_usbdch9.c
+0
-0
em_usbdep.c
sw/common/usb/src/em_usbdep.c
+0
-0
em_usbdint.c
sw/common/usb/src/em_usbdint.c
+0
-0
em_usbh.c
sw/common/usb/src/em_usbh.c
+0
-0
em_usbhal.c
sw/common/usb/src/em_usbhal.c
+0
-0
em_usbhep.c
sw/common/usb/src/em_usbhep.c
+0
-0
em_usbhint.c
sw/common/usb/src/em_usbhint.c
+0
-0
em_usbtimer.c
sw/common/usb/src/em_usbtimer.c
+0
-0
usbdesc.c
sw/common/usb/usbdesc.c
+84
-0
usbdesc.h
sw/common/usb/usbdesc.h
+15
-5
Makefile
sw/usbdcdc/armgcc/Makefile
+10
-9
main.c
sw/usbdcdc/src/main.c
+36
-661
No files found.
sw/
usbdcdc
/usb/Changes_usb.txt
→
sw/
common
/usb/Changes_usb.txt
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/ReadMe_usb.txt
→
sw/
common
/usb/ReadMe_usb.txt
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/Silabs_License_Agreement.txt
→
sw/
common
/usb/Silabs_License_Agreement.txt
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/inc/em_usb.h
→
sw/
common
/usb/inc/em_usb.h
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/inc/em_usbd.h
→
sw/
common
/usb/inc/em_usbd.h
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/inc/em_usbh.h
→
sw/
common
/usb/inc/em_usbh.h
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/inc/em_usbhal.h
→
sw/
common
/usb/inc/em_usbhal.h
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/inc/em_usbtypes.h
→
sw/
common
/usb/inc/em_usbtypes.h
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbd.c
→
sw/
common
/usb/src/em_usbd.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbdch9.c
→
sw/
common
/usb/src/em_usbdch9.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbdep.c
→
sw/
common
/usb/src/em_usbdep.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbdint.c
→
sw/
common
/usb/src/em_usbdint.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbh.c
→
sw/
common
/usb/src/em_usbh.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbhal.c
→
sw/
common
/usb/src/em_usbhal.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbhep.c
→
sw/
common
/usb/src/em_usbhep.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbhint.c
→
sw/
common
/usb/src/em_usbhint.c
View file @
ab5c1654
File moved
sw/
usbdcdc
/usb/src/em_usbtimer.c
→
sw/
common
/usb/src/em_usbtimer.c
View file @
ab5c1654
File moved
sw/common/usb/usbdesc.c
0 → 100644
View file @
ab5c1654
#include "usbdesc.h"
/* The serial port LINE CODING data structure, used to carry information */
/* about serial port baudrate, parity etc. between host and device. */
EFM32_PACK_START
(
1
)
struct
__attribute__
((
packed
))
cdc_line_coding
{
uint32_t
dwDTERate
;
/** Baudrate */
uint8_t
bCharFormat
;
/** Stop bits, 0=1 1=1.5 2=2 */
uint8_t
bParityType
;
/** 0=None 1=Odd 2=Even 3=Mark 4=Space */
uint8_t
bDataBits
;
/** 5, 6, 7, 8 or 16 */
uint8_t
dummy
;
/** To ensure size is a multiple of 4 bytes.*/
};
EFM32_PACK_END
()
/*** Variables ***/
/*
* The LineCoding variable must be 4-byte aligned as it is used as USB
* transmit and receive buffer
*/
EFM32_ALIGN
(
4
)
EFM32_PACK_START
(
1
)
static
struct
cdc_line_coding
__attribute__
((
aligned
(
4
)))
line_coding
=
{
4800
,
2
,
0
,
8
,
0
};
EFM32_PACK_END
()
/**************************************************************************//**
* @brief
* Handle USB setup commands. Implements CDC class specific commands.
*
* @param[in] setup Pointer to the setup packet received.
*
* @return USB_STATUS_OK if command accepted.
* USB_STATUS_REQ_UNHANDLED when command is unknown, the USB device
* stack will handle the request.
*****************************************************************************/
int
usbdesc_cb_setup
(
const
USB_Setup_TypeDef
*
setup
)
{
int
r
=
USB_STATUS_REQ_UNHANDLED
;
if
((
setup
->
Type
==
USB_SETUP_TYPE_CLASS
)
&&
(
setup
->
Recipient
==
USB_SETUP_RECIPIENT_INTERFACE
))
{
switch
(
setup
->
bRequest
)
{
case
USB_CDC_GETLINECODING
:
/********************/
if
((
setup
->
wValue
==
0
)
&&
(
setup
->
wIndex
==
0
)
&&
(
setup
->
wLength
==
7
)
&&
(
setup
->
Direction
==
USB_SETUP_DIR_IN
))
{
/* Send current settings to USB host. */
USBD_Write
(
0
,
(
void
*
)
&
line_coding
,
7
,
NULL
);
r
=
USB_STATUS_OK
;
}
break
;
case
USB_CDC_SETLINECODING
:
/********************/
if
((
setup
->
wValue
==
0
)
&&
(
setup
->
wIndex
==
0
)
&&
(
setup
->
wLength
==
7
)
&&
(
setup
->
Direction
!=
USB_SETUP_DIR_IN
))
{
/* Get new settings from USB host. */
USBD_Read
(
0
,
(
void
*
)
&
line_coding
,
7
,
NULL
);
r
=
USB_STATUS_OK
;
}
break
;
case
USB_CDC_SETCTRLLINESTATE
:
/********************/
if
((
setup
->
wIndex
==
0
)
&&
(
setup
->
wLength
==
0
))
{
/* Do nothing ( Non compliant behaviour !! ) */
r
=
USB_STATUS_OK
;
}
break
;
}
}
return
r
;
}
sw/common/usb/usbdesc.h
View file @
ab5c1654
...
...
@@ -17,9 +17,19 @@
extern
"C"
{
#endif
#include "em_usb.h"
/*=====================*/
/* Function prototypes */
/*=====================*/
int
usbdesc_cb_setup
(
const
USB_Setup_TypeDef
*
setup
);
/*===============================*/
/* Define USB endpoint addresses */
#define USBDESC_EP_DATA_OUT 0x01
/* Endpoint for USB data reception. */
#define USBDESC_EP_DATA_IN 0x81
/* Endpoint for USB data transmission. */
/*===============================*/
#define USBDESC_EP_DATA_IN 0x01
/* Endpoint for USB data reception. */
#define USBDESC_EP_DATA_OUT 0x81
/* Endpoint for USB data transmission. */
#define USBDESC_EP_NOTIFY 0x82
/* The notification endpoint (not used). */
#define USBDESC_BULK_EP_SIZE USB_MAX_EP_SIZE
/* This is the max. ep size. */
...
...
@@ -136,7 +146,7 @@ static const uint8_t configDesc[] __attribute__ ((aligned(4)))=
/*** CDC Data interface endpoint descriptors ***/
USB_ENDPOINT_DESCSIZE
,
/* bLength */
USB_ENDPOINT_DESCRIPTOR
,
/* bDescriptorType */
USBDESC_EP_DATA_
OUT
,
/* bEndpointAddress (IN) */
USBDESC_EP_DATA_
IN
,
/* bEndpointAddress (IN) */
USB_EPTYPE_BULK
,
/* bmAttributes */
USBDESC_BULK_EP_SIZE
,
/* wMaxPacketSize (LSB) */
0
,
/* wMaxPacketSize (MSB) */
...
...
@@ -144,7 +154,7 @@ static const uint8_t configDesc[] __attribute__ ((aligned(4)))=
USB_ENDPOINT_DESCSIZE
,
/* bLength */
USB_ENDPOINT_DESCRIPTOR
,
/* bDescriptorType */
USBDESC_EP_DATA_
IN
,
/* bEndpointAddress (OUT)*/
USBDESC_EP_DATA_
OUT
,
/* bEndpointAddress (OUT)*/
USB_EPTYPE_BULK
,
/* bmAttributes */
USBDESC_BULK_EP_SIZE
,
/* wMaxPacketSize (LSB) */
0
,
/* wMaxPacketSize (MSB) */
...
...
@@ -176,7 +186,7 @@ static const USBD_Callbacks_TypeDef callbacks =
{
.
usbReset
=
NULL
,
.
usbStateChange
=
NULL
,
.
setupCmd
=
SetupCmd
,
.
setupCmd
=
usbdesc_cb_setup
,
.
isSelfPowered
=
NULL
,
.
sofInt
=
NULL
};
...
...
sw/usbdcdc/armgcc/Makefile
View file @
ab5c1654
...
...
@@ -101,7 +101,7 @@ override CFLAGS += -D$(DEVICE) -Wall -Wextra -mcpu=cortex-m3 -mthumb \
-fdata-sections -fomit-frame-pointer -DDEBUG_EFM_USER
\
$(DEPFLAGS)
override
ASMFLAGS
+=
-x assembler-with-cpp -D
$(DEVICE)
-Wall -Wextra -mcpu=cortex-m3 -mthumb -DDEBUG_EFM_USER
override
ASMFLAGS
+=
-x assembler-with-cpp -D
$(DEVICE)
-Wall -Wextra -mcpu=cortex-m3 -mthumb -DDEBUG_EFM_USER
#
# NOTE: The -Wl,--gc-sections flag may interfere with debugging using gdb.
...
...
@@ -119,7 +119,7 @@ INCLUDEPATHS += \
-I../../common/Device/EnergyMicro/EFM32GG/Include
\
-I../../common/emlib/inc
\
-I../../common/usb
\
-I../usb/inc
\
-I../
../common/
usb/inc
\
-I../kits/common/drivers
\
-I../kits/common/bsp
\
-I../kits/EFM32GG_DK3750/config
...
...
@@ -140,16 +140,17 @@ C_SRC += \
../../common/emlib/src/em_system.c
\
../../common/emlib/src/em_timer.c
\
../../common/emlib/src/em_leuart.c
\
../usb/src/em_usbd.c
\
../usb/src/em_usbdch9.c
\
../usb/src/em_usbhal.c
\
../usb/src/em_usbdep.c
\
../usb/src/em_usbdint.c
\
../usb/src/em_usbtimer.c
\
../
../common/
usb/src/em_usbd.c
\
../
../common/
usb/src/em_usbdch9.c
\
../
../common/
usb/src/em_usbhal.c
\
../
../common/
usb/src/em_usbdep.c
\
../
../common/
usb/src/em_usbdint.c
\
../
../common/
usb/src/em_usbtimer.c
\
../kits/common/drivers/dmactrl.c
\
../../common/usb/usbdesc.c
\
../src/main.c
s_SRC
+=
s_SRC
+=
S_SRC
+=
\
../../common/Device/EnergyMicro/EFM32GG/Source/GCC/startup_efm32gg.S
...
...
sw/usbdcdc/src/main.c
View file @
ab5c1654
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment