Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lufa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Erik Strand
lufa
Commits
02dfd7dc
Commit
02dfd7dc
authored
Mar 13, 2011
by
Dean Camera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the internal serial extraction routines for each architecture.
parent
a7eca429
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
23 deletions
+24
-23
LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
+9
-9
LUFA/Drivers/USB/Core/DeviceStandardReq.c
LUFA/Drivers/USB/Core/DeviceStandardReq.c
+4
-3
LUFA/Drivers/USB/Core/UC3/Device_UC3.h
LUFA/Drivers/USB/Core/UC3/Device_UC3.h
+11
-11
No files found.
LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
View file @
02dfd7dc
...
@@ -100,8 +100,15 @@
...
@@ -100,8 +100,15 @@
* number for the device.
* number for the device.
*/
*/
#define USE_INTERNAL_SERIAL 0xDC
#define USE_INTERNAL_SERIAL 0xDC
/** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller
* model.
*/
#define INTERNAL_SERIAL_LENGTH_BITS 80
#else
#else
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR
#define INTERNAL_SERIAL_LENGTH_BITS 0
#endif
#endif
/* Function Prototypes: */
/* Function Prototypes: */
...
@@ -190,19 +197,14 @@
...
@@ -190,19 +197,14 @@
return
(
UDADDR
&
(
1
<<
ADDEN
));
return
(
UDADDR
&
(
1
<<
ADDEN
));
}
}
static
inline
uint8_t
USB_Device_GetSerialString
(
uint16_t
*
UnicodeString
,
const
uint8_t
MaxLen
)
static
inline
void
USB_Device_GetSerialString
(
uint16_t
*
UnicodeString
)
{
{
uint8_t
SerialCharNum
=
0
;
ATOMIC_BLOCK
(
ATOMIC_RESTORESTATE
)
ATOMIC_BLOCK
(
ATOMIC_RESTORESTATE
)
{
{
uint8_t
SigReadAddress
=
0x0E
;
uint8_t
SigReadAddress
=
0x0E
;
for
(
SerialCharNum
=
0
;
SerialCharNum
<
MIN
(
MaxLen
,
20
);
SerialCharNum
++
)
for
(
uint8_t
SerialCharNum
=
0
;
SerialCharNum
<
(
INTERNAL_SERIAL_LENGTH_BYTES
*
2
);
SerialCharNum
++
)
{
{
if
(
SerialCharNum
==
MaxLen
)
break
;
uint8_t
SerialByte
=
boot_signature_byte_get
(
SigReadAddress
);
uint8_t
SerialByte
=
boot_signature_byte_get
(
SigReadAddress
);
if
(
SerialCharNum
&
0x01
)
if
(
SerialCharNum
&
0x01
)
...
@@ -217,8 +219,6 @@
...
@@ -217,8 +219,6 @@
((
'A'
-
10
)
+
SerialByte
)
:
(
'0'
+
SerialByte
));
((
'A'
-
10
)
+
SerialByte
)
:
(
'0'
+
SerialByte
));
}
}
}
}
return
SerialCharNum
;
}
}
#endif
#endif
...
...
LUFA/Drivers/USB/Core/DeviceStandardReq.c
View file @
02dfd7dc
...
@@ -204,12 +204,13 @@ static void USB_Device_GetInternalSerialDescriptor(void)
...
@@ -204,12 +204,13 @@ static void USB_Device_GetInternalSerialDescriptor(void)
struct
struct
{
{
USB_Descriptor_Header_t
Header
;
USB_Descriptor_Header_t
Header
;
uint16_t
UnicodeString
[
20
];
uint16_t
UnicodeString
[
INTERNAL_SERIAL_LENGTH_BITS
/
4
];
}
SignatureDescriptor
;
}
SignatureDescriptor
;
SignatureDescriptor
.
Header
.
Type
=
DTYPE_String
;
SignatureDescriptor
.
Header
.
Type
=
DTYPE_String
;
SignatureDescriptor
.
Header
.
Size
=
USB_STRING_LEN
(
USB_Device_GetSerialString
(
SignatureDescriptor
.
UnicodeString
,
SignatureDescriptor
.
Header
.
Size
=
USB_STRING_LEN
(
INTERNAL_SERIAL_LENGTH_BITS
/
4
);
sizeof
(
SignatureDescriptor
.
UnicodeString
)
/
sizeof
(
SignatureDescriptor
.
UnicodeString
[
0
])));
USB_Device_GetSerialString
(
SignatureDescriptor
.
UnicodeString
);
Endpoint_ClearSETUP
();
Endpoint_ClearSETUP
();
...
...
LUFA/Drivers/USB/Core/UC3/Device_UC3.h
View file @
02dfd7dc
...
@@ -90,9 +90,16 @@
...
@@ -90,9 +90,16 @@
* number for the device.
* number for the device.
*/
*/
#define USE_INTERNAL_SERIAL 0xDC
#define USE_INTERNAL_SERIAL 0xDC
/** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller
* model.
*/
#define INTERNAL_SERIAL_LENGTH_BITS 120
#else
#else
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR
#endif
#define INTERNAL_SERIAL_LENGTH_BITS 0
#endif
/* Function Prototypes: */
/* Function Prototypes: */
/** Sends a Remote Wakeup request to the host. This signals to the host that the device should
/** Sends a Remote Wakeup request to the host. This signals to the host that the device should
...
@@ -178,19 +185,14 @@
...
@@ -178,19 +185,14 @@
return
AVR32_USBB
.
UDCON
.
adden
;
return
AVR32_USBB
.
UDCON
.
adden
;
}
}
static
inline
uint8_t
USB_Device_GetSerialString
(
uint16_t
*
UnicodeString
,
const
uint8_t
MaxLen
)
static
inline
void
USB_Device_GetSerialString
(
uint16_t
*
UnicodeString
)
{
{
uint8_t
SerialCharNum
=
0
;
ATOMIC_BLOCK
(
ATOMIC_RESTORESTATE
)
ATOMIC_BLOCK
(
ATOMIC_RESTORESTATE
)
{
{
uint
32_t
*
SigReadAddress
=
0x80800204
;
uint
8_t
*
SigReadAddress
=
(
uint8_t
*
)
0x80800204
;
for
(
SerialCharNum
=
0
;
SerialCharNum
<
MIN
(
MaxLen
,
30
);
SerialCharNum
++
)
for
(
uint8_t
SerialCharNum
=
0
;
SerialCharNum
<
(
INTERNAL_SERIAL_LENGTH_BITS
/
4
);
SerialCharNum
++
)
{
{
if
(
SerialCharNum
==
MaxLen
)
break
;
uint8_t
SerialByte
=
*
SigReadAddress
;
uint8_t
SerialByte
=
*
SigReadAddress
;
if
(
SerialCharNum
&
0x01
)
if
(
SerialCharNum
&
0x01
)
...
@@ -205,8 +207,6 @@
...
@@ -205,8 +207,6 @@
((
'A'
-
10
)
+
SerialByte
)
:
(
'0'
+
SerialByte
));
((
'A'
-
10
)
+
SerialByte
)
:
(
'0'
+
SerialByte
));
}
}
}
}
return
SerialCharNum
;
}
}
#endif
#endif
...
...
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