Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
4a3b70e7
Commit
4a3b70e7
authored
Feb 27, 2011
by
Dean Camera
Browse files
Fix USB Host mode compile errors for the UC3B architecture.
parent
381dd0d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
LUFA/Common/Common.h
View file @
4a3b70e7
...
...
@@ -102,6 +102,7 @@
#define eeprom_read_byte(x) *x
#define eeprom_update_byte(x, y) *x = y
#define eeprom_write_byte(x, y) *x = y
#define _delay_ms(x)
#define memcmp_P(...) memcmp(__VA_ARGS__)
#define memcpy_P(...) memcpy(__VA_ARGS__)
...
...
LUFA/Drivers/USB/Core/UC3B/Host_UC3B.h
View file @
4a3b70e7
...
...
@@ -180,7 +180,7 @@
static
inline
void
USB_Host_ResetBus
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_ResetBus
(
void
)
{
AVR32_USBB
_
UHCON
.
reset
=
true
;
AVR32_USBB
.
UHCON
.
reset
=
true
;
}
/** Determines if a previously issued bus reset (via the \ref USB_Host_ResetBus() macro) has
...
...
@@ -191,7 +191,7 @@
static
inline
bool
USB_Host_IsBusResetComplete
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
USB_Host_IsBusResetComplete
(
void
)
{
return
AVR32_USBB
_
UHCON
.
reset
;
return
AVR32_USBB
.
UHCON
.
reset
;
}
/** Resumes USB communications with an attached and enumerated device, by resuming the transmission
...
...
@@ -201,7 +201,7 @@
static
inline
void
USB_Host_ResumeBus
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_ResumeBus
(
void
)
{
AVR32_USBB
_
UHCON
.
sofe
=
true
;
AVR32_USBB
.
UHCON
.
sofe
=
true
;
}
/** Suspends the USB bus, preventing any communications from occurring between the host and attached
...
...
@@ -211,7 +211,7 @@
static
inline
void
USB_Host_SuspendBus
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_SuspendBus
(
void
)
{
AVR32_USBB
_
UHCON
.
sofe
=
false
;
AVR32_USBB
.
UHCON
.
sofe
=
false
;
}
/** Determines if the USB bus has been suspended via the use of the \ref USB_Host_SuspendBus() macro,
...
...
@@ -223,7 +223,7 @@
static
inline
bool
USB_Host_IsBusSuspended
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
USB_Host_IsBusSuspended
(
void
)
{
return
AVR32_USBB
_
UHCON
.
sofe
;
return
AVR32_USBB
.
UHCON
.
sofe
;
}
/** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or
...
...
@@ -234,7 +234,7 @@
static
inline
bool
USB_Host_IsDeviceFullSpeed
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
USB_Host_IsDeviceFullSpeed
(
void
)
{
return
(
AVR32_USBB
_
USBSTA
.
speed
==
AVR32_USBB_SPEED_FULL
);
return
(
AVR32_USBB
.
USBSTA
.
speed
==
AVR32_USBB_SPEED_FULL
);
}
/** Determines if the attached device is currently issuing a Remote Wakeup request, requesting
...
...
@@ -245,14 +245,14 @@
static
inline
bool
USB_Host_IsRemoteWakeupSent
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
USB_Host_IsRemoteWakeupSent
(
void
)
{
return
AVR32_USBB
_
UHINT
.
rxrsmi
;
return
AVR32_USBB
.
UHINT
.
rxrsmi
;
}
/** Clears the flag indicating that a Remote Wakeup request has been issued by an attached device. */
static
inline
void
USB_Host_ClearRemoteWakeupSent
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_ClearRemoteWakeupSent
(
void
)
{
AVR32_USBB
_
UHINTCLR
.
rxrsmic
=
true
;
AVR32_USBB
.
UHINTCLR
.
rxrsmic
=
true
;
}
/** Accepts a Remote Wakeup request from an attached device. This must be issued in response to
...
...
@@ -262,7 +262,7 @@
static
inline
void
USB_Host_ResumeFromWakeupRequest
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_ResumeFromWakeupRequest
(
void
)
{
AVR32_USBB
_
UHCON
.
resume
=
true
;
AVR32_USBB
.
UHCON
.
resume
=
true
;
}
/** Determines if a resume from Remote Wakeup request is currently being sent to an attached
...
...
@@ -273,7 +273,7 @@
static
inline
bool
USB_Host_IsResumeFromWakeupRequestSent
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
USB_Host_IsResumeFromWakeupRequestSent
(
void
)
{
return
AVR32_USBB
_
UHCON
.
resume
;
return
AVR32_USBB
.
UHCON
.
resume
;
}
/* Function Prototypes: */
...
...
@@ -348,13 +348,13 @@
static
inline
void
USB_Host_VBUS_Auto_Enable
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_VBUS_Auto_Enable
(
void
)
{
AVR32_USBB
_
USBCON
.
vbushwc
=
false
;
AVR32_USBB
.
USBCON
.
vbushwc
=
false
;
}
static
inline
void
USB_Host_VBUS_Manual_Enable
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_VBUS_Manual_Enable
(
void
)
{
AVR32_USBB
_
USBCON
.
vbushwc
=
true
;
AVR32_USBB
.
USBCON
.
vbushwc
=
true
;
// TODO: Manual VBUS pin output setup
}
...
...
@@ -362,7 +362,7 @@
static
inline
void
USB_Host_VBUS_Auto_On
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_VBUS_Auto_On
(
void
)
{
AVR32_USBB
_
USBSTASET
.
vbusr
e
qs
=
true
;
AVR32_USBB
.
USBSTASET
.
vbusrqs
=
true
;
}
static
inline
void
USB_Host_VBUS_Manual_On
(
void
)
ATTR_ALWAYS_INLINE
;
...
...
@@ -374,7 +374,7 @@
static
inline
void
USB_Host_VBUS_Auto_Off
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_VBUS_Auto_Off
(
void
)
{
AVR32_USBB
_
USBSTACLR
.
vbusr
e
qc
=
true
;
AVR32_USBB
.
USBSTACLR
.
vbusrqc
=
true
;
}
static
inline
void
USB_Host_VBUS_Manual_Off
(
void
)
ATTR_ALWAYS_INLINE
;
...
...
@@ -386,13 +386,13 @@
static
inline
void
USB_Host_SetDeviceAddress
(
const
uint8_t
Address
)
ATTR_ALWAYS_INLINE
;
static
inline
void
USB_Host_SetDeviceAddress
(
const
uint8_t
Address
)
{
AVR32_USBB
_
UHADDR1
.
uhaddrp0
=
Address
;
AVR32_USBB
_
UHADDR1
.
uhaddrp1
=
Address
;
AVR32_USBB
_
UHADDR1
.
uhaddrp2
=
Address
;
AVR32_USBB
_
UHADDR1
.
uhaddrp3
=
Address
;
AVR32_USBB
_
UHADDR2
.
uhaddrp4
=
Address
;
AVR32_USBB
_
UHADDR2
.
uhaddrp5
=
Address
;
AVR32_USBB
_
UHADDR2
.
uhaddrp6
=
Address
;
AVR32_USBB
.
UHADDR1
.
uhaddr
_
p0
=
Address
;
AVR32_USBB
.
UHADDR1
.
uhaddr
_
p1
=
Address
;
AVR32_USBB
.
UHADDR1
.
uhaddr
_
p2
=
Address
;
AVR32_USBB
.
UHADDR1
.
uhaddr
_
p3
=
Address
;
AVR32_USBB
.
UHADDR2
.
uhaddr
_
p4
=
Address
;
AVR32_USBB
.
UHADDR2
.
uhaddr
_
p5
=
Address
;
AVR32_USBB
.
UHADDR2
.
uhaddr
_
p6
=
Address
;
}
/* Enums: */
...
...
LUFA/Drivers/USB/Core/UC3B/Pipe_UC3B.h
View file @
4a3b70e7
...
...
@@ -96,30 +96,33 @@
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* External Variables: */
extern
uint8_t
USB_SelectedPipe
;
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** \name Pipe Error Flag Masks */
//@{
/** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */
#define PIPE_ERRORFLAG_OVERFLOW ((1 << AVR32_USBB_UPSTA0_OVERFI_OFFSET) << 8)
/** Mask for \ref Pipe_GetErrorFlags(), indicating that an underflow error occurred in the pipe on the received data. */
#define PIPE_ERRORFLAG_UNDERFLOW ((1 << AVR32_USBB_UPSTA0_UNDERFI_OFFSET) << 8)
#define PIPE_ERRORFLAG_OVERFLOW (AVR32_USBB_UPSTA0_OVERFI_MASK << 8)
/** Mask for \ref Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */
#define PIPE_ERRORFLAG_CRC16
(1 <<
AVR32_USBB_UPERR0_CRC16_
OFFSET)
#define PIPE_ERRORFLAG_CRC16 AVR32_USBB_UPERR0_CRC16_
MASK
/** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware timeout error occurred in the pipe. */
#define PIPE_ERRORFLAG_TIMEOUT
(1 <<
AVR32_USBB_UPERR0_TIMEOUT_
OFFSET)
#define PIPE_ERRORFLAG_TIMEOUT AVR32_USBB_UPERR0_TIMEOUT_
MASK
/** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware PID error occurred in the pipe. */
#define PIPE_ERRORFLAG_PID
(1 <<
AVR32_USBB_UPERR0_PID_
OFFSET)
#define PIPE_ERRORFLAG_PID AVR32_USBB_UPERR0_PID_
MASK
/** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware data PID error occurred in the pipe. */
#define PIPE_ERRORFLAG_DATAPID
(1 <<
AVR32_USBB_UPERR0_DATAPID_
OFFSET)
#define PIPE_ERRORFLAG_DATAPID AVR32_USBB_UPERR0_DATAPID_
MASK
/** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware data toggle error occurred in the pipe. */
#define PIPE_ERRORFLAG_DATATGL
(1 <<
AVR32_USBB_UPERR0_DATATGL_
OFFSET)
#define PIPE_ERRORFLAG_DATATGL AVR32_USBB_UPERR0_DATATGL_
MASK
//@}
/** \name Pipe Token Masks */
...
...
@@ -254,7 +257,7 @@
static
inline
void
Pipe_EnablePipe
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
Pipe_EnablePipe
(
void
)
{
AVR32_USBB
.
uprst
|=
(
AVR32_USBB_PEN0_MASK
<<
PipeNumber
);
AVR32_USBB
.
uprst
|=
(
AVR32_USBB_PEN0_MASK
<<
USB_SelectedPipe
);
}
/** Disables the currently selected pipe so that data cannot be sent and received through it to and
...
...
@@ -263,7 +266,7 @@
static
inline
void
Pipe_DisablePipe
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
Pipe_DisablePipe
(
void
)
{
AVR32_USBB
.
uprst
&=
~
(
AVR32_USBB_PEN0_MASK
<<
PipeNumber
);
AVR32_USBB
.
uprst
&=
~
(
AVR32_USBB_PEN0_MASK
<<
USB_SelectedPipe
);
}
/** Determines if the currently selected pipe is enabled, but not necessarily configured.
...
...
@@ -273,7 +276,7 @@
static
inline
bool
Pipe_IsEnabled
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
Pipe_IsEnabled
(
void
)
{
return
((
AVR32_USBB
.
uprst
&
(
AVR32_USBB_PEN0_MASK
<<
PipeNumber
))
?
true
:
false
);
return
((
AVR32_USBB
.
uprst
&
(
AVR32_USBB_PEN0_MASK
<<
USB_SelectedPipe
))
?
true
:
false
);
}
/** Gets the current pipe token, indicating the pipe's data direction and type.
...
...
@@ -405,6 +408,7 @@
static
inline
void
Pipe_ClearError
(
void
)
{
((
uint32_t
*
)
AVR32_USBB_UPERR0
)[
USB_SelectedPipe
]
=
0
;
((
avr32_usbb_upsta0clr_t
*
)
AVR32_USBB_UPSTA0CLR
)[
USB_SelectedPipe
].
overfic
=
true
;
}
/** Determines if the master pipe error flag is set for the currently selected pipe, indicating that
...
...
@@ -417,7 +421,8 @@
static
inline
bool
Pipe_IsError
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
Pipe_IsError
(
void
)
{
return
((((
avr32_usbb_upsta0_t
*
)
AVR32_USBB_UPSTA0
)[
USB_SelectedPipe
].
perri
)
?
true
:
false
);
return
((((
uint32_t
*
)
AVR32_USBB_UPSTA0
)[
USB_SelectedPipe
]
&
(
AVR32_USBB_PERRI_MASK
|
AVR32_USBB_OVERFI_MASK
))
?
true
:
false
);
}
/** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This
...
...
@@ -428,10 +433,13 @@
static
inline
uint8_t
Pipe_GetErrorFlags
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
uint8_t
Pipe_GetErrorFlags
(
void
)
{
return
((
UPERRX
&
(
PIPE_ERRORFLAG_CRC16
|
PIPE_ERRORFLAG_TIMEOUT
|
PIPE_ERRORFLAG_PID
|
PIPE_ERRORFLAG_DATAPID
|
PIPE_ERRORFLAG_DATATGL
))
|
(
UPSTAX
&
(
PIPE_ERRORFLAG_OVERFLOW
|
PIPE_ERRORFLAG_UNDERFLOW
)));
return
((((
uint32_t
*
)
AVR32_USBB_UPERR0
)[
USB_SelectedPipe
]
&
(
PIPE_ERRORFLAG_CRC16
|
PIPE_ERRORFLAG_TIMEOUT
|
PIPE_ERRORFLAG_PID
|
PIPE_ERRORFLAG_DATAPID
|
PIPE_ERRORFLAG_DATATGL
))
|
((((
uint32_t
*
)
AVR32_USBB_UPSTA0
)[
USB_SelectedPipe
]
<<
8
)
&
PIPE_ERRORFLAG_OVERFLOW
));
}
/** Retrieves the number of busy banks in the currently selected pipe, which have been queued for
...
...
@@ -487,7 +495,7 @@
static
inline
bool
Pipe_IsOUTReady
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
Pipe_IsOUTReady
(
void
)
{
return
((
avr32_usbb_upsta0_t
*
)
AVR32_USBB_UPSTA0
)[
USB_SelectedPipe
].
r
xouti
;
return
((
avr32_usbb_upsta0_t
*
)
AVR32_USBB_UPSTA0
)[
USB_SelectedPipe
].
t
xouti
;
}
/** Determines if no SETUP request is currently being sent to the attached device on the selected
...
...
@@ -522,7 +530,7 @@
static
inline
void
Pipe_ClearIN
(
void
)
{
((
avr32_usbb_upsta0clr_t
*
)
AVR32_USBB_UPSTA0CLR
)[
USB_SelectedPipe
].
rxinic
=
true
;
((
avr32_usbb_up
sta
0clr_t
*
)
AVR32_USBB_UP
STA
0CLR
)[
USB_SelectedPipe
].
fifoconc
=
true
;
((
avr32_usbb_up
con
0clr_t
*
)
AVR32_USBB_UP
CON
0CLR
)[
USB_SelectedPipe
].
fifoconc
=
true
;
}
/** Sends the currently selected pipe's contents to the device as an OUT packet on the selected pipe, freeing
...
...
@@ -534,7 +542,7 @@
static
inline
void
Pipe_ClearOUT
(
void
)
{
((
avr32_usbb_upsta0clr_t
*
)
AVR32_USBB_UPSTA0CLR
)[
USB_SelectedPipe
].
txoutic
=
true
;
((
avr32_usbb_up
sta
0clr_t
*
)
AVR32_USBB_UP
STA
0CLR
)[
USB_SelectedPipe
].
fifoconc
=
true
;
((
avr32_usbb_up
con
0clr_t
*
)
AVR32_USBB_UP
CON
0CLR
)[
USB_SelectedPipe
].
fifoconc
=
true
;
}
/** Determines if the device sent a NAK (Negative Acknowledge) in response to the last sent packet on
...
...
@@ -574,7 +582,7 @@
static
inline
bool
Pipe_IsStalled
(
void
)
ATTR_WARN_UNUSED_RESULT
ATTR_ALWAYS_INLINE
;
static
inline
bool
Pipe_IsStalled
(
void
)
{
return
((
avr32_usbb_upsta0_t
*
)
AVR32_USBB_UPSTA0
)[
USB_SelectedPipe
].
rxstall
e
di
;
return
((
avr32_usbb_upsta0_t
*
)
AVR32_USBB_UPSTA0
)[
USB_SelectedPipe
].
rxstalldi
;
}
/** Clears the STALL condition detection flag on the currently selected pipe, but does not clear the
...
...
@@ -585,7 +593,7 @@
static
inline
void
Pipe_ClearStall
(
void
)
ATTR_ALWAYS_INLINE
;
static
inline
void
Pipe_ClearStall
(
void
)
{
((
avr32_usbb_upsta0clr_t
*
)
AVR32_USBB_UPSTA0CLR
)[
USB_SelectedPipe
].
rxstall
e
dic
=
true
;
((
avr32_usbb_upsta0clr_t
*
)
AVR32_USBB_UPSTA0CLR
)[
USB_SelectedPipe
].
rxstalldic
=
true
;
}
/** Reads one byte from the currently selected pipe's bank, for OUT direction pipes.
...
...
@@ -913,9 +921,6 @@
/* Function Prototypes: */
void
Pipe_ClearPipes
(
void
);
/* External Variables: */
extern
uint8_t
USB_SelectedPipe
;
#endif
/* Disable C linkage for C++ Compilers: */
...
...
LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c
View file @
4a3b70e7
...
...
@@ -98,7 +98,7 @@ void USB_Disable(void)
void
USB_ResetInterface
(
void
)
{
#if defined(USB_CAN_BE_BOTH)
bool
UIDModeSelectEnabled
=
((
UHWCON
&
(
1
<<
UIDE
))
!=
0
)
;
bool
UIDModeSelectEnabled
=
AVR32_USBB
.
USBCON
.
uide
;
#endif
USB_INT_DisableAllInterrupts
();
...
...
Write
Preview
Supports
Markdown
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