Dean Camera ea922c98d1 Added new incomplete AudioInputHost Host LowLevel demo.
Added missing Audio class control request definitions.

Added support for the Audio class GET STATUS request so that it is correctly ACKed when sent by the host.
2011-05-29 12:41:14 +00:00

5025 lines
187 KiB
Plaintext

AudioInputHost.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 0000001c 00800100 000018fa 0000198e 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 000018fa 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000024 0080011c 0080011c 000019aa 2**0
ALLOC
3 .stab 00000e28 00000000 00000000 000019ac 2**2
CONTENTS, READONLY, DEBUGGING
4 .stabstr 0000026b 00000000 00000000 000027d4 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_aranges 000003b0 00000000 00000000 00002a3f 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_pubnames 0000089a 00000000 00000000 00002def 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_info 000056c7 00000000 00000000 00003689 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_abbrev 00001b65 00000000 00000000 00008d50 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_line 000053bf 00000000 00000000 0000a8b5 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_frame 00000540 00000000 00000000 0000fc74 2**2
CONTENTS, READONLY, DEBUGGING
11 .debug_str 000026bf 00000000 00000000 000101b4 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_loc 00003422 00000000 00000000 00012873 2**0
CONTENTS, READONLY, DEBUGGING
13 .debug_pubtypes 00000a86 00000000 00000000 00015c95 2**0
CONTENTS, READONLY, DEBUGGING
14 .debug_ranges 00000490 00000000 00000000 0001671b 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 51 c1 rjmp .+674 ; 0x2a4 <__ctors_end>
2: 00 00 nop
4: 6d c1 rjmp .+730 ; 0x2e0 <__bad_interrupt>
6: 00 00 nop
8: 6b c1 rjmp .+726 ; 0x2e0 <__bad_interrupt>
a: 00 00 nop
c: 69 c1 rjmp .+722 ; 0x2e0 <__bad_interrupt>
e: 00 00 nop
10: 67 c1 rjmp .+718 ; 0x2e0 <__bad_interrupt>
12: 00 00 nop
14: 65 c1 rjmp .+714 ; 0x2e0 <__bad_interrupt>
16: 00 00 nop
18: 63 c1 rjmp .+710 ; 0x2e0 <__bad_interrupt>
1a: 00 00 nop
1c: 61 c1 rjmp .+706 ; 0x2e0 <__bad_interrupt>
1e: 00 00 nop
20: 5f c1 rjmp .+702 ; 0x2e0 <__bad_interrupt>
22: 00 00 nop
24: 5d c1 rjmp .+698 ; 0x2e0 <__bad_interrupt>
26: 00 00 nop
28: d5 c6 rjmp .+3498 ; 0xdd4 <__vector_10>
2a: 00 00 nop
2c: 59 c1 rjmp .+690 ; 0x2e0 <__bad_interrupt>
2e: 00 00 nop
30: 57 c1 rjmp .+686 ; 0x2e0 <__bad_interrupt>
32: 00 00 nop
34: 55 c1 rjmp .+682 ; 0x2e0 <__bad_interrupt>
36: 00 00 nop
38: 53 c1 rjmp .+678 ; 0x2e0 <__bad_interrupt>
3a: 00 00 nop
3c: 51 c1 rjmp .+674 ; 0x2e0 <__bad_interrupt>
3e: 00 00 nop
40: 4f c1 rjmp .+670 ; 0x2e0 <__bad_interrupt>
42: 00 00 nop
44: 4d c1 rjmp .+666 ; 0x2e0 <__bad_interrupt>
46: 00 00 nop
48: 4b c1 rjmp .+662 ; 0x2e0 <__bad_interrupt>
4a: 00 00 nop
4c: 49 c1 rjmp .+658 ; 0x2e0 <__bad_interrupt>
4e: 00 00 nop
50: 47 c1 rjmp .+654 ; 0x2e0 <__bad_interrupt>
52: 00 00 nop
54: 8b c2 rjmp .+1302 ; 0x56c <__vector_21>
56: 00 00 nop
58: 43 c1 rjmp .+646 ; 0x2e0 <__bad_interrupt>
5a: 00 00 nop
5c: 41 c1 rjmp .+642 ; 0x2e0 <__bad_interrupt>
5e: 00 00 nop
60: 3f c1 rjmp .+638 ; 0x2e0 <__bad_interrupt>
62: 00 00 nop
64: 3d c1 rjmp .+634 ; 0x2e0 <__bad_interrupt>
66: 00 00 nop
68: 3b c1 rjmp .+630 ; 0x2e0 <__bad_interrupt>
6a: 00 00 nop
6c: 39 c1 rjmp .+626 ; 0x2e0 <__bad_interrupt>
6e: 00 00 nop
70: 37 c1 rjmp .+622 ; 0x2e0 <__bad_interrupt>
72: 00 00 nop
74: 35 c1 rjmp .+618 ; 0x2e0 <__bad_interrupt>
76: 00 00 nop
78: 33 c1 rjmp .+614 ; 0x2e0 <__bad_interrupt>
7a: 00 00 nop
7c: 31 c1 rjmp .+610 ; 0x2e0 <__bad_interrupt>
7e: 00 00 nop
80: 2f c1 rjmp .+606 ; 0x2e0 <__bad_interrupt>
82: 00 00 nop
84: 2d c1 rjmp .+602 ; 0x2e0 <__bad_interrupt>
86: 00 00 nop
88: 2b c1 rjmp .+598 ; 0x2e0 <__bad_interrupt>
8a: 00 00 nop
8c: 29 c1 rjmp .+594 ; 0x2e0 <__bad_interrupt>
8e: 00 00 nop
90: 27 c1 rjmp .+590 ; 0x2e0 <__bad_interrupt>
92: 00 00 nop
94: 25 c1 rjmp .+586 ; 0x2e0 <__bad_interrupt>
96: 00 00 nop
00000098 <__c.3939>:
98: 4d 69 63 72 6f 70 68 6f 6e 65 20 45 6e 75 6d 65 Microphone Enume
a8: 72 61 74 65 64 2e 0d 0a 00 rated....
000000b1 <__c.3935>:
b1: 1b 5b 33 31 6d 43 6f 75 6c 64 20 6e 6f 74 20 73 .[31mCould not s
c1: 65 74 20 61 6c 74 65 72 6e 61 74 69 76 65 20 73 et alternative s
d1: 74 72 65 61 6d 69 6e 67 20 69 6e 74 65 72 66 61 treaming interfa
e1: 63 65 20 73 65 74 74 69 6e 67 2e 0d 0a 20 2d 2d ce setting... --
f1: 20 45 72 72 6f 72 20 43 6f 64 65 3a 20 25 64 0d Error Code: %d.
101: 0a 1b 5b 33 37 6d 00 ..[37m.
00000108 <__c.3933>:
108: 1b 5b 33 31 6d 43 6f 6e 74 72 6f 6c 20 45 72 72 .[31mControl Err
118: 6f 72 20 28 53 65 74 20 43 6f 6e 66 69 67 75 72 or (Set Configur
128: 61 74 69 6f 6e 29 2e 0d 0a 20 2d 2d 20 45 72 72 ation)... -- Err
138: 6f 72 20 43 6f 64 65 3a 20 25 64 0d 0a 1b 5b 33 or Code: %d...[3
148: 37 6d 00 7m.
0000014b <__c.3930>:
14b: 20 2d 2d 20 45 72 72 6f 72 20 43 6f 64 65 3a 20 -- Error Code:
15b: 25 64 0d 0a 1b 5b 33 37 6d 00 %d...[37m.
00000165 <__c.3928>:
165: 1b 5b 33 31 6d 49 6e 76 61 6c 69 64 20 44 65 76 .[31mInvalid Dev
175: 69 63 65 2e 0d 0a 00 ice....
0000017c <__c.3926>:
17c: 1b 5b 33 31 6d 43 6f 6e 74 72 6f 6c 20 45 72 72 .[31mControl Err
18c: 6f 72 20 28 47 65 74 20 43 6f 6e 66 69 67 75 72 or (Get Configur
19c: 61 74 69 6f 6e 29 2e 0d 0a 00 ation)....
000001a6 <__c.3924>:
1a6: 47 65 74 74 69 6e 67 20 43 6f 6e 66 69 67 20 44 Getting Config D
1b6: 61 74 61 2e 0d 0a 00 ata....
000001bd <__c.3917>:
1bd: 1b 5b 33 31 6d 44 65 76 20 45 6e 75 6d 20 45 72 .[31mDev Enum Er
1cd: 72 6f 72 0d 0a 20 2d 2d 20 45 72 72 6f 72 20 43 ror.. -- Error C
1dd: 6f 64 65 20 25 64 0d 0a 20 2d 2d 20 53 75 62 20 ode %d.. -- Sub
1ed: 45 72 72 6f 72 20 43 6f 64 65 20 25 64 0d 0a 20 Error Code %d..
1fd: 2d 2d 20 49 6e 20 53 74 61 74 65 20 25 64 0d 0a -- In State %d..
20d: 1b 5b 33 37 6d 00 .[37m.
00000213 <__c.3910>:
213: 1b 5b 33 31 6d 48 6f 73 74 20 4d 6f 64 65 20 45 .[31mHost Mode E
223: 72 72 6f 72 0d 0a 20 2d 2d 20 45 72 72 6f 72 20 rror.. -- Error
233: 43 6f 64 65 20 25 64 0d 0a 1b 5b 33 37 6d 00 Code %d...[37m.
00000242 <__c.3902>:
242: 1b 5b 33 32 6d 44 65 76 69 63 65 20 55 6e 61 74 .[32mDevice Unat
252: 74 61 63 68 65 64 2e 0d 0a 1b 5b 33 37 6d 00 tached....[37m.
00000261 <__c.3897>:
261: 1b 5b 33 32 6d 44 65 76 69 63 65 20 41 74 74 61 .[32mDevice Atta
271: 63 68 65 64 2e 0d 0a 1b 5b 33 37 6d 00 ched....[37m.
0000027e <__c.3888>:
27e: 1b 5b 33 36 6d 41 75 64 69 6f 20 48 6f 73 74 20 .[36mAudio Host
28e: 44 65 6d 6f 20 72 75 6e 6e 69 6e 67 2e 0d 0a 1b Demo running....
29e: 5b 33 37 6d 00 00 [37m..
000002a4 <__ctors_end>:
2a4: 11 24 eor r1, r1
2a6: 1f be out 0x3f, r1 ; 63
2a8: cf ef ldi r28, 0xFF ; 255
2aa: d0 e2 ldi r29, 0x20 ; 32
2ac: de bf out 0x3e, r29 ; 62
2ae: cd bf out 0x3d, r28 ; 61
000002b0 <__do_copy_data>:
2b0: 11 e0 ldi r17, 0x01 ; 1
2b2: a0 e0 ldi r26, 0x00 ; 0
2b4: b1 e0 ldi r27, 0x01 ; 1
2b6: ea ef ldi r30, 0xFA ; 250
2b8: f8 e1 ldi r31, 0x18 ; 24
2ba: 00 e0 ldi r16, 0x00 ; 0
2bc: 0b bf out 0x3b, r16 ; 59
2be: 02 c0 rjmp .+4 ; 0x2c4 <__do_copy_data+0x14>
2c0: 07 90 elpm r0, Z+
2c2: 0d 92 st X+, r0
2c4: ac 31 cpi r26, 0x1C ; 28
2c6: b1 07 cpc r27, r17
2c8: d9 f7 brne .-10 ; 0x2c0 <__do_copy_data+0x10>
000002ca <__do_clear_bss>:
2ca: 11 e0 ldi r17, 0x01 ; 1
2cc: ac e1 ldi r26, 0x1C ; 28
2ce: b1 e0 ldi r27, 0x01 ; 1
2d0: 01 c0 rjmp .+2 ; 0x2d4 <.do_clear_bss_start>
000002d2 <.do_clear_bss_loop>:
2d2: 1d 92 st X+, r1
000002d4 <.do_clear_bss_start>:
2d4: a0 34 cpi r26, 0x40 ; 64
2d6: b1 07 cpc r27, r17
2d8: e1 f7 brne .-8 ; 0x2d2 <.do_clear_bss_loop>
2da: 3e d1 rcall .+636 ; 0x558 <main>
2dc: 0c 94 7b 0c jmp 0x18f6 ; 0x18f6 <_exit>
000002e0 <__bad_interrupt>:
2e0: 8f ce rjmp .-738 ; 0x0 <__vectors>
000002e2 <LEDs_SetAllLEDs>:
PORTD &= ~LEDMask;
}
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
{
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
2e2: 9b b1 in r25, 0x0b ; 11
2e4: 9f 70 andi r25, 0x0F ; 15
2e6: 98 2b or r25, r24
2e8: 9b b9 out 0x0b, r25 ; 11
}
2ea: 08 95 ret
000002ec <SetupHardware>:
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
2ec: 84 b7 in r24, 0x34 ; 52
2ee: 87 7f andi r24, 0xF7 ; 247
2f0: 84 bf out 0x34, r24 ; 52
wdt_disable();
2f2: 28 e1 ldi r18, 0x18 ; 24
2f4: 0f b6 in r0, 0x3f ; 63
2f6: f8 94 cli
2f8: 20 93 60 00 sts 0x0060, r18
2fc: 10 92 60 00 sts 0x0060, r1
300: 0f be out 0x3f, r0 ; 63
The type of x is clock_div_t.
*/
void clock_prescale_set(clock_div_t __x)
{
uint8_t __tmp = _BV(CLKPCE);
__asm__ __volatile__ (
302: 90 e0 ldi r25, 0x00 ; 0
304: 80 e8 ldi r24, 0x80 ; 128
306: 0f b6 in r0, 0x3f ; 63
308: f8 94 cli
30a: 80 93 61 00 sts 0x0061, r24
30e: 90 93 61 00 sts 0x0061, r25
312: 0f be out 0x3f, r0 ; 63
* \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate.
*/
static inline void Serial_Init(const uint32_t BaudRate,
const bool DoubleSpeed)
{
UBRR1 = (DoubleSpeed ? SERIAL_2X_UBBRVAL(BaudRate) : SERIAL_UBBRVAL(BaudRate));
314: 83 e3 ldi r24, 0x33 ; 51
316: 90 e0 ldi r25, 0x00 ; 0
318: 90 93 cd 00 sts 0x00CD, r25
31c: 80 93 cc 00 sts 0x00CC, r24
UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10));
320: 86 e0 ldi r24, 0x06 ; 6
322: 80 93 ca 00 sts 0x00CA, r24
UCSR1A = (DoubleSpeed ? (1 << U2X1) : 0);
326: 10 92 c8 00 sts 0x00C8, r1
UCSR1B = ((1 << TXEN1) | (1 << RXEN1));
32a: 20 93 c9 00 sts 0x00C9, r18
DDRD |= (1 << 3);
32e: 53 9a sbi 0x0a, 3 ; 10
PORTD |= (1 << 2);
330: 5a 9a sbi 0x0b, 2 ; 11
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
{
DDRD |= LEDS_ALL_LEDS;
332: 8a b1 in r24, 0x0a ; 10
334: 80 6f ori r24, 0xF0 ; 240
336: 8a b9 out 0x0a, r24 ; 10
PORTD &= ~LEDS_ALL_LEDS;
338: 8b b1 in r24, 0x0b ; 11
33a: 8f 70 andi r24, 0x0F ; 15
33c: 8b b9 out 0x0b, r24 ; 11
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Serial_Init(9600, false);
LEDs_Init();
USB_Init();
33e: 34 d5 rcall .+2664 ; 0xda8 <USB_Init>
static inline void Serial_CreateStream(FILE* Stream)
{
if (!(Stream))
{
Stream = &USARTSerialStream;
stdin = Stream;
340: ec e2 ldi r30, 0x2C ; 44
342: f1 e0 ldi r31, 0x01 ; 1
344: f0 93 3b 01 sts 0x013B, r31
348: e0 93 3a 01 sts 0x013A, r30
stdout = Stream;
34c: f0 93 3d 01 sts 0x013D, r31
350: e0 93 3c 01 sts 0x013C, r30
}
*Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW);
354: 8e e0 ldi r24, 0x0E ; 14
356: df 01 movw r26, r30
358: 1d 92 st X+, r1
35a: 8a 95 dec r24
35c: e9 f7 brne .-6 ; 0x358 <SetupHardware+0x6c>
35e: 83 e0 ldi r24, 0x03 ; 3
360: 80 93 2f 01 sts 0x012F, r24
364: 85 e6 ldi r24, 0x65 ; 101
366: 99 e0 ldi r25, 0x09 ; 9
368: 90 93 35 01 sts 0x0135, r25
36c: 80 93 34 01 sts 0x0134, r24
370: 8e e6 ldi r24, 0x6E ; 110
372: 99 e0 ldi r25, 0x09 ; 9
374: 90 93 37 01 sts 0x0137, r25
378: 80 93 36 01 sts 0x0136, r24
/* Create a stdio stream for the serial port for stdin and stdout */
Serial_CreateStream(NULL);
}
37c: 08 95 ret
0000037e <EVENT_USB_Host_DeviceAttached>:
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
void EVENT_USB_Host_DeviceAttached(void)
{
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
37e: 81 e6 ldi r24, 0x61 ; 97
380: 92 e0 ldi r25, 0x02 ; 2
382: de d7 rcall .+4028 ; 0x1340 <puts_P>
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
384: 80 ea ldi r24, 0xA0 ; 160
}
386: ad cf rjmp .-166 ; 0x2e2 <LEDs_SetAllLEDs>
00000388 <EVENT_USB_Host_DeviceUnattached>:
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
void EVENT_USB_Host_DeviceUnattached(void)
{
puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE));
388: 82 e4 ldi r24, 0x42 ; 66
38a: 92 e0 ldi r25, 0x02 ; 2
38c: d9 d7 rcall .+4018 ; 0x1340 <puts_P>
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
38e: 80 e1 ldi r24, 0x10 ; 16
}
390: a8 cf rjmp .-176 ; 0x2e2 <LEDs_SetAllLEDs>
00000392 <EVENT_USB_Host_DeviceEnumerationComplete>:
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
void EVENT_USB_Host_DeviceEnumerationComplete(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
392: 80 e6 ldi r24, 0x60 ; 96
}
394: a6 cf rjmp .-180 ; 0x2e2 <LEDs_SetAllLEDs>
00000396 <EVENT_USB_Host_HostError>:
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{
396: df 93 push r29
398: cf 93 push r28
39a: 0f 92 push r0
39c: cd b7 in r28, 0x3d ; 61
39e: de b7 in r29, 0x3e ; 62
USB_Disable();
3a0: 89 83 std Y+1, r24 ; 0x01
3a2: 9c d4 rcall .+2360 ; 0xcdc <USB_Disable>
printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
3a4: 00 d0 rcall .+0 ; 0x3a6 <EVENT_USB_Host_HostError+0x10>
3a6: 00 d0 rcall .+0 ; 0x3a8 <EVENT_USB_Host_HostError+0x12>
3a8: ed b7 in r30, 0x3d ; 61
3aa: fe b7 in r31, 0x3e ; 62
3ac: 31 96 adiw r30, 0x01 ; 1
3ae: 23 e1 ldi r18, 0x13 ; 19
3b0: 32 e0 ldi r19, 0x02 ; 2
3b2: ad b7 in r26, 0x3d ; 61
3b4: be b7 in r27, 0x3e ; 62
3b6: 12 96 adiw r26, 0x02 ; 2
3b8: 3c 93 st X, r19
3ba: 2e 93 st -X, r18
3bc: 11 97 sbiw r26, 0x01 ; 1
3be: 89 81 ldd r24, Y+1 ; 0x01
3c0: 82 83 std Z+2, r24 ; 0x02
3c2: 13 82 std Z+3, r1 ; 0x03
3c4: 9e d7 rcall .+3900 ; 0x1302 <printf_P>
" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
3c6: 0f 90 pop r0
3c8: 0f 90 pop r0
3ca: 0f 90 pop r0
3cc: 0f 90 pop r0
3ce: 80 e9 ldi r24, 0x90 ; 144
3d0: 88 df rcall .-240 ; 0x2e2 <LEDs_SetAllLEDs>
3d2: ff cf rjmp .-2 ; 0x3d2 <EVENT_USB_Host_HostError+0x3c>
000003d4 <EVENT_USB_Host_DeviceEnumerationFailed>:
* enumerating an attached USB device.
*/
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode)
{
printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"
3d4: 90 91 2b 01 lds r25, 0x012B
3d8: 2d b7 in r18, 0x3d ; 61
3da: 3e b7 in r19, 0x3e ; 62
3dc: 28 50 subi r18, 0x08 ; 8
3de: 30 40 sbci r19, 0x00 ; 0
3e0: 0f b6 in r0, 0x3f ; 63
3e2: f8 94 cli
3e4: 3e bf out 0x3e, r19 ; 62
3e6: 0f be out 0x3f, r0 ; 63
3e8: 2d bf out 0x3d, r18 ; 61
3ea: ed b7 in r30, 0x3d ; 61
3ec: fe b7 in r31, 0x3e ; 62
3ee: 31 96 adiw r30, 0x01 ; 1
3f0: 2d eb ldi r18, 0xBD ; 189
3f2: 31 e0 ldi r19, 0x01 ; 1
3f4: ad b7 in r26, 0x3d ; 61
3f6: be b7 in r27, 0x3e ; 62
3f8: 12 96 adiw r26, 0x02 ; 2
3fa: 3c 93 st X, r19
3fc: 2e 93 st -X, r18
3fe: 11 97 sbiw r26, 0x01 ; 1
400: 82 83 std Z+2, r24 ; 0x02
402: 13 82 std Z+3, r1 ; 0x03
404: 64 83 std Z+4, r22 ; 0x04
406: 15 82 std Z+5, r1 ; 0x05
408: 96 83 std Z+6, r25 ; 0x06
40a: 17 82 std Z+7, r1 ; 0x07
40c: 7a d7 rcall .+3828 ; 0x1302 <printf_P>
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
40e: 2d b7 in r18, 0x3d ; 61
410: 3e b7 in r19, 0x3e ; 62
412: 28 5f subi r18, 0xF8 ; 248
414: 3f 4f sbci r19, 0xFF ; 255
416: 0f b6 in r0, 0x3f ; 63
418: f8 94 cli
41a: 3e bf out 0x3e, r19 ; 62
41c: 0f be out 0x3f, r0 ; 63
41e: 2d bf out 0x3d, r18 ; 61
420: 80 e9 ldi r24, 0x90 ; 144
}
422: 5f cf rjmp .-322 ; 0x2e2 <LEDs_SetAllLEDs>
00000424 <Audio_Task>:
void Audio_Task(void)
{
424: 1f 93 push r17
426: df 93 push r29
428: cf 93 push r28
42a: 00 d0 rcall .+0 ; 0x42c <Audio_Task+0x8>
42c: 0f 92 push r0
42e: cd b7 in r28, 0x3d ; 61
430: de b7 in r29, 0x3e ; 62
uint8_t ErrorCode;
switch (USB_HostState)
432: 80 91 2b 01 lds r24, 0x012B
436: 8b 30 cpi r24, 0x0B ; 11
438: 09 f0 breq .+2 ; 0x43c <Audio_Task+0x18>
43a: 87 c0 rjmp .+270 ; 0x54a <Audio_Task+0x126>
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
43c: 86 ea ldi r24, 0xA6 ; 166
43e: 91 e0 ldi r25, 0x01 ; 1
440: 7f d7 rcall .+3838 ; 0x1340 <puts_P>
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
442: 30 d1 rcall .+608 ; 0x6a4 <ProcessConfigurationDescriptor>
444: 18 2f mov r17, r24
446: 88 23 and r24, r24
448: e9 f0 breq .+58 ; 0x484 <Audio_Task+0x60>
{
if (ErrorCode == ControlError)
44a: 81 30 cpi r24, 0x01 ; 1
44c: 19 f4 brne .+6 ; 0x454 <Audio_Task+0x30>
puts_P(PSTR(ESC_FG_RED "Control Error (Get Configuration).\r\n"));
44e: 8c e7 ldi r24, 0x7C ; 124
450: 91 e0 ldi r25, 0x01 ; 1
452: 02 c0 rjmp .+4 ; 0x458 <Audio_Task+0x34>
else
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
454: 85 e6 ldi r24, 0x65 ; 101
456: 91 e0 ldi r25, 0x01 ; 1
458: 73 d7 rcall .+3814 ; 0x1340 <puts_P>
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
45a: 00 d0 rcall .+0 ; 0x45c <Audio_Task+0x38>
45c: 00 d0 rcall .+0 ; 0x45e <Audio_Task+0x3a>
45e: ed b7 in r30, 0x3d ; 61
460: fe b7 in r31, 0x3e ; 62
462: 31 96 adiw r30, 0x01 ; 1
464: 2b e4 ldi r18, 0x4B ; 75
466: 31 e0 ldi r19, 0x01 ; 1
468: ad b7 in r26, 0x3d ; 61
46a: be b7 in r27, 0x3e ; 62
46c: 12 96 adiw r26, 0x02 ; 2
46e: 3c 93 st X, r19
470: 2e 93 st -X, r18
472: 11 97 sbiw r26, 0x01 ; 1
474: 12 83 std Z+2, r17 ; 0x02
476: 13 82 std Z+3, r1 ; 0x03
478: 44 d7 rcall .+3720 ; 0x1302 <printf_P>
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
47a: 0f 90 pop r0
47c: 0f 90 pop r0
47e: 0f 90 pop r0
480: 0f 90 pop r0
482: 4a c0 rjmp .+148 ; 0x518 <Audio_Task+0xf4>
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
484: 81 e0 ldi r24, 0x01 ; 1
486: 82 d3 rcall .+1796 ; 0xb8c <USB_Host_SetDeviceConfiguration>
488: 88 23 and r24, r24
48a: 41 f0 breq .+16 ; 0x49c <Audio_Task+0x78>
{
printf_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"
48c: 00 d0 rcall .+0 ; 0x48e <Audio_Task+0x6a>
48e: 00 d0 rcall .+0 ; 0x490 <Audio_Task+0x6c>
490: ed b7 in r30, 0x3d ; 61
492: fe b7 in r31, 0x3e ; 62
494: 31 96 adiw r30, 0x01 ; 1
496: 28 e0 ldi r18, 0x08 ; 8
498: 31 e0 ldi r19, 0x01 ; 1
49a: 0e c0 rjmp .+28 ; 0x4b8 <Audio_Task+0x94>
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
if ((ErrorCode = USB_Host_SetInterfaceAltSetting(StreamingInterfaceIndex,
49c: 80 91 1c 01 lds r24, 0x011C
4a0: 60 91 1d 01 lds r22, 0x011D
4a4: 89 d3 rcall .+1810 ; 0xbb8 <USB_Host_SetInterfaceAltSetting>
4a6: 88 23 and r24, r24
4a8: 79 f0 breq .+30 ; 0x4c8 <Audio_Task+0xa4>
StreamingInterfaceAltSetting)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Could not set alternative streaming interface setting.\r\n"
4aa: 00 d0 rcall .+0 ; 0x4ac <Audio_Task+0x88>
4ac: 00 d0 rcall .+0 ; 0x4ae <Audio_Task+0x8a>
4ae: ed b7 in r30, 0x3d ; 61
4b0: fe b7 in r31, 0x3e ; 62
4b2: 31 96 adiw r30, 0x01 ; 1
4b4: 21 eb ldi r18, 0xB1 ; 177
4b6: 30 e0 ldi r19, 0x00 ; 0
4b8: ad b7 in r26, 0x3d ; 61
4ba: be b7 in r27, 0x3e ; 62
4bc: 12 96 adiw r26, 0x02 ; 2
4be: 3c 93 st X, r19
4c0: 2e 93 st -X, r18
4c2: 11 97 sbiw r26, 0x01 ; 1
4c4: 82 83 std Z+2, r24 ; 0x02
4c6: d7 cf rjmp .-82 ; 0x476 <Audio_Task+0x52>
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
USB_ControlRequest = (USB_Request_Header_t)
4c8: 20 91 1e 01 lds r18, 0x011E
4cc: 82 e2 ldi r24, 0x22 ; 34
4ce: 80 93 23 01 sts 0x0123, r24
4d2: 81 e0 ldi r24, 0x01 ; 1
4d4: 80 93 24 01 sts 0x0124, r24
4d8: 80 e0 ldi r24, 0x00 ; 0
4da: 91 e0 ldi r25, 0x01 ; 1
4dc: 90 93 26 01 sts 0x0126, r25
4e0: 80 93 25 01 sts 0x0125, r24
4e4: 20 93 27 01 sts 0x0127, r18
4e8: 10 92 28 01 sts 0x0128, r1
4ec: 83 e0 ldi r24, 0x03 ; 3
4ee: 90 e0 ldi r25, 0x00 ; 0
4f0: 90 93 2a 01 sts 0x012A, r25
4f4: 80 93 29 01 sts 0x0129, r24
.wValue = 0x0100,
.wIndex = StreamingEndpointAddress,
.wLength = sizeof(USB_Audio_SampleFreq_t),
};
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
4f8: de 01 movw r26, r28
4fa: 11 96 adiw r26, 0x01 ; 1
4fc: e0 e0 ldi r30, 0x00 ; 0
4fe: f1 e0 ldi r31, 0x01 ; 1
500: 83 e0 ldi r24, 0x03 ; 3
502: 01 90 ld r0, Z+
504: 0d 92 st X+, r0
506: 81 50 subi r24, 0x01 ; 1
508: e1 f7 brne .-8 ; 0x502 <Audio_Task+0xde>
* \param[in] PipeNumber Index of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
{
UPNUM = PipeNumber;
50a: 10 92 a7 00 sts 0x00A7, r1
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
/* Set the sample rate on the streaming interface endpoint */
if ((ErrorCode = USB_Host_SendControlRequest(&SampleRate)) != HOST_SENDCONTROL_Successful)
50e: ce 01 movw r24, r28
510: 01 96 adiw r24, 0x01 ; 1
512: b7 d5 rcall .+2926 ; 0x1082 <USB_Host_SendControlRequest>
514: 88 23 and r24, r24
516: 29 f0 breq .+10 ; 0x522 <Audio_Task+0xfe>
{
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
518: 80 e9 ldi r24, 0x90 ; 144
51a: e3 de rcall .-570 ; 0x2e2 <LEDs_SetAllLEDs>
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
51c: 10 92 2b 01 sts 0x012B, r1
break;
520: 14 c0 rjmp .+40 ; 0x54a <Audio_Task+0x126>
}
/* Sample reload timer initialization */
TIMSK0 = (1 << OCIE0A);
522: 82 e0 ldi r24, 0x02 ; 2
524: 80 93 6e 00 sts 0x006E, r24
OCR0A = ((F_CPU / 8 / 8000) - 1);
528: 9c e7 ldi r25, 0x7C ; 124
52a: 97 bd out 0x27, r25 ; 39
TCCR0A = (1 << WGM01); // CTC mode
52c: 84 bd out 0x24, r24 ; 36
TCCR0B = (1 << CS01); // Fcpu/8 speed
52e: 85 bd out 0x25, r24 ; 37
/* Set speaker as output */
DDRC |= (1 << 6);
530: 3e 9a sbi 0x07, 6 ; 7
/* PWM speaker timer initialization */
TCCR3A = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0)
532: 81 ef ldi r24, 0xF1 ; 241
534: 80 93 90 00 sts 0x0090, r24
| (1 << COM3B1) | (1 << COM3B0)); // Set on match, clear on TOP
TCCR3B = ((1 << WGM32) | (1 << CS30)); // Fast 8-Bit PWM, F_CPU speed
538: 89 e0 ldi r24, 0x09 ; 9
53a: 80 93 91 00 sts 0x0091, r24
puts_P(PSTR("Microphone Enumerated.\r\n"));
53e: 88 e9 ldi r24, 0x98 ; 152
540: 90 e0 ldi r25, 0x00 ; 0
542: fe d6 rcall .+3580 ; 0x1340 <puts_P>
USB_HostState = HOST_STATE_Configured;
544: 8c e0 ldi r24, 0x0C ; 12
546: 80 93 2b 01 sts 0x012B, r24
break;
case HOST_STATE_Configured:
break;
}
}
54a: 0f 90 pop r0
54c: 0f 90 pop r0
54e: 0f 90 pop r0
550: cf 91 pop r28
552: df 91 pop r29
554: 1f 91 pop r17
556: 08 95 ret
00000558 <main>:
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
int main(void)
{
SetupHardware();
558: c9 de rcall .-622 ; 0x2ec <SetupHardware>
puts_P(PSTR(ESC_FG_CYAN "Audio Host Demo running.\r\n" ESC_FG_WHITE));
55a: 8e e7 ldi r24, 0x7E ; 126
55c: 92 e0 ldi r25, 0x02 ; 2
55e: f0 d6 rcall .+3552 ; 0x1340 <puts_P>
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
560: 80 e1 ldi r24, 0x10 ; 16
562: bf de rcall .-642 ; 0x2e2 <LEDs_SetAllLEDs>
sei();
564: 78 94 sei
for (;;)
{
Audio_Task();
566: 5e df rcall .-324 ; 0x424 <Audio_Task>
USB_USBTask();
568: a2 d6 rcall .+3396 ; 0x12ae <USB_USBTask>
56a: fd cf rjmp .-6 ; 0x566 <main+0xe>
0000056c <__vector_21>:
}
}
/** ISR to handle the reloading of the PWM timer with the next sample. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
56c: 1f 92 push r1
56e: 0f 92 push r0
570: 0f b6 in r0, 0x3f ; 63
572: 0f 92 push r0
574: 0b b6 in r0, 0x3b ; 59
576: 0f 92 push r0
578: 11 24 eor r1, r1
57a: 1f 93 push r17
57c: 2f 93 push r18
57e: 3f 93 push r19
580: 4f 93 push r20
582: 5f 93 push r21
584: 6f 93 push r22
586: 7f 93 push r23
588: 8f 93 push r24
58a: 9f 93 push r25
58c: af 93 push r26
58e: bf 93 push r27
590: ef 93 push r30
592: ff 93 push r31
* \return Index of the currently selected pipe.
*/
static inline uint8_t Pipe_GetCurrentPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetCurrentPipe(void)
{
return (UPNUM & PIPE_PIPENUM_MASK);
594: 10 91 a7 00 lds r17, 0x00A7
598: 17 70 andi r17, 0x07 ; 7
* \param[in] PipeNumber Index of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
{
UPNUM = PipeNumber;
59a: 81 e0 ldi r24, 0x01 ; 1
59c: 80 93 a7 00 sts 0x00A7, r24
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Unfreeze(void)
{
UPCONX &= ~(1 << PFREEZE);
5a0: 80 91 a9 00 lds r24, 0x00A9
5a4: 8f 7b andi r24, 0xBF ; 191
5a6: 80 93 a9 00 sts 0x00A9, r24
* \return Boolean \c true if the current pipe has received an IN packet, \c false otherwise.
*/
static inline bool Pipe_IsINReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsINReceived(void)
{
return ((UPINTX & (1 << RXINI)) ? true : false);
5aa: 80 91 a6 00 lds r24, 0x00A6
Pipe_SelectPipe(AUDIO_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Check if the current pipe can be read from (contains a packet) and the device is sending data */
if (Pipe_IsINReceived())
5ae: 80 ff sbrs r24, 0
5b0: 2b c0 rjmp .+86 ; 0x608 <__vector_21+0x9c>
{
uint16_t Value;
uint8_t Bytes[2];
} Data;
Data.Bytes[0] = UPDATX;
5b2: 80 91 af 00 lds r24, 0x00AF
Data.Bytes[1] = UPDATX;
5b6: 40 91 af 00 lds r20, 0x00AF
* on its direction.
*/
static inline bool Pipe_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsReadWriteAllowed(void)
{
return ((UPINTX & (1 << RWAL)) ? true : false);
5ba: 80 91 a6 00 lds r24, 0x00A6
{
/* Retrieve the signed 16-bit audio sample, convert to 8-bit */
int8_t Sample_8Bit = (Pipe_Read_16_LE() >> 8);
/* Check to see if the bank is now empty */
if (!(Pipe_IsReadWriteAllowed()))
5be: 85 fd sbrc r24, 5
5c0: 05 c0 rjmp .+10 ; 0x5cc <__vector_21+0x60>
* \ingroup Group_PipePacketManagement_AVR8
*/
static inline void Pipe_ClearIN(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearIN(void)
{
UPINTX &= ~((1 << RXINI) | (1 << FIFOCON));
5c2: 80 91 a6 00 lds r24, 0x00A6
5c6: 8e 77 andi r24, 0x7E ; 126
5c8: 80 93 a6 00 sts 0x00A6, r24
/* Acknowledge the packet, clear the bank ready for the next packet */
Pipe_ClearIN();
}
/* Load the sample into the PWM timer channel */
OCR3A = (Sample_8Bit ^ (1 << 7));
5cc: 84 2f mov r24, r20
5ce: 99 27 eor r25, r25
5d0: 87 fd sbrc r24, 7
5d2: 90 95 com r25
5d4: 20 e8 ldi r18, 0x80 ; 128
5d6: 30 e0 ldi r19, 0x00 ; 0
5d8: 82 27 eor r24, r18
5da: 93 27 eor r25, r19
5dc: 90 93 99 00 sts 0x0099, r25
5e0: 80 93 98 00 sts 0x0098, r24
uint8_t LEDMask = LEDS_NO_LEDS;
/* Turn on LEDs as the sample amplitude increases */
if (Sample_8Bit > 16)
5e4: 41 31 cpi r20, 0x11 ; 17
5e6: 44 f4 brge .+16 ; 0x5f8 <__vector_21+0x8c>
LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4);
else if (Sample_8Bit > 8)
5e8: 49 30 cpi r20, 0x09 ; 9
5ea: 44 f4 brge .+16 ; 0x5fc <__vector_21+0x90>
LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3);
else if (Sample_8Bit > 4)
5ec: 45 30 cpi r20, 0x05 ; 5
5ee: 44 f4 brge .+16 ; 0x600 <__vector_21+0x94>
LEDMask = (LEDS_LED1 | LEDS_LED2);
else if (Sample_8Bit > 2)
5f0: 43 30 cpi r20, 0x03 ; 3
5f2: 44 f4 brge .+16 ; 0x604 <__vector_21+0x98>
}
/* Load the sample into the PWM timer channel */
OCR3A = (Sample_8Bit ^ (1 << 7));
uint8_t LEDMask = LEDS_NO_LEDS;
5f4: 80 e0 ldi r24, 0x00 ; 0
5f6: 07 c0 rjmp .+14 ; 0x606 <__vector_21+0x9a>
/* Turn on LEDs as the sample amplitude increases */
if (Sample_8Bit > 16)
LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4);
5f8: 80 ef ldi r24, 0xF0 ; 240
5fa: 05 c0 rjmp .+10 ; 0x606 <__vector_21+0x9a>
else if (Sample_8Bit > 8)
LEDMask = (LEDS_LED1 | LEDS_LED2 | LEDS_LED3);
5fc: 80 eb ldi r24, 0xB0 ; 176
5fe: 03 c0 rjmp .+6 ; 0x606 <__vector_21+0x9a>
else if (Sample_8Bit > 4)
LEDMask = (LEDS_LED1 | LEDS_LED2);
600: 80 e3 ldi r24, 0x30 ; 48
602: 01 c0 rjmp .+2 ; 0x606 <__vector_21+0x9a>
else if (Sample_8Bit > 2)
LEDMask = (LEDS_LED1);
604: 80 e1 ldi r24, 0x10 ; 16
LEDs_SetAllLEDs(LEDMask);
606: 6d de rcall .-806 ; 0x2e2 <LEDs_SetAllLEDs>
/** Freezes the selected pipe, preventing it from communicating with an attached device. */
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Freeze(void)
{
UPCONX |= (1 << PFREEZE);
608: 80 91 a9 00 lds r24, 0x00A9
60c: 80 64 ori r24, 0x40 ; 64
60e: 80 93 a9 00 sts 0x00A9, r24
* \param[in] PipeNumber Index of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
{
UPNUM = PipeNumber;
612: 10 93 a7 00 sts 0x00A7, r17
}
Pipe_Freeze();
Pipe_SelectPipe(PrevPipe);
}
616: ff 91 pop r31
618: ef 91 pop r30
61a: bf 91 pop r27
61c: af 91 pop r26
61e: 9f 91 pop r25
620: 8f 91 pop r24
622: 7f 91 pop r23
624: 6f 91 pop r22
626: 5f 91 pop r21
628: 4f 91 pop r20
62a: 3f 91 pop r19
62c: 2f 91 pop r18
62e: 1f 91 pop r17
630: 0f 90 pop r0
632: 0b be out 0x3b, r0 ; 59
634: 0f 90 pop r0
636: 0f be out 0x3f, r0 ; 63
638: 0f 90 pop r0
63a: 1f 90 pop r1
63c: 18 95 reti
0000063e <DComp_NextAudioControlInterface>:
/* Valid data found, return success */
return SuccessfulConfigRead;
}
uint8_t DComp_NextAudioControlInterface(void* CurrentDescriptor)
{
63e: fc 01 movw r30, r24
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Interface)
640: 81 81 ldd r24, Z+1 ; 0x01
642: 84 30 cpi r24, 0x04 ; 4
644: 49 f4 brne .+18 ; 0x658 <DComp_NextAudioControlInterface+0x1a>
{
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
if ((Interface->Class == AUDIO_CSCP_AudioClass) &&
646: 85 81 ldd r24, Z+5 ; 0x05
648: 81 30 cpi r24, 0x01 ; 1
64a: 31 f4 brne .+12 ; 0x658 <DComp_NextAudioControlInterface+0x1a>
64c: 86 81 ldd r24, Z+6 ; 0x06
64e: 81 30 cpi r24, 0x01 ; 1
650: 19 f4 brne .+6 ; 0x658 <DComp_NextAudioControlInterface+0x1a>
(Interface->SubClass == AUDIO_CSCP_ControlSubclass) &&
652: 87 81 ldd r24, Z+7 ; 0x07
654: 88 23 and r24, r24
656: 11 f0 breq .+4 ; 0x65c <DComp_NextAudioControlInterface+0x1e>
{
return DESCRIPTOR_SEARCH_Found;
}
}
return DESCRIPTOR_SEARCH_NotFound;
658: 82 e0 ldi r24, 0x02 ; 2
65a: 08 95 ret
if ((Interface->Class == AUDIO_CSCP_AudioClass) &&
(Interface->SubClass == AUDIO_CSCP_ControlSubclass) &&
(Interface->Protocol == AUDIO_CSCP_ControlProtocol))
{
return DESCRIPTOR_SEARCH_Found;
65c: 80 e0 ldi r24, 0x00 ; 0
}
}
return DESCRIPTOR_SEARCH_NotFound;
}
65e: 08 95 ret
00000660 <DComp_NextAudioStreamInterface>:
uint8_t DComp_NextAudioStreamInterface(void* CurrentDescriptor)
{
660: fc 01 movw r30, r24
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Interface)
662: 81 81 ldd r24, Z+1 ; 0x01
664: 84 30 cpi r24, 0x04 ; 4
666: 49 f4 brne .+18 ; 0x67a <DComp_NextAudioStreamInterface+0x1a>
{
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
if ((Interface->Class == AUDIO_CSCP_AudioClass) &&
668: 85 81 ldd r24, Z+5 ; 0x05
66a: 81 30 cpi r24, 0x01 ; 1
66c: 31 f4 brne .+12 ; 0x67a <DComp_NextAudioStreamInterface+0x1a>
66e: 86 81 ldd r24, Z+6 ; 0x06
670: 82 30 cpi r24, 0x02 ; 2
672: 19 f4 brne .+6 ; 0x67a <DComp_NextAudioStreamInterface+0x1a>
(Interface->SubClass == AUDIO_CSCP_AudioStreamingSubclass) &&
674: 87 81 ldd r24, Z+7 ; 0x07
676: 88 23 and r24, r24
678: 11 f0 breq .+4 ; 0x67e <DComp_NextAudioStreamInterface+0x1e>
{
return DESCRIPTOR_SEARCH_Found;
}
}
return DESCRIPTOR_SEARCH_NotFound;
67a: 82 e0 ldi r24, 0x02 ; 2
67c: 08 95 ret
if ((Interface->Class == AUDIO_CSCP_AudioClass) &&
(Interface->SubClass == AUDIO_CSCP_AudioStreamingSubclass) &&
(Interface->Protocol == AUDIO_CSCP_StreamingProtocol))
{
return DESCRIPTOR_SEARCH_Found;
67e: 80 e0 ldi r24, 0x00 ; 0
}
}
return DESCRIPTOR_SEARCH_NotFound;
}
680: 08 95 ret
00000682 <DComp_NextAudioInterfaceDataEndpoint>:
uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)
{
682: fc 01 movw r30, r24
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Endpoint)
684: 81 81 ldd r24, Z+1 ; 0x01
686: 85 30 cpi r24, 0x05 ; 5
688: 29 f4 brne .+10 ; 0x694 <DComp_NextAudioInterfaceDataEndpoint+0x12>
{
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
if ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_ISOCHRONOUS)
68a: 83 81 ldd r24, Z+3 ; 0x03
68c: 83 70 andi r24, 0x03 ; 3
68e: 81 30 cpi r24, 0x01 ; 1
690: 19 f4 brne .+6 ; 0x698 <DComp_NextAudioInterfaceDataEndpoint+0x16>
692: 04 c0 rjmp .+8 ; 0x69c <DComp_NextAudioInterfaceDataEndpoint+0x1a>
return DESCRIPTOR_SEARCH_Found;
}
else if (Header->Type == DTYPE_Interface)
694: 84 30 cpi r24, 0x04 ; 4
696: 21 f0 breq .+8 ; 0x6a0 <DComp_NextAudioInterfaceDataEndpoint+0x1e>
{
return DESCRIPTOR_SEARCH_Fail;
}
return DESCRIPTOR_SEARCH_NotFound;
698: 82 e0 ldi r24, 0x02 ; 2
69a: 08 95 ret
if (Header->Type == DTYPE_Endpoint)
{
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
if ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_ISOCHRONOUS)
return DESCRIPTOR_SEARCH_Found;
69c: 80 e0 ldi r24, 0x00 ; 0
69e: 08 95 ret
}
else if (Header->Type == DTYPE_Interface)
{
return DESCRIPTOR_SEARCH_Fail;
6a0: 81 e0 ldi r24, 0x01 ; 1
}
return DESCRIPTOR_SEARCH_NotFound;
}
6a2: 08 95 ret
000006a4 <ProcessConfigurationDescriptor>:
uint8_t StreamingInterfaceIndex = 0;
uint8_t StreamingInterfaceAltSetting = 0;
uint8_t StreamingEndpointAddress = 0;
uint8_t ProcessConfigurationDescriptor(void)
{
6a4: af 92 push r10
6a6: bf 92 push r11
6a8: cf 92 push r12
6aa: df 92 push r13
6ac: ef 92 push r14
6ae: ff 92 push r15
6b0: 0f 93 push r16
6b2: 1f 93 push r17
6b4: df 93 push r29
6b6: cf 93 push r28
6b8: cd b7 in r28, 0x3d ; 61
6ba: de b7 in r29, 0x3e ; 62
6bc: c4 50 subi r28, 0x04 ; 4
6be: d2 40 sbci r29, 0x02 ; 2
6c0: 0f b6 in r0, 0x3f ; 63
6c2: f8 94 cli
6c4: de bf out 0x3e, r29 ; 62
6c6: 0f be out 0x3f, r0 ; 63
6c8: cd bf out 0x3d, r28 ; 61
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
6ca: ae 01 movw r20, r28
6cc: 4b 5f subi r20, 0xFB ; 251
6ce: 5f 4f sbci r21, 0xFF ; 255
6d0: 5a 83 std Y+2, r21 ; 0x02
6d2: 49 83 std Y+1, r20 ; 0x01
USB_Descriptor_Interface_t* AudioControlInterface = NULL;
USB_Descriptor_Interface_t* AudioStreamingInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData)))
6d4: 23 e0 ldi r18, 0x03 ; 3
6d6: e2 2e mov r14, r18
6d8: f1 2c mov r15, r1
6da: ec 0e add r14, r28
6dc: fd 1e adc r15, r29
6de: 81 e0 ldi r24, 0x01 ; 1
6e0: b7 01 movw r22, r14
6e2: 20 e0 ldi r18, 0x00 ; 0
6e4: 32 e0 ldi r19, 0x02 ; 2
6e6: 09 d4 rcall .+2066 ; 0xefa <USB_Host_GetDeviceConfigDescriptor>
6e8: 85 30 cpi r24, 0x05 ; 5
6ea: 09 f4 brne .+2 ; 0x6ee <ProcessConfigurationDescriptor+0x4a>
6ec: 5c c0 rjmp .+184 ; 0x7a6 <ProcessConfigurationDescriptor+0x102>
6ee: 86 30 cpi r24, 0x06 ; 6
6f0: 61 f0 breq .+24 ; 0x70a <ProcessConfigurationDescriptor+0x66>
6f2: 88 23 and r24, r24
6f4: 61 f4 brne .+24 ; 0x70e <ProcessConfigurationDescriptor+0x6a>
6f6: 00 e0 ldi r16, 0x00 ; 0
6f8: 10 e0 ldi r17, 0x00 ; 0
6fa: cc 24 eor r12, r12
6fc: dd 24 eor r13, r13
6fe: 57 01 movw r10, r14
700: 7e 01 movw r14, r28
702: 08 94 sec
704: e1 1c adc r14, r1
706: f1 1c adc r15, r1
708: 07 c0 rjmp .+14 ; 0x718 <ProcessConfigurationDescriptor+0x74>
{
case HOST_GETCONFIG_Successful:
break;
case HOST_GETCONFIG_InvalidData:
return InvalidConfigDataReturned;
70a: 83 e0 ldi r24, 0x03 ; 3
70c: 4f c0 rjmp .+158 ; 0x7ac <ProcessConfigurationDescriptor+0x108>
case HOST_GETCONFIG_BuffOverflow:
return DescriptorTooLarge;
default:
return ControlError;
70e: 81 e0 ldi r24, 0x01 ; 1
710: 4d c0 rjmp .+154 ; 0x7ac <ProcessConfigurationDescriptor+0x108>
USB_Descriptor_Interface_t* AudioControlInterface = NULL;
USB_Descriptor_Interface_t* AudioStreamingInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData)))
712: 9c 01 movw r18, r24
714: 03 2f mov r16, r19
716: 18 2f mov r17, r24
return ControlError;
}
while (!(DataINEndpoint))
{
if (!(AudioControlInterface) ||
718: c1 14 cp r12, r1
71a: d1 04 cpc r13, r1
71c: 41 f0 breq .+16 ; 0x72e <ProcessConfigurationDescriptor+0x8a>
USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
71e: c5 01 movw r24, r10
720: b7 01 movw r22, r14
722: 41 e4 ldi r20, 0x41 ; 65
724: 53 e0 ldi r21, 0x03 ; 3
726: 40 d4 rcall .+2176 ; 0xfa8 <USB_GetNextDescriptorComp>
return ControlError;
}
while (!(DataINEndpoint))
{
if (!(AudioControlInterface) ||
728: 88 23 and r24, r24
72a: 51 f4 brne .+20 ; 0x740 <ProcessConfigurationDescriptor+0x9c>
72c: 1c c0 rjmp .+56 ; 0x766 <ProcessConfigurationDescriptor+0xc2>
USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
DComp_NextAudioInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
if (!(AudioControlInterface))
{
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
72e: c5 01 movw r24, r10
730: b7 01 movw r22, r14
732: 4f e1 ldi r20, 0x1F ; 31
734: 53 e0 ldi r21, 0x03 ; 3
736: 38 d4 rcall .+2160 ; 0xfa8 <USB_GetNextDescriptorComp>
738: 88 23 and r24, r24
73a: b9 f5 brne .+110 ; 0x7aa <ProcessConfigurationDescriptor+0x106>
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
/* Save the interface in case we need to refer back to it later */
AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
73c: c9 80 ldd r12, Y+1 ; 0x01
73e: da 80 ldd r13, Y+2 ; 0x02
}
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
740: c5 01 movw r24, r10
742: b7 01 movw r22, r14
744: 40 e3 ldi r20, 0x30 ; 48
746: 53 e0 ldi r21, 0x03 ; 3
748: 2f d4 rcall .+2142 ; 0xfa8 <USB_GetNextDescriptorComp>
74a: 88 23 and r24, r24
74c: 49 f0 breq .+18 ; 0x760 <ProcessConfigurationDescriptor+0xbc>
DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
74e: c5 01 movw r24, r10
750: b7 01 movw r22, r14
752: 4f e1 ldi r20, 0x1F ; 31
754: 53 e0 ldi r21, 0x03 ; 3
756: 28 d4 rcall .+2128 ; 0xfa8 <USB_GetNextDescriptorComp>
758: 88 23 and r24, r24
75a: 39 f5 brne .+78 ; 0x7aa <ProcessConfigurationDescriptor+0x106>
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
/* Save the interface in case we need to refer back to it later */
AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
75c: c9 80 ldd r12, Y+1 ; 0x01
75e: da 80 ldd r13, Y+2 ; 0x02
}
/* Save the interface in case we need to refer back to it later */
AudioStreamingInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
760: 09 81 ldd r16, Y+1 ; 0x01
762: 1a 81 ldd r17, Y+2 ; 0x02
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
764: 35 c0 rjmp .+106 ; 0x7d0 <ProcessConfigurationDescriptor+0x12c>
}
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
766: e9 81 ldd r30, Y+1 ; 0x01
768: fa 81 ldd r31, Y+2 ; 0x02
/* If the endpoint is a IN type endpoint */
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
76a: 82 81 ldd r24, Z+2 ; 0x02
76c: 87 ff sbrs r24, 7
76e: 30 c0 rjmp .+96 ; 0x7d0 <ProcessConfigurationDescriptor+0x12c>
770: 90 2f mov r25, r16
772: 81 2f mov r24, r17
return DescriptorTooLarge;
default:
return ControlError;
}
while (!(DataINEndpoint))
774: 30 97 sbiw r30, 0x00 ; 0
776: 69 f2 breq .-102 ; 0x712 <ProcessConfigurationDescriptor+0x6e>
/* If the endpoint is a IN type endpoint */
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
StreamingInterfaceIndex = AudioStreamingInterface->InterfaceNumber;
778: d8 01 movw r26, r16
77a: 12 96 adiw r26, 0x02 ; 2
77c: 8c 91 ld r24, X
77e: 12 97 sbiw r26, 0x02 ; 2
780: 80 93 1c 01 sts 0x011C, r24
StreamingInterfaceAltSetting = AudioStreamingInterface->AlternateSetting;
784: 13 96 adiw r26, 0x03 ; 3
786: 8c 91 ld r24, X
788: 80 93 1d 01 sts 0x011D, r24
StreamingEndpointAddress = DataINEndpoint->EndpointAddress;
78c: 22 81 ldd r18, Z+2 ; 0x02
78e: 20 93 1e 01 sts 0x011E, r18
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(AUDIO_DATA_IN_PIPE, EP_TYPE_ISOCHRONOUS, PIPE_TOKEN_IN,
792: 04 81 ldd r16, Z+4 ; 0x04
794: 15 81 ldd r17, Z+5 ; 0x05
796: 81 e0 ldi r24, 0x01 ; 1
798: 61 e0 ldi r22, 0x01 ; 1
79a: 40 e1 ldi r20, 0x10 ; 16
79c: 94 e0 ldi r25, 0x04 ; 4
79e: e9 2e mov r14, r25
7a0: 22 d2 rcall .+1092 ; 0xbe6 <Pipe_ConfigurePipe>
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_DOUBLE);
/* Valid data found, return success */
return SuccessfulConfigRead;
7a2: 80 e0 ldi r24, 0x00 ; 0
7a4: 03 c0 rjmp .+6 ; 0x7ac <ProcessConfigurationDescriptor+0x108>
case HOST_GETCONFIG_Successful:
break;
case HOST_GETCONFIG_InvalidData:
return InvalidConfigDataReturned;
case HOST_GETCONFIG_BuffOverflow:
return DescriptorTooLarge;
7a6: 82 e0 ldi r24, 0x02 ; 2
7a8: 01 c0 rjmp .+2 ; 0x7ac <ProcessConfigurationDescriptor+0x108>
{
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
7aa: 84 e0 ldi r24, 0x04 ; 4
Pipe_ConfigurePipe(AUDIO_DATA_IN_PIPE, EP_TYPE_ISOCHRONOUS, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_DOUBLE);
/* Valid data found, return success */
return SuccessfulConfigRead;
}
7ac: cc 5f subi r28, 0xFC ; 252
7ae: dd 4f sbci r29, 0xFD ; 253
7b0: 0f b6 in r0, 0x3f ; 63
7b2: f8 94 cli
7b4: de bf out 0x3e, r29 ; 62
7b6: 0f be out 0x3f, r0 ; 63
7b8: cd bf out 0x3d, r28 ; 61
7ba: cf 91 pop r28
7bc: df 91 pop r29
7be: 1f 91 pop r17
7c0: 0f 91 pop r16
7c2: ff 90 pop r15
7c4: ef 90 pop r14
7c6: df 90 pop r13
7c8: cf 90 pop r12
7ca: bf 90 pop r11
7cc: af 90 pop r10
7ce: 08 95 ret
USB_Descriptor_Interface_t* AudioControlInterface = NULL;
USB_Descriptor_Interface_t* AudioStreamingInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData)))
7d0: 90 2f mov r25, r16
7d2: 81 2f mov r24, r17
7d4: 9e cf rjmp .-196 ; 0x712 <ProcessConfigurationDescriptor+0x6e>
000007d6 <USB_Host_ResetDevice>:
* \return Boolean \c true if the bus is currently suspended, \c false otherwise.
*/
static inline bool USB_Host_IsBusSuspended(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool USB_Host_IsBusSuspended(void)
{
return ((UHCON & (1 << SOFEN)) ? false : true);
7d6: 80 91 9e 00 lds r24, 0x009E
7da: 90 e0 ldi r25, 0x00 ; 0
7dc: 81 70 andi r24, 0x01 ; 1
7de: 90 70 andi r25, 0x00 ; 0
break;
case USB_INT_DCONNI:
UHIEN &= ~(1 << DCONNE);
break;
case USB_INT_DDISCI:
UHIEN &= ~(1 << DDISCE);
7e0: 20 91 a0 00 lds r18, 0x00A0
7e4: 2d 7f andi r18, 0xFD ; 253
7e6: 20 93 a0 00 sts 0x00A0, r18
* woken up automatically and the bus resumed after the reset has been correctly issued.
*/
static inline void USB_Host_ResetBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_ResetBus(void)
{
UHCON |= (1 << RESET);
7ea: 20 91 9e 00 lds r18, 0x009E
7ee: 22 60 ori r18, 0x02 ; 2
7f0: 20 93 9e 00 sts 0x009E, r18
* \return Boolean \c true if no bus reset is currently being sent, \c false otherwise.
*/
static inline bool USB_Host_IsBusResetComplete(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool USB_Host_IsBusResetComplete(void)
{
return ((UHCON & (1 << RESET)) ? false : true);
7f4: 20 91 9e 00 lds r18, 0x009E
bool BusSuspended = USB_Host_IsBusSuspended();
USB_INT_Disable(USB_INT_DDISCI);
USB_Host_ResetBus();
while (!(USB_Host_IsBusResetComplete()));
7f8: 21 fd sbrc r18, 1
7fa: fc cf rjmp .-8 ; 0x7f4 <USB_Host_ResetDevice+0x1e>
* host and attached device may occur.
*/
static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_ResumeBus(void)
{
UHCON |= (1 << SOFEN);
7fc: 20 91 9e 00 lds r18, 0x009E
800: 21 60 ori r18, 0x01 ; 1
802: 20 93 9e 00 sts 0x009E, r18
case USB_INT_RXSTPI:
return (UEIENX & (1 << RXSTPE));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHIEN & (1 << HSOFE));
806: 20 91 a0 00 lds r18, 0x00A0
80a: 30 e0 ldi r19, 0x00 ; 0
80c: 20 72 andi r18, 0x20 ; 32
80e: 30 70 andi r19, 0x00 ; 0
UEIENX &= ~(1 << RXSTPE);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHIEN &= ~(1 << HSOFE);
810: 40 91 a0 00 lds r20, 0x00A0
814: 4f 7d andi r20, 0xDF ; 223
816: 40 93 a0 00 sts 0x00A0, r20
UEINTX &= ~(1 << RXSTPI);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
81a: 40 91 9f 00 lds r20, 0x009F
81e: 4f 7d andi r20, 0xDF ; 223
820: 40 93 9f 00 sts 0x009F, r20
824: 4a e0 ldi r20, 0x0A ; 10
case USB_INT_RXSTPI:
return (UEINTX & (1 << RXSTPI));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHINT & (1 << HSOFI));
826: 50 91 9f 00 lds r21, 0x009F
/* Workaround for powerless-pull-up devices. After a USB bus reset,
all disconnection interrupts are suppressed while a USB frame is
looked for - if it is found within 10ms, the device is still
present. */
if (USB_INT_HasOccurred(USB_INT_HSOFI))
82a: 55 ff sbrs r21, 5
82c: 0b c0 rjmp .+22 ; 0x844 <USB_Host_ResetDevice+0x6e>
UEINTX &= ~(1 << RXSTPI);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
82e: 40 91 9f 00 lds r20, 0x009F
832: 4f 7d andi r20, 0xDF ; 223
834: 40 93 9f 00 sts 0x009F, r20
break;
case USB_INT_DCONNI:
UHINT &= ~(1 << DCONNI);
break;
case USB_INT_DDISCI:
UHINT &= ~(1 << DDISCI);
838: 40 91 9f 00 lds r20, 0x009F
83c: 4d 7f andi r20, 0xFD ; 253
83e: 40 93 9f 00 sts 0x009F, r20
842: 08 c0 rjmp .+16 ; 0x854 <USB_Host_ResetDevice+0x7e>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
844: ef ec ldi r30, 0xCF ; 207
846: f7 e0 ldi r31, 0x07 ; 7
848: 31 97 sbiw r30, 0x01 ; 1
84a: f1 f7 brne .-4 ; 0x848 <USB_Host_ResetDevice+0x72>
84c: 00 c0 rjmp .+0 ; 0x84e <USB_Host_ResetDevice+0x78>
84e: 00 00 nop
850: 41 50 subi r20, 0x01 ; 1
bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI);
USB_INT_Disable(USB_INT_HSOFI);
USB_INT_Clear(USB_INT_HSOFI);
for (uint8_t MSRem = 10; MSRem != 0; MSRem--)
852: 49 f7 brne .-46 ; 0x826 <USB_Host_ResetDevice+0x50>
}
Delay_MS(1);
}
if (HSOFIEnabled)
854: 21 15 cp r18, r1
856: 31 05 cpc r19, r1
858: 29 f0 breq .+10 ; 0x864 <USB_Host_ResetDevice+0x8e>
UEIENX |= (1 << RXSTPE);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHIEN |= (1 << HSOFE);
85a: 20 91 a0 00 lds r18, 0x00A0
85e: 20 62 ori r18, 0x20 ; 32
860: 20 93 a0 00 sts 0x00A0, r18
USB_INT_Enable(USB_INT_HSOFI);
if (BusSuspended)
864: 00 97 sbiw r24, 0x00 ; 0
866: 29 f4 brne .+10 ; 0x872 <USB_Host_ResetDevice+0x9c>
* messages to the device.
*/
static inline void USB_Host_SuspendBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_SuspendBus(void)
{
UHCON &= ~(1 << SOFEN);
868: 80 91 9e 00 lds r24, 0x009E
86c: 8e 7f andi r24, 0xFE ; 254
86e: 80 93 9e 00 sts 0x009E, r24
break;
case USB_INT_DCONNI:
UHIEN |= (1 << DCONNE);
break;
case USB_INT_DDISCI:
UHIEN |= (1 << DDISCE);
872: 80 91 a0 00 lds r24, 0x00A0
876: 82 60 ori r24, 0x02 ; 2
878: 80 93 a0 00 sts 0x00A0, r24
USB_Host_SuspendBus();
USB_INT_Enable(USB_INT_DDISCI);
}
87c: 08 95 ret
0000087e <USB_Host_WaitMS>:
* \return Boolean \c true if the bus is currently suspended, \c false otherwise.
*/
static inline bool USB_Host_IsBusSuspended(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool USB_Host_IsBusSuspended(void)
{
return ((UHCON & (1 << SOFEN)) ? false : true);
87e: 40 91 9e 00 lds r20, 0x009E
882: 50 e0 ldi r21, 0x00 ; 0
884: 41 70 andi r20, 0x01 ; 1
886: 50 70 andi r21, 0x00 ; 0
case USB_INT_RXSTPI:
return (UEIENX & (1 << RXSTPE));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHIEN & (1 << HSOFE));
888: 20 91 a0 00 lds r18, 0x00A0
88c: 30 e0 ldi r19, 0x00 ; 0
88e: 20 72 andi r18, 0x20 ; 32
890: 30 70 andi r19, 0x00 ; 0
UEIENX &= ~(1 << RXSTPE);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHIEN &= ~(1 << HSOFE);
892: 90 91 a0 00 lds r25, 0x00A0
896: 9f 7d andi r25, 0xDF ; 223
898: 90 93 a0 00 sts 0x00A0, r25
UEINTX &= ~(1 << RXSTPI);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
89c: 90 91 9f 00 lds r25, 0x009F
8a0: 9f 7d andi r25, 0xDF ; 223
8a2: 90 93 9f 00 sts 0x009F, r25
* host and attached device may occur.
*/
static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_ResumeBus(void)
{
UHCON |= (1 << SOFEN);
8a6: 90 91 9e 00 lds r25, 0x009E
8aa: 91 60 ori r25, 0x01 ; 1
8ac: 90 93 9e 00 sts 0x009E, r25
USB_INT_Disable(USB_INT_HSOFI);
USB_INT_Clear(USB_INT_HSOFI);
USB_Host_ResumeBus();
while (MS)
8b0: 26 c0 rjmp .+76 ; 0x8fe <USB_Host_WaitMS+0x80>
case USB_INT_RXSTPI:
return (UEINTX & (1 << RXSTPI));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHINT & (1 << HSOFI));
8b2: 90 91 9f 00 lds r25, 0x009F
{
if (USB_INT_HasOccurred(USB_INT_HSOFI))
8b6: 95 ff sbrs r25, 5
8b8: 06 c0 rjmp .+12 ; 0x8c6 <USB_Host_WaitMS+0x48>
UEINTX &= ~(1 << RXSTPI);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
8ba: 90 91 9f 00 lds r25, 0x009F
8be: 9f 7d andi r25, 0xDF ; 223
8c0: 90 93 9f 00 sts 0x009F, r25
{
USB_INT_Clear(USB_INT_HSOFI);
MS--;
8c4: 81 50 subi r24, 0x01 ; 1
}
if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode != USB_MODE_Host))
8c6: 90 91 2b 01 lds r25, 0x012B
8ca: 92 30 cpi r25, 0x02 ; 2
8cc: d9 f0 breq .+54 ; 0x904 <USB_Host_WaitMS+0x86>
* \return Boolean \c true if an error has occurred on the selected pipe, \c false otherwise.
*/
static inline bool Pipe_IsError(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsError(void)
{
return ((UPINTX & (1 << PERRI)) ? true : false);
8ce: 90 91 a6 00 lds r25, 0x00A6
ErrorCode = HOST_WAITERROR_DeviceDisconnect;
break;
}
if (Pipe_IsError() == true)
8d2: 94 ff sbrs r25, 4
8d4: 09 c0 rjmp .+18 ; 0x8e8 <USB_Host_WaitMS+0x6a>
/** Clears the error flags for the currently selected pipe. */
static inline void Pipe_ClearError(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearError(void)
{
UPERRX = 0;
8d6: 10 92 f5 00 sts 0x00F5, r1
UPINTX &= ~(1 << PERRI);
8da: 80 91 a6 00 lds r24, 0x00A6
8de: 8f 7e andi r24, 0xEF ; 239
8e0: 80 93 a6 00 sts 0x00A6, r24
{
Pipe_ClearError();
ErrorCode = HOST_WAITERROR_PipeError;
8e4: 82 e0 ldi r24, 0x02 ; 2
break;
8e6: 0f c0 rjmp .+30 ; 0x906 <USB_Host_WaitMS+0x88>
* \return Boolean \c true if the current pipe has been stalled by the attached device, \c false otherwise.
*/
static inline bool Pipe_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsStalled(void)
{
return ((UPINTX & (1 << RXSTALLI)) ? true : false);
8e8: 90 91 a6 00 lds r25, 0x00A6
}
if (Pipe_IsStalled() == true)
8ec: 91 ff sbrs r25, 1
8ee: 07 c0 rjmp .+14 ; 0x8fe <USB_Host_WaitMS+0x80>
* \ingroup Group_PipePacketManagement_AVR8
*/
static inline void Pipe_ClearStall(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearStall(void)
{
UPINTX &= ~(1 << RXSTALLI);
8f0: 80 91 a6 00 lds r24, 0x00A6
8f4: 8d 7f andi r24, 0xFD ; 253
8f6: 80 93 a6 00 sts 0x00A6, r24
{
Pipe_ClearStall();
ErrorCode = HOST_WAITERROR_SetupStalled;
8fa: 83 e0 ldi r24, 0x03 ; 3
break;
8fc: 04 c0 rjmp .+8 ; 0x906 <USB_Host_WaitMS+0x88>
USB_INT_Disable(USB_INT_HSOFI);
USB_INT_Clear(USB_INT_HSOFI);
USB_Host_ResumeBus();
while (MS)
8fe: 88 23 and r24, r24
900: c1 f6 brne .-80 ; 0x8b2 <USB_Host_WaitMS+0x34>
902: 01 c0 rjmp .+2 ; 0x906 <USB_Host_WaitMS+0x88>
MS--;
}
if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode != USB_MODE_Host))
{
ErrorCode = HOST_WAITERROR_DeviceDisconnect;
904: 81 e0 ldi r24, 0x01 ; 1
break;
}
}
if (BusSuspended)
906: 41 15 cp r20, r1
908: 51 05 cpc r21, r1
90a: 29 f4 brne .+10 ; 0x916 <USB_Host_WaitMS+0x98>
* messages to the device.
*/
static inline void USB_Host_SuspendBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_SuspendBus(void)
{
UHCON &= ~(1 << SOFEN);
90c: 90 91 9e 00 lds r25, 0x009E
910: 9e 7f andi r25, 0xFE ; 254
912: 90 93 9e 00 sts 0x009E, r25
USB_Host_SuspendBus();
if (HSOFIEnabled)
916: 21 15 cp r18, r1
918: 31 05 cpc r19, r1
91a: 29 f0 breq .+10 ; 0x926 <USB_Host_WaitMS+0xa8>
UEIENX |= (1 << RXSTPE);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHIEN |= (1 << HSOFE);
91c: 90 91 a0 00 lds r25, 0x00A0
920: 90 62 ori r25, 0x20 ; 32
922: 90 93 a0 00 sts 0x00A0, r25
USB_INT_Enable(USB_INT_HSOFI);
return ErrorCode;
}
926: 08 95 ret
00000928 <USB_Host_ProcessNextHostState>:
#define __INCLUDE_FROM_HOST_C
#include "../Host.h"
void USB_Host_ProcessNextHostState(void)
{
928: ef 92 push r14
92a: 0f 93 push r16
92c: 1f 93 push r17
92e: df 93 push r29
930: cf 93 push r28
932: cd b7 in r28, 0x3d ; 61
934: de b7 in r29, 0x3e ; 62
936: 28 97 sbiw r28, 0x08 ; 8
938: 0f b6 in r0, 0x3f ; 63
93a: f8 94 cli
93c: de bf out 0x3e, r29 ; 62
93e: 0f be out 0x3f, r0 ; 63
940: cd bf out 0x3d, r28 ; 61
uint8_t SubErrorCode = HOST_ENUMERROR_NoError;
static uint16_t WaitMSRemaining;
static uint8_t PostWaitState;
switch (USB_HostState)
942: 80 91 2b 01 lds r24, 0x012B
946: 86 30 cpi r24, 0x06 ; 6
948: 09 f4 brne .+2 ; 0x94c <USB_Host_ProcessNextHostState+0x24>
94a: 99 c0 rjmp .+306 ; 0xa7e <USB_Host_ProcessNextHostState+0x156>
94c: 87 30 cpi r24, 0x07 ; 7
94e: 70 f4 brcc .+28 ; 0x96c <USB_Host_ProcessNextHostState+0x44>
950: 83 30 cpi r24, 0x03 ; 3
952: c9 f1 breq .+114 ; 0x9c6 <USB_Host_ProcessNextHostState+0x9e>
954: 84 30 cpi r24, 0x04 ; 4
956: 20 f4 brcc .+8 ; 0x960 <USB_Host_ProcessNextHostState+0x38>
958: 81 30 cpi r24, 0x01 ; 1
95a: 09 f0 breq .+2 ; 0x95e <USB_Host_ProcessNextHostState+0x36>
95c: 0b c1 rjmp .+534 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
95e: 13 c0 rjmp .+38 ; 0x986 <USB_Host_ProcessNextHostState+0x5e>
960: 84 30 cpi r24, 0x04 ; 4
962: c9 f1 breq .+114 ; 0x9d6 <USB_Host_ProcessNextHostState+0xae>
964: 85 30 cpi r24, 0x05 ; 5
966: 09 f0 breq .+2 ; 0x96a <USB_Host_ProcessNextHostState+0x42>
968: 05 c1 rjmp .+522 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
96a: 60 c0 rjmp .+192 ; 0xa2c <USB_Host_ProcessNextHostState+0x104>
96c: 88 30 cpi r24, 0x08 ; 8
96e: 09 f4 brne .+2 ; 0x972 <USB_Host_ProcessNextHostState+0x4a>
970: a0 c0 rjmp .+320 ; 0xab2 <USB_Host_ProcessNextHostState+0x18a>
972: 88 30 cpi r24, 0x08 ; 8
974: 08 f4 brcc .+2 ; 0x978 <USB_Host_ProcessNextHostState+0x50>
976: 8f c0 rjmp .+286 ; 0xa96 <USB_Host_ProcessNextHostState+0x16e>
978: 89 30 cpi r24, 0x09 ; 9
97a: 09 f4 brne .+2 ; 0x97e <USB_Host_ProcessNextHostState+0x56>
97c: b9 c0 rjmp .+370 ; 0xaf0 <USB_Host_ProcessNextHostState+0x1c8>
97e: 8a 30 cpi r24, 0x0A ; 10
980: 09 f0 breq .+2 ; 0x984 <USB_Host_ProcessNextHostState+0x5c>
982: f8 c0 rjmp .+496 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
984: de c0 rjmp .+444 ; 0xb42 <USB_Host_ProcessNextHostState+0x21a>
{
case HOST_STATE_WaitForDevice:
if (WaitMSRemaining)
986: 00 91 20 01 lds r16, 0x0120
98a: 10 91 21 01 lds r17, 0x0121
98e: 01 15 cp r16, r1
990: 11 05 cpc r17, r1
992: 09 f4 brne .+2 ; 0x996 <USB_Host_ProcessNextHostState+0x6e>
994: ef c0 rjmp .+478 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
{
if ((SubErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
996: 81 e0 ldi r24, 0x01 ; 1
998: 72 df rcall .-284 ; 0x87e <USB_Host_WaitMS>
99a: 68 2f mov r22, r24
99c: 88 23 and r24, r24
99e: 31 f0 breq .+12 ; 0x9ac <USB_Host_ProcessNextHostState+0x84>
{
USB_HostState = PostWaitState;
9a0: 80 91 1f 01 lds r24, 0x011F
9a4: 80 93 2b 01 sts 0x012B, r24
ErrorCode = HOST_ENUMERROR_WaitStage;
9a8: 81 e0 ldi r24, 0x01 ; 1
break;
9aa: e0 c0 rjmp .+448 ; 0xb6c <USB_Host_ProcessNextHostState+0x244>
}
if (!(--WaitMSRemaining))
9ac: 01 50 subi r16, 0x01 ; 1
9ae: 10 40 sbci r17, 0x00 ; 0
9b0: 10 93 21 01 sts 0x0121, r17
9b4: 00 93 20 01 sts 0x0120, r16
9b8: 01 15 cp r16, r1
9ba: 11 05 cpc r17, r1
9bc: 09 f0 breq .+2 ; 0x9c0 <USB_Host_ProcessNextHostState+0x98>
9be: da c0 rjmp .+436 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
USB_HostState = PostWaitState;
9c0: 80 91 1f 01 lds r24, 0x011F
9c4: c3 c0 rjmp .+390 ; 0xb4c <USB_Host_ProcessNextHostState+0x224>
}
break;
case HOST_STATE_Powered:
WaitMSRemaining = HOST_DEVICE_SETTLE_DELAY_MS;
9c6: 88 ee ldi r24, 0xE8 ; 232
9c8: 93 e0 ldi r25, 0x03 ; 3
9ca: 90 93 21 01 sts 0x0121, r25
9ce: 80 93 20 01 sts 0x0120, r24
USB_HostState = HOST_STATE_Powered_WaitForDeviceSettle;
9d2: 84 e0 ldi r24, 0x04 ; 4
9d4: bb c0 rjmp .+374 ; 0xb4c <USB_Host_ProcessNextHostState+0x224>
break;
case HOST_STATE_Powered_WaitForDeviceSettle:
if (WaitMSRemaining--)
9d6: 80 91 20 01 lds r24, 0x0120
9da: 90 91 21 01 lds r25, 0x0121
9de: 9c 01 movw r18, r24
9e0: 21 50 subi r18, 0x01 ; 1
9e2: 30 40 sbci r19, 0x00 ; 0
9e4: 30 93 21 01 sts 0x0121, r19
9e8: 20 93 20 01 sts 0x0120, r18
9ec: 00 97 sbiw r24, 0x00 ; 0
9ee: 39 f0 breq .+14 ; 0x9fe <USB_Host_ProcessNextHostState+0xd6>
9f0: 8f ec ldi r24, 0xCF ; 207
9f2: 97 e0 ldi r25, 0x07 ; 7
9f4: 01 97 sbiw r24, 0x01 ; 1
9f6: f1 f7 brne .-4 ; 0x9f4 <USB_Host_ProcessNextHostState+0xcc>
9f8: 00 c0 rjmp .+0 ; 0x9fa <USB_Host_ProcessNextHostState+0xd2>
9fa: 00 00 nop
9fc: bb c0 rjmp .+374 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
}
static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Manual_Off(void)
{
PORTE &= ~(1 << 7);
9fe: 77 98 cbi 0x0e, 7 ; 14
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
static inline void USB_OTGPAD_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_OTGPAD_On(void)
{
USBCON |= (1 << OTGPADE);
a00: 80 91 d8 00 lds r24, 0x00D8
a04: 80 61 ori r24, 0x10 ; 16
a06: 80 93 d8 00 sts 0x00D8, r24
}
static inline void USB_Host_VBUS_Auto_Enable(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Auto_Enable(void)
{
OTGCON &= ~(1 << VBUSHWC);
a0a: 80 91 dd 00 lds r24, 0x00DD
a0e: 8b 7f andi r24, 0xFB ; 251
a10: 80 93 dd 00 sts 0x00DD, r24
UHWCON |= (1 << UVCONE);
a14: 80 91 d7 00 lds r24, 0x00D7
a18: 80 61 ori r24, 0x10 ; 16
a1a: 80 93 d7 00 sts 0x00D7, r24
}
static inline void USB_Host_VBUS_Auto_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Auto_On(void)
{
OTGCON |= (1 << VBUSREQ);
a1e: 80 91 dd 00 lds r24, 0x00DD
a22: 82 60 ori r24, 0x02 ; 2
a24: 80 93 dd 00 sts 0x00DD, r24
USB_OTGPAD_On();
USB_Host_VBUS_Auto_Enable();
USB_Host_VBUS_Auto_On();
USB_HostState = HOST_STATE_Powered_WaitForConnect;
a28: 85 e0 ldi r24, 0x05 ; 5
a2a: 90 c0 rjmp .+288 ; 0xb4c <USB_Host_ProcessNextHostState+0x224>
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHINT & (1 << HSOFI));
case USB_INT_DCONNI:
return (UHINT & (1 << DCONNI));
a2c: 80 91 9f 00 lds r24, 0x009F
}
break;
case HOST_STATE_Powered_WaitForConnect:
if (USB_INT_HasOccurred(USB_INT_DCONNI))
a30: 80 ff sbrs r24, 0
a32: a0 c0 rjmp .+320 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
break;
case USB_INT_DCONNI:
UHINT &= ~(1 << DCONNI);
a34: 80 91 9f 00 lds r24, 0x009F
a38: 8e 7f andi r24, 0xFE ; 254
a3a: 80 93 9f 00 sts 0x009F, r24
break;
case USB_INT_DDISCI:
UHINT &= ~(1 << DDISCI);
a3e: 80 91 9f 00 lds r24, 0x009F
a42: 8d 7f andi r24, 0xFD ; 253
a44: 80 93 9f 00 sts 0x009F, r24
break;
case USB_INT_BCERRI:
OTGINT &= ~(1 << BCERRI);
break;
case USB_INT_VBERRI:
OTGINT &= ~(1 << VBERRI);
a48: 80 91 df 00 lds r24, 0x00DF
a4c: 8d 7f andi r24, 0xFD ; 253
a4e: 80 93 df 00 sts 0x00DF, r24
break;
case USB_INT_BCERRI:
OTGIEN |= (1 << BCERRE);
break;
case USB_INT_VBERRI:
OTGIEN |= (1 << VBERRE);
a52: 80 91 de 00 lds r24, 0x00DE
a56: 82 60 ori r24, 0x02 ; 2
a58: 80 93 de 00 sts 0x00DE, r24
* host and attached device may occur.
*/
static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_ResumeBus(void)
{
UHCON |= (1 << SOFEN);
a5c: 80 91 9e 00 lds r24, 0x009E
a60: 81 60 ori r24, 0x01 ; 1
a62: 80 93 9e 00 sts 0x009E, r24
USB_INT_Clear(USB_INT_VBERRI);
USB_INT_Enable(USB_INT_VBERRI);
USB_Host_ResumeBus();
Pipe_ClearPipes();
a66: 26 d1 rcall .+588 ; 0xcb4 <Pipe_ClearPipes>
HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Powered_DoReset);
a68: 81 e0 ldi r24, 0x01 ; 1
a6a: 80 93 2b 01 sts 0x012B, r24
a6e: 84 e6 ldi r24, 0x64 ; 100
a70: 90 e0 ldi r25, 0x00 ; 0
a72: 90 93 21 01 sts 0x0121, r25
a76: 80 93 20 01 sts 0x0120, r24
a7a: 86 e0 ldi r24, 0x06 ; 6
a7c: 5f c0 rjmp .+190 ; 0xb3c <USB_Host_ProcessNextHostState+0x214>
}
break;
case HOST_STATE_Powered_DoReset:
USB_Host_ResetDevice();
a7e: ab de rcall .-682 ; 0x7d6 <USB_Host_ResetDevice>
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Powered_ConfigPipe);
a80: 81 e0 ldi r24, 0x01 ; 1
a82: 80 93 2b 01 sts 0x012B, r24
a86: 88 ec ldi r24, 0xC8 ; 200
a88: 90 e0 ldi r25, 0x00 ; 0
a8a: 90 93 21 01 sts 0x0121, r25
a8e: 80 93 20 01 sts 0x0120, r24
a92: 87 e0 ldi r24, 0x07 ; 7
a94: 53 c0 rjmp .+166 ; 0xb3c <USB_Host_ProcessNextHostState+0x214>
break;
case HOST_STATE_Powered_ConfigPipe:
Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
a96: 80 e0 ldi r24, 0x00 ; 0
a98: 60 e0 ldi r22, 0x00 ; 0
a9a: 40 e0 ldi r20, 0x00 ; 0
a9c: 20 e0 ldi r18, 0x00 ; 0
a9e: 00 e4 ldi r16, 0x40 ; 64
aa0: 10 e0 ldi r17, 0x00 ; 0
aa2: ee 24 eor r14, r14
aa4: a0 d0 rcall .+320 ; 0xbe6 <Pipe_ConfigurePipe>
* \return Boolean \c true if the selected pipe is configured, \c false otherwise.
*/
static inline bool Pipe_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsConfigured(void)
{
return ((UPSTAX & (1 << CFGOK)) ? true : false);
aa6: 80 91 ac 00 lds r24, 0x00AC
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE);
if (!(Pipe_IsConfigured()))
aaa: 87 ff sbrs r24, 7
aac: 5b c0 rjmp .+182 ; 0xb64 <USB_Host_ProcessNextHostState+0x23c>
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
break;
}
USB_HostState = HOST_STATE_Default;
aae: 88 e0 ldi r24, 0x08 ; 8
ab0: 4d c0 rjmp .+154 ; 0xb4c <USB_Host_ProcessNextHostState+0x224>
break;
case HOST_STATE_Default:
USB_ControlRequest = (USB_Request_Header_t)
ab2: a3 e2 ldi r26, 0x23 ; 35
ab4: b1 e0 ldi r27, 0x01 ; 1
ab6: e3 e1 ldi r30, 0x13 ; 19
ab8: f1 e0 ldi r31, 0x01 ; 1
aba: 88 e0 ldi r24, 0x08 ; 8
abc: 01 90 ld r0, Z+
abe: 0d 92 st X+, r0
ac0: 81 50 subi r24, 0x01 ; 1
ac2: e1 f7 brne .-8 ; 0xabc <USB_Host_ProcessNextHostState+0x194>
.wLength = 8,
};
uint8_t DataBuffer[8];
if ((SubErrorCode = USB_Host_SendControlRequest(DataBuffer)) != HOST_SENDCONTROL_Successful)
ac4: ce 01 movw r24, r28
ac6: 01 96 adiw r24, 0x01 ; 1
ac8: dc d2 rcall .+1464 ; 0x1082 <USB_Host_SendControlRequest>
aca: 68 2f mov r22, r24
acc: 88 23 and r24, r24
ace: 09 f0 breq .+2 ; 0xad2 <USB_Host_ProcessNextHostState+0x1aa>
ad0: 4c c0 rjmp .+152 ; 0xb6a <USB_Host_ProcessNextHostState+0x242>
{
ErrorCode = HOST_ENUMERROR_ControlError;
break;
}
USB_ControlPipeSize = DataBuffer[offsetof(USB_Descriptor_Device_t, Endpoint0Size)];
ad2: 88 85 ldd r24, Y+8 ; 0x08
ad4: 80 93 1b 01 sts 0x011B, r24
USB_Host_ResetDevice();
ad8: 7e de rcall .-772 ; 0x7d6 <USB_Host_ResetDevice>
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset);
ada: 81 e0 ldi r24, 0x01 ; 1
adc: 80 93 2b 01 sts 0x012B, r24
ae0: 88 ec ldi r24, 0xC8 ; 200
ae2: 90 e0 ldi r25, 0x00 ; 0
ae4: 90 93 21 01 sts 0x0121, r25
ae8: 80 93 20 01 sts 0x0120, r24
aec: 89 e0 ldi r24, 0x09 ; 9
aee: 26 c0 rjmp .+76 ; 0xb3c <USB_Host_ProcessNextHostState+0x214>
break;
case HOST_STATE_Default_PostReset:
Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
af0: 00 91 1b 01 lds r16, 0x011B
af4: 80 e0 ldi r24, 0x00 ; 0
af6: 60 e0 ldi r22, 0x00 ; 0
af8: 40 e0 ldi r20, 0x00 ; 0
afa: 20 e0 ldi r18, 0x00 ; 0
afc: 10 e0 ldi r17, 0x00 ; 0
afe: ee 24 eor r14, r14
b00: 72 d0 rcall .+228 ; 0xbe6 <Pipe_ConfigurePipe>
b02: 80 91 ac 00 lds r24, 0x00AC
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
USB_ControlPipeSize, PIPE_BANK_SINGLE);
if (!(Pipe_IsConfigured()))
b06: 87 ff sbrs r24, 7
b08: 2d c0 rjmp .+90 ; 0xb64 <USB_Host_ProcessNextHostState+0x23c>
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
break;
}
USB_ControlRequest = (USB_Request_Header_t)
b0a: a3 e2 ldi r26, 0x23 ; 35
b0c: b1 e0 ldi r27, 0x01 ; 1
b0e: eb e0 ldi r30, 0x0B ; 11
b10: f1 e0 ldi r31, 0x01 ; 1
b12: 88 e0 ldi r24, 0x08 ; 8
b14: 01 90 ld r0, Z+
b16: 0d 92 st X+, r0
b18: 81 50 subi r24, 0x01 ; 1
b1a: e1 f7 brne .-8 ; 0xb14 <USB_Host_ProcessNextHostState+0x1ec>
.wValue = USB_HOST_DEVICEADDRESS,
.wIndex = 0,
.wLength = 0,
};
if ((SubErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
b1c: 80 e0 ldi r24, 0x00 ; 0
b1e: 90 e0 ldi r25, 0x00 ; 0
b20: b0 d2 rcall .+1376 ; 0x1082 <USB_Host_SendControlRequest>
b22: 68 2f mov r22, r24
b24: 88 23 and r24, r24
b26: 09 f5 brne .+66 ; 0xb6a <USB_Host_ProcessNextHostState+0x242>
{
ErrorCode = HOST_ENUMERROR_ControlError;
break;
}
HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Default_PostAddressSet);
b28: 81 e0 ldi r24, 0x01 ; 1
b2a: 80 93 2b 01 sts 0x012B, r24
b2e: 84 e6 ldi r24, 0x64 ; 100
b30: 90 e0 ldi r25, 0x00 ; 0
b32: 90 93 21 01 sts 0x0121, r25
b36: 80 93 20 01 sts 0x0120, r24
b3a: 8a e0 ldi r24, 0x0A ; 10
b3c: 80 93 1f 01 sts 0x011F, r24
break;
b40: 19 c0 rjmp .+50 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
}
static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void USB_Host_SetDeviceAddress(const uint8_t Address)
{
UHADDR = (Address & 0x7F);
b42: 81 e0 ldi r24, 0x01 ; 1
b44: 80 93 a1 00 sts 0x00A1, r24
case HOST_STATE_Default_PostAddressSet:
USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS);
EVENT_USB_Host_DeviceEnumerationComplete();
b48: 24 dc rcall .-1976 ; 0x392 <EVENT_USB_Host_DeviceEnumerationComplete>
USB_HostState = HOST_STATE_Addressed;
b4a: 8b e0 ldi r24, 0x0B ; 11
b4c: 80 93 2b 01 sts 0x012B, r24
break;
b50: 11 c0 rjmp .+34 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
}
if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached))
{
EVENT_USB_Host_DeviceEnumerationFailed(ErrorCode, SubErrorCode);
b52: 40 dc rcall .-1920 ; 0x3d4 <EVENT_USB_Host_DeviceEnumerationFailed>
}
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Auto_Off(void)
{
OTGCON |= (1 << VBUSRQC);
b54: 80 91 dd 00 lds r24, 0x00DD
b58: 81 60 ori r24, 0x01 ; 1
b5a: 80 93 dd 00 sts 0x00DD, r24
USB_Host_VBUS_Auto_Off();
EVENT_USB_Host_DeviceUnattached();
b5e: 14 dc rcall .-2008 ; 0x388 <EVENT_USB_Host_DeviceUnattached>
USB_ResetInterface();
b60: d5 d0 rcall .+426 ; 0xd0c <USB_ResetInterface>
b62: 08 c0 rjmp .+16 ; 0xb74 <USB_Host_ProcessNextHostState+0x24c>
USB_ControlPipeSize, PIPE_BANK_SINGLE);
if (!(Pipe_IsConfigured()))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
b64: 60 e0 ldi r22, 0x00 ; 0
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
USB_ControlPipeSize, PIPE_BANK_SINGLE);
if (!(Pipe_IsConfigured()))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
b66: 84 e0 ldi r24, 0x04 ; 4
b68: 01 c0 rjmp .+2 ; 0xb6c <USB_Host_ProcessNextHostState+0x244>
.wLength = 0,
};
if ((SubErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{
ErrorCode = HOST_ENUMERROR_ControlError;
b6a: 83 e0 ldi r24, 0x03 ; 3
EVENT_USB_Host_DeviceEnumerationComplete();
USB_HostState = HOST_STATE_Addressed;
break;
}
if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached))
b6c: 90 91 2b 01 lds r25, 0x012B
b70: 92 30 cpi r25, 0x02 ; 2
b72: 79 f7 brne .-34 ; 0xb52 <USB_Host_ProcessNextHostState+0x22a>
EVENT_USB_Host_DeviceUnattached();
USB_ResetInterface();
}
}
b74: 28 96 adiw r28, 0x08 ; 8
b76: 0f b6 in r0, 0x3f ; 63
b78: f8 94 cli
b7a: de bf out 0x3e, r29 ; 62
b7c: 0f be out 0x3f, r0 ; 63
b7e: cd bf out 0x3d, r28 ; 61
b80: cf 91 pop r28
b82: df 91 pop r29
b84: 1f 91 pop r17
b86: 0f 91 pop r16
b88: ef 90 pop r14
b8a: 08 95 ret
00000b8c <USB_Host_SetDeviceConfiguration>:
USB_INT_Enable(USB_INT_DDISCI);
}
uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber)
{
USB_ControlRequest = (USB_Request_Header_t)
b8c: 10 92 23 01 sts 0x0123, r1
b90: 99 e0 ldi r25, 0x09 ; 9
b92: 90 93 24 01 sts 0x0124, r25
b96: 80 93 25 01 sts 0x0125, r24
b9a: 10 92 26 01 sts 0x0126, r1
b9e: 10 92 28 01 sts 0x0128, r1
ba2: 10 92 27 01 sts 0x0127, r1
ba6: 10 92 2a 01 sts 0x012A, r1
baa: 10 92 29 01 sts 0x0129, r1
* \param[in] PipeNumber Index of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
{
UPNUM = PipeNumber;
bae: 10 92 a7 00 sts 0x00A7, r1
.wLength = 0,
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
return USB_Host_SendControlRequest(NULL);
bb2: 80 e0 ldi r24, 0x00 ; 0
bb4: 90 e0 ldi r25, 0x00 ; 0
}
bb6: 65 c2 rjmp .+1226 ; 0x1082 <USB_Host_SendControlRequest>
00000bb8 <USB_Host_SetInterfaceAltSetting>:
}
uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceNum,
const uint8_t AltSetting)
{
USB_ControlRequest = (USB_Request_Header_t)
bb8: e3 e2 ldi r30, 0x23 ; 35
bba: f1 e0 ldi r31, 0x01 ; 1
bbc: 91 e0 ldi r25, 0x01 ; 1
bbe: 90 93 23 01 sts 0x0123, r25
bc2: 9b e0 ldi r25, 0x0B ; 11
bc4: 90 93 24 01 sts 0x0124, r25
bc8: 60 93 25 01 sts 0x0125, r22
bcc: 13 82 std Z+3, r1 ; 0x03
bce: 80 93 27 01 sts 0x0127, r24
bd2: 15 82 std Z+5, r1 ; 0x05
bd4: 10 92 2a 01 sts 0x012A, r1
bd8: 10 92 29 01 sts 0x0129, r1
bdc: 10 92 a7 00 sts 0x00A7, r1
.wLength = 0,
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
return USB_Host_SendControlRequest(NULL);
be0: 80 e0 ldi r24, 0x00 ; 0
be2: 90 e0 ldi r25, 0x00 ; 0
}
be4: 4e c2 rjmp .+1180 ; 0x1082 <USB_Host_SendControlRequest>
00000be6 <Pipe_ConfigurePipe>:
const uint8_t Type,
const uint8_t Token,
const uint8_t EndpointNumber,
const uint16_t Size,
const uint8_t Banks)
{
be6: ef 92 push r14
be8: 0f 93 push r16
bea: 1f 93 push r17
bec: 5e 2d mov r21, r14
Pipe_SelectPipe(PNum);
if (PNum == Number)
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
bee: 62 95 swap r22
bf0: 66 0f add r22, r22
bf2: 66 0f add r22, r22
bf4: 60 7c andi r22, 0xC0 ; 192
bf6: 64 2b or r22, r20
bf8: 2f 70 andi r18, 0x0F ; 15
bfa: 62 2b or r22, r18
Pipe_SetInfiniteINRequests();
return Pipe_IsConfigured();
#else
for (uint8_t PNum = Number; PNum < PIPE_TOTAL_PIPES; PNum++)
bfc: 98 2f mov r25, r24
Pipe_SelectPipe(PNum);
if (PNum == Number)
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
bfe: 52 60 ori r21, 0x02 ; 2
Pipe_SetInfiniteINRequests();
return Pipe_IsConfigured();
#else
for (uint8_t PNum = Number; PNum < PIPE_TOTAL_PIPES; PNum++)
c00: 4d c0 rjmp .+154 ; 0xc9c <Pipe_ConfigurePipe+0xb6>
* \param[in] PipeNumber Index of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
{
UPNUM = PipeNumber;
c02: 90 93 a7 00 sts 0x00A7, r25
uint8_t UPINRQXTemp;
uint8_t UPIENXTemp;
Pipe_SelectPipe(PNum);
if (PNum == Number)
c06: 98 17 cp r25, r24
c08: b1 f4 brne .+44 ; 0xc36 <Pipe_ConfigurePipe+0x50>
c0a: 28 e0 ldi r18, 0x08 ; 8
c0c: 30 e0 ldi r19, 0x00 ; 0
c0e: 40 e0 ldi r20, 0x00 ; 0
c10: 03 c0 rjmp .+6 ; 0xc18 <Pipe_ConfigurePipe+0x32>
uint8_t MaskVal = 0;
uint16_t CheckBytes = 8;
while ((CheckBytes < Bytes) && (CheckBytes < PIPE_MAX_SIZE))
{
MaskVal++;
c12: 4f 5f subi r20, 0xFF ; 255
CheckBytes <<= 1;
c14: 22 0f add r18, r18
c16: 33 1f adc r19, r19
static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes)
{
uint8_t MaskVal = 0;
uint16_t CheckBytes = 8;
while ((CheckBytes < Bytes) && (CheckBytes < PIPE_MAX_SIZE))
c18: 20 17 cp r18, r16
c1a: 31 07 cpc r19, r17
c1c: 10 f4 brcc .+4 ; 0xc22 <Pipe_ConfigurePipe+0x3c>
c1e: 45 30 cpi r20, 0x05 ; 5
c20: c1 f7 brne .-16 ; 0xc12 <Pipe_ConfigurePipe+0x2c>
{
MaskVal++;
CheckBytes <<= 1;
}
return (MaskVal << EPSIZE0);
c22: 24 2f mov r18, r20
c24: 22 95 swap r18
c26: 20 7f andi r18, 0xF0 ; 240
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
c28: 25 2b or r18, r21
Pipe_SelectPipe(PNum);
if (PNum == Number)
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
c2a: a6 2f mov r26, r22
UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
UPCFG2XTemp = 0;
UPCONXTemp = ((1 << PEN) | (1 << INMODE));
UPINRQXTemp = 0;
UPIENXTemp = 0;
c2c: 40 e0 ldi r20, 0x00 ; 0
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
UPCFG2XTemp = 0;
UPCONXTemp = ((1 << PEN) | (1 << INMODE));
UPINRQXTemp = 0;
c2e: 70 e0 ldi r23, 0x00 ; 0
if (PNum == Number)
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
UPCFG2XTemp = 0;
UPCONXTemp = ((1 << PEN) | (1 << INMODE));
c30: e1 e2 ldi r30, 0x21 ; 33
if (PNum == Number)
{
UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
UPCFG2XTemp = 0;
c32: f0 e0 ldi r31, 0x00 ; 0
c34: 0c c0 rjmp .+24 ; 0xc4e <Pipe_ConfigurePipe+0x68>
UPINRQXTemp = 0;
UPIENXTemp = 0;
}
else
{
UPCFG0XTemp = UPCFG0X;
c36: a0 91 aa 00 lds r26, 0x00AA
UPCFG1XTemp = UPCFG1X;
c3a: 20 91 ab 00 lds r18, 0x00AB
UPCFG2XTemp = UPCFG2X;
c3e: f0 91 ad 00 lds r31, 0x00AD
UPCONXTemp = UPCONX;
c42: e0 91 a9 00 lds r30, 0x00A9
UPINRQXTemp = UPINRQX;
c46: 70 91 a5 00 lds r23, 0x00A5
UPIENXTemp = UPIENX;
c4a: 40 91 ae 00 lds r20, 0x00AE
/** Configures the currently selected pipe to allow for an unlimited number of IN requests. */
static inline void Pipe_SetInfiniteINRequests(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_SetInfiniteINRequests(void)
{
UPCONX |= (1 << INMODE);
c4e: 30 91 a9 00 lds r19, 0x00A9
c52: 30 62 ori r19, 0x20 ; 32
c54: 30 93 a9 00 sts 0x00A9, r19
}
Pipe_SetInfiniteINRequests();
if (!(UPCFG1XTemp & (1 << ALLOC)))
c58: 21 ff sbrs r18, 1
c5a: 1f c0 rjmp .+62 ; 0xc9a <Pipe_ConfigurePipe+0xb4>
* from an attached device.
*/
static inline void Pipe_DisablePipe(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_DisablePipe(void)
{
UPCONX &= ~(1 << PEN);
c5c: 30 91 a9 00 lds r19, 0x00A9
c60: 3e 7f andi r19, 0xFE ; 254
c62: 30 93 a9 00 sts 0x00A9, r19
continue;
Pipe_DisablePipe();
UPCFG1X &= (1 << ALLOC);
c66: 30 91 ab 00 lds r19, 0x00AB
c6a: 32 70 andi r19, 0x02 ; 2
c6c: 30 93 ab 00 sts 0x00AB, r19
* \pre The currently selected pipe must first be configured properly via \ref Pipe_ConfigurePipe().
*/
static inline void Pipe_EnablePipe(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_EnablePipe(void)
{
UPCONX |= (1 << PEN);
c70: 30 91 a9 00 lds r19, 0x00A9
c74: 31 60 ori r19, 0x01 ; 1
c76: 30 93 a9 00 sts 0x00A9, r19
Pipe_EnablePipe();
UPCFG0X = UPCFG0XTemp;
c7a: a0 93 aa 00 sts 0x00AA, r26
UPCFG1X = UPCFG1XTemp;
c7e: 20 93 ab 00 sts 0x00AB, r18
UPCFG2X = UPCFG2XTemp;
c82: f0 93 ad 00 sts 0x00AD, r31
UPCONX = UPCONXTemp;
c86: e0 93 a9 00 sts 0x00A9, r30
UPINRQX = UPINRQXTemp;
c8a: 70 93 a5 00 sts 0x00A5, r23
UPIENX = UPIENXTemp;
c8e: 40 93 ae 00 sts 0x00AE, r20
* \return Boolean \c true if the selected pipe is configured, \c false otherwise.
*/
static inline bool Pipe_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsConfigured(void)
{
return ((UPSTAX & (1 << CFGOK)) ? true : false);
c92: 20 91 ac 00 lds r18, 0x00AC
if (!(Pipe_IsConfigured()))
c96: 27 ff sbrs r18, 7
c98: 08 c0 rjmp .+16 ; 0xcaa <Pipe_ConfigurePipe+0xc4>
Pipe_SetInfiniteINRequests();
return Pipe_IsConfigured();
#else
for (uint8_t PNum = Number; PNum < PIPE_TOTAL_PIPES; PNum++)
c9a: 9f 5f subi r25, 0xFF ; 255
c9c: 97 30 cpi r25, 0x07 ; 7
c9e: 08 f4 brcc .+2 ; 0xca2 <Pipe_ConfigurePipe+0xbc>
ca0: b0 cf rjmp .-160 ; 0xc02 <Pipe_ConfigurePipe+0x1c>
* \param[in] PipeNumber Index of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
{
UPNUM = PipeNumber;
ca2: 80 93 a7 00 sts 0x00A7, r24
if (!(Pipe_IsConfigured()))
return false;
}
Pipe_SelectPipe(Number);
return true;
ca6: 81 e0 ldi r24, 0x01 ; 1
ca8: 01 c0 rjmp .+2 ; 0xcac <Pipe_ConfigurePipe+0xc6>
UPCONX = UPCONXTemp;
UPINRQX = UPINRQXTemp;
UPIENX = UPIENXTemp;
if (!(Pipe_IsConfigured()))
return false;
caa: 80 e0 ldi r24, 0x00 ; 0
}
Pipe_SelectPipe(Number);
return true;
#endif
}
cac: 1f 91 pop r17
cae: 0f 91 pop r16
cb0: ef 90 pop r14
cb2: 08 95 ret
00000cb4 <Pipe_ClearPipes>:
void Pipe_ClearPipes(void)
{
UPINT = 0;
cb4: 10 92 f8 00 sts 0x00F8, r1
for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)
cb8: 80 e0 ldi r24, 0x00 ; 0
cba: 80 93 a7 00 sts 0x00A7, r24
{
Pipe_SelectPipe(PNum);
UPIENX = 0;
cbe: 10 92 ae 00 sts 0x00AE, r1
UPINTX = 0;
cc2: 10 92 a6 00 sts 0x00A6, r1
UPCFG1X = 0;
cc6: 10 92 ab 00 sts 0x00AB, r1
* from an attached device.
*/
static inline void Pipe_DisablePipe(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_DisablePipe(void)
{
UPCONX &= ~(1 << PEN);
cca: 90 91 a9 00 lds r25, 0x00A9
cce: 9e 7f andi r25, 0xFE ; 254
cd0: 90 93 a9 00 sts 0x00A9, r25
void Pipe_ClearPipes(void)
{
UPINT = 0;
for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)
cd4: 8f 5f subi r24, 0xFF ; 255
cd6: 87 30 cpi r24, 0x07 ; 7
cd8: 81 f7 brne .-32 ; 0xcba <Pipe_ClearPipes+0x6>
UPIENX = 0;
UPINTX = 0;
UPCFG1X = 0;
Pipe_DisablePipe();
}
}
cda: 08 95 ret
00000cdc <USB_Disable>:
USB_ResetInterface();
}
void USB_Disable(void)
{
USB_INT_DisableAllInterrupts();
cdc: 6e d0 rcall .+220 ; 0xdba <USB_INT_DisableAllInterrupts>
USB_INT_ClearAllInterrupts();
cde: 75 d0 rcall .+234 ; 0xdca <USB_INT_ClearAllInterrupts>
* enumerating the device once attached until \ref USB_Attach() is called.
*/
static inline void USB_Detach(void) ATTR_ALWAYS_INLINE;
static inline void USB_Detach(void)
{
UDCON |= (1 << DETACH);
ce0: e0 ee ldi r30, 0xE0 ; 224
ce2: f0 e0 ldi r31, 0x00 ; 0
ce4: 80 81 ld r24, Z
ce6: 81 60 ori r24, 0x01 ; 1
ce8: 80 83 st Z, r24
}
static inline void USB_Controller_Disable(void) ATTR_ALWAYS_INLINE;
static inline void USB_Controller_Disable(void)
{
USBCON &= ~(1 << USBE);
cea: e8 ed ldi r30, 0xD8 ; 216
cec: f0 e0 ldi r31, 0x00 ; 0
cee: 80 81 ld r24, Z
cf0: 8f 77 andi r24, 0x7F ; 127
cf2: 80 83 st Z, r24
}
static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_PLL_Off(void)
{
PLLCSR = 0;
cf4: 19 bc out 0x29, r1 ; 41
static inline void USB_REG_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_REG_Off(void)
{
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
UHWCON &= ~(1 << UVREGE);
cf6: a7 ed ldi r26, 0xD7 ; 215
cf8: b0 e0 ldi r27, 0x00 ; 0
cfa: 8c 91 ld r24, X
cfc: 8e 7f andi r24, 0xFE ; 254
cfe: 8c 93 st X, r24
}
static inline void USB_OTGPAD_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_OTGPAD_Off(void)
{
USBCON &= ~(1 << OTGPADE);
d00: 80 81 ld r24, Z
d02: 8f 7e andi r24, 0xEF ; 239
d04: 80 83 st Z, r24
#if defined(USB_CAN_BE_BOTH)
USB_CurrentMode = USB_MODE_None;
#endif
USB_IsInitialized = false;
d06: 10 92 22 01 sts 0x0122, r1
}
d0a: 08 95 ret
00000d0c <USB_ResetInterface>:
{
#if defined(USB_CAN_BE_BOTH)
bool UIDModeSelectEnabled = ((UHWCON & (1 << UIDE)) != 0);
#endif
USB_INT_DisableAllInterrupts();
d0c: 56 d0 rcall .+172 ; 0xdba <USB_INT_DisableAllInterrupts>
USB_INT_ClearAllInterrupts();
d0e: 5d d0 rcall .+186 ; 0xdca <USB_INT_ClearAllInterrupts>
}
static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE;
static inline void USB_Controller_Reset(void)
{
const uint8_t Temp = USBCON;
d10: 80 91 d8 00 lds r24, 0x00D8
USBCON = (Temp & ~(1 << USBE));
d14: 98 2f mov r25, r24
d16: 9f 77 andi r25, 0x7F ; 127
d18: 90 93 d8 00 sts 0x00D8, r25
USBCON = (Temp | (1 << USBE));
d1c: 80 68 ori r24, 0x80 ; 128
d1e: 80 93 d8 00 sts 0x00D8, r24
}
static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void USB_CLK_Unfreeze(void)
{
USBCON &= ~(1 << FRZCLK);
d22: 80 91 d8 00 lds r24, 0x00D8
d26: 8f 7d andi r24, 0xDF ; 223
d28: 80 93 d8 00 sts 0x00D8, r24
#endif
}
else if (USB_CurrentMode == USB_MODE_Host)
{
#if defined(USB_CAN_BE_HOST)
UHWCON &= ~(1 << UIMOD);
d2c: 80 91 d7 00 lds r24, 0x00D7
d30: 8f 77 andi r24, 0x7F ; 127
d32: 80 93 d7 00 sts 0x00D7, r24
/* Inline Functions: */
static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_PLL_On(void)
{
PLLCSR = USB_PLL_PSC;
d36: 8c e0 ldi r24, 0x0C ; 12
d38: 89 bd out 0x29, r24 ; 41
PLLCSR |= (1 << PLLE);
d3a: 89 b5 in r24, 0x29 ; 41
d3c: 82 60 ori r24, 0x02 ; 2
d3e: 89 bd out 0x29, r24 ; 41
if (!(USB_Options & USB_OPT_MANUAL_PLL))
{
#if defined(USB_CAN_BE_HOST)
USB_PLL_On();
while (!(USB_PLL_IsReady()));
d40: 09 b4 in r0, 0x29 ; 41
d42: 00 fe sbrs r0, 0
d44: fd cf rjmp .-6 ; 0xd40 <USB_ResetInterface+0x34>
#endif
#if defined(USB_CAN_BE_HOST)
static void USB_Init_Host(void)
{
USB_HostState = HOST_STATE_Unattached;
d46: 82 e0 ldi r24, 0x02 ; 2
d48: 80 93 2b 01 sts 0x012B, r24
USB_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE;
d4c: 80 e4 ldi r24, 0x40 ; 64
d4e: 80 93 1b 01 sts 0x011B, r24
#if !defined(__DOXYGEN__)
/* Macros: */
static inline void USB_Host_HostMode_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_HostMode_On(void)
{
USBCON |= (1 << HOST);
d52: 80 91 d8 00 lds r24, 0x00D8
d56: 80 64 ori r24, 0x40 ; 64
d58: 80 93 d8 00 sts 0x00D8, r24
}
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Auto_Off(void)
{
OTGCON |= (1 << VBUSRQC);
d5c: 80 91 dd 00 lds r24, 0x00DD
d60: 81 60 ori r24, 0x01 ; 1
d62: 80 93 dd 00 sts 0x00DD, r24
}
static inline void USB_Host_VBUS_Manual_Enable(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Manual_Enable(void)
{
OTGCON |= (1 << VBUSHWC);
d66: 80 91 dd 00 lds r24, 0x00DD
d6a: 84 60 ori r24, 0x04 ; 4
d6c: 80 93 dd 00 sts 0x00DD, r24
UHWCON &= ~(1 << UVCONE);
d70: 80 91 d7 00 lds r24, 0x00D7
d74: 8f 7e andi r24, 0xEF ; 239
d76: 80 93 d7 00 sts 0x00D7, r24
DDRE |= (1 << 7);
d7a: 6f 9a sbi 0x0d, 7 ; 13
}
static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Manual_On(void)
{
PORTE |= (1 << 7);
d7c: 77 9a sbi 0x0e, 7 ; 14
break;
case USB_INT_VBERRI:
OTGIEN |= (1 << VBERRE);
break;
case USB_INT_SRPI:
OTGIEN |= (1 << SRPE);
d7e: 80 91 de 00 lds r24, 0x00DE
d82: 81 60 ori r24, 0x01 ; 1
d84: 80 93 de 00 sts 0x00DE, r24
break;
case USB_INT_RSTI:
UHIEN |= (1 << RSTE);
break;
case USB_INT_BCERRI:
OTGIEN |= (1 << BCERRE);
d88: 80 91 de 00 lds r24, 0x00DE
d8c: 84 60 ori r24, 0x04 ; 4
d8e: 80 93 de 00 sts 0x00DE, r24
* register and despite the datasheet making no mention of its requirement in host mode.
*/
static inline void USB_Attach(void) ATTR_ALWAYS_INLINE;
static inline void USB_Attach(void)
{
UDCON &= ~(1 << DETACH);
d92: 80 91 e0 00 lds r24, 0x00E0
d96: 8e 7f andi r24, 0xFE ; 254
d98: 80 93 e0 00 sts 0x00E0, r24
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
static inline void USB_OTGPAD_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_OTGPAD_On(void)
{
USBCON |= (1 << OTGPADE);
d9c: 80 91 d8 00 lds r24, 0x00D8
da0: 80 61 ori r24, 0x10 ; 16
da2: 80 93 d8 00 sts 0x00D8, r24
}
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
USB_OTGPAD_On();
#endif
}
da6: 08 95 ret
00000da8 <USB_Init>:
static inline void USB_REG_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_REG_On(void)
{
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
UHWCON |= (1 << UVREGE);
da8: e7 ed ldi r30, 0xD7 ; 215
daa: f0 e0 ldi r31, 0x00 ; 0
dac: 80 81 ld r24, Z
dae: 81 60 ori r24, 0x01 ; 1
db0: 80 83 st Z, r24
UHWCON &= ~(1 << UIDE);
USB_CurrentMode = Mode;
}
#endif
USB_IsInitialized = true;
db2: 81 e0 ldi r24, 0x01 ; 1
db4: 80 93 22 01 sts 0x0122, r24
USB_ResetInterface();
}
db8: a9 cf rjmp .-174 ; 0xd0c <USB_ResetInterface>
00000dba <USB_INT_DisableAllInterrupts>:
#include "../USBInterrupt.h"
void USB_INT_DisableAllInterrupts(void)
{
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
dba: e8 ed ldi r30, 0xD8 ; 216
dbc: f0 e0 ldi r31, 0x00 ; 0
dbe: 80 81 ld r24, Z
dc0: 8c 7f andi r24, 0xFC ; 252
dc2: 80 83 st Z, r24
#if defined(USB_CAN_BE_BOTH)
OTGIEN = 0;
#endif
#if defined(USB_CAN_BE_HOST)
UHIEN = 0;
dc4: 10 92 a0 00 sts 0x00A0, r1
#endif
#if defined(USB_CAN_BE_DEVICE)
UDIEN = 0;
#endif
}
dc8: 08 95 ret
00000dca <USB_INT_ClearAllInterrupts>:
void USB_INT_ClearAllInterrupts(void)
{
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USBINT = 0;
dca: 10 92 da 00 sts 0x00DA, r1
#if defined(USB_CAN_BE_BOTH)
OTGINT = 0;
#endif
#if defined(USB_CAN_BE_HOST)
UHINT = 0;
dce: 10 92 9f 00 sts 0x009F, r1
#endif
#if defined(USB_CAN_BE_DEVICE)
UDINT = 0;
#endif
}
dd2: 08 95 ret
00000dd4 <__vector_10>:
ISR(USB_GEN_vect, ISR_BLOCK)
{
dd4: 1f 92 push r1
dd6: 0f 92 push r0
dd8: 0f b6 in r0, 0x3f ; 63
dda: 0f 92 push r0
ddc: 0b b6 in r0, 0x3b ; 59
dde: 0f 92 push r0
de0: 11 24 eor r1, r1
de2: 2f 93 push r18
de4: 3f 93 push r19
de6: 4f 93 push r20
de8: 5f 93 push r21
dea: 6f 93 push r22
dec: 7f 93 push r23
dee: 8f 93 push r24
df0: 9f 93 push r25
df2: af 93 push r26
df4: bf 93 push r27
df6: ef 93 push r30
df8: ff 93 push r31
case USB_INT_RXSTPI:
return (UEINTX & (1 << RXSTPI));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHINT & (1 << HSOFI));
dfa: 80 91 9f 00 lds r24, 0x009F
}
#endif
#if defined(USB_CAN_BE_HOST)
#if !defined(NO_SOF_EVENTS)
if (USB_INT_HasOccurred(USB_INT_HSOFI) && USB_INT_IsEnabled(USB_INT_HSOFI))
dfe: 85 ff sbrs r24, 5
e00: 0a c0 rjmp .+20 ; 0xe16 <__vector_10+0x42>
case USB_INT_RXSTPI:
return (UEIENX & (1 << RXSTPE));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHIEN & (1 << HSOFE));
e02: 80 91 a0 00 lds r24, 0x00A0
e06: 85 ff sbrs r24, 5
e08: 06 c0 rjmp .+12 ; 0xe16 <__vector_10+0x42>
UEINTX &= ~(1 << RXSTPI);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
e0a: 80 91 9f 00 lds r24, 0x009F
e0e: 8f 7d andi r24, 0xDF ; 223
e10: 80 93 9f 00 sts 0x009F, r24
{
USB_INT_Clear(USB_INT_HSOFI);
EVENT_USB_Host_StartOfFrame();
e14: 0c d1 rcall .+536 ; 0x102e <USB_Event_Stub>
case USB_INT_HSOFI:
return (UHINT & (1 << HSOFI));
case USB_INT_DCONNI:
return (UHINT & (1 << DCONNI));
case USB_INT_DDISCI:
return (UHINT & (1 << DDISCI));
e16: 80 91 9f 00 lds r24, 0x009F
}
#endif
if (USB_INT_HasOccurred(USB_INT_DDISCI) && USB_INT_IsEnabled(USB_INT_DDISCI))
e1a: 81 ff sbrs r24, 1
e1c: 15 c0 rjmp .+42 ; 0xe48 <__vector_10+0x74>
case USB_INT_HSOFI:
return (UHIEN & (1 << HSOFE));
case USB_INT_DCONNI:
return (UHIEN & (1 << DCONNE));
case USB_INT_DDISCI:
return (UHIEN & (1 << DDISCE));
e1e: 80 91 a0 00 lds r24, 0x00A0
e22: 81 ff sbrs r24, 1
e24: 11 c0 rjmp .+34 ; 0xe48 <__vector_10+0x74>
break;
case USB_INT_DCONNI:
UHINT &= ~(1 << DCONNI);
break;
case USB_INT_DDISCI:
UHINT &= ~(1 << DDISCI);
e26: 80 91 9f 00 lds r24, 0x009F
e2a: 8d 7f andi r24, 0xFD ; 253
e2c: 80 93 9f 00 sts 0x009F, r24
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
break;
case USB_INT_DCONNI:
UHINT &= ~(1 << DCONNI);
e30: 80 91 9f 00 lds r24, 0x009F
e34: 8e 7f andi r24, 0xFE ; 254
e36: 80 93 9f 00 sts 0x009F, r24
break;
case USB_INT_DCONNI:
UHIEN &= ~(1 << DCONNE);
break;
case USB_INT_DDISCI:
UHIEN &= ~(1 << DDISCE);
e3a: 80 91 a0 00 lds r24, 0x00A0
e3e: 8d 7f andi r24, 0xFD ; 253
e40: 80 93 a0 00 sts 0x00A0, r24
{
USB_INT_Clear(USB_INT_DDISCI);
USB_INT_Clear(USB_INT_DCONNI);
USB_INT_Disable(USB_INT_DDISCI);
EVENT_USB_Host_DeviceUnattached();
e44: a1 da rcall .-2750 ; 0x388 <EVENT_USB_Host_DeviceUnattached>
USB_ResetInterface();
e46: 62 df rcall .-316 ; 0xd0c <USB_ResetInterface>
case USB_INT_RSTI:
return (UHINT & (1 << RSTI));
case USB_INT_BCERRI:
return (OTGINT & (1 << BCERRI));
case USB_INT_VBERRI:
return (OTGINT & (1 << VBERRI));
e48: 80 91 df 00 lds r24, 0x00DF
}
if (USB_INT_HasOccurred(USB_INT_VBERRI) && USB_INT_IsEnabled(USB_INT_VBERRI))
e4c: 81 ff sbrs r24, 1
e4e: 15 c0 rjmp .+42 ; 0xe7a <__vector_10+0xa6>
case USB_INT_RSTI:
return (UHIEN & (1 << RSTE));
case USB_INT_BCERRI:
return (OTGIEN & (1 << BCERRE));
case USB_INT_VBERRI:
return (OTGIEN & (1 << VBERRE));
e50: 80 91 de 00 lds r24, 0x00DE
e54: 81 ff sbrs r24, 1
e56: 11 c0 rjmp .+34 ; 0xe7a <__vector_10+0xa6>
break;
case USB_INT_BCERRI:
OTGINT &= ~(1 << BCERRI);
break;
case USB_INT_VBERRI:
OTGINT &= ~(1 << VBERRI);
e58: 80 91 df 00 lds r24, 0x00DF
e5c: 8d 7f andi r24, 0xFD ; 253
e5e: 80 93 df 00 sts 0x00DF, r24
}
static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Manual_Off(void)
{
PORTE &= ~(1 << 7);
e62: 77 98 cbi 0x0e, 7 ; 14
}
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Auto_Off(void)
{
OTGCON |= (1 << VBUSRQC);
e64: 80 91 dd 00 lds r24, 0x00DD
e68: 81 60 ori r24, 0x01 ; 1
e6a: 80 93 dd 00 sts 0x00DD, r24
USB_INT_Clear(USB_INT_VBERRI);
USB_Host_VBUS_Manual_Off();
USB_Host_VBUS_Auto_Off();
EVENT_USB_Host_HostError(HOST_ERROR_VBusVoltageDip);
e6e: 80 e0 ldi r24, 0x00 ; 0
e70: 92 da rcall .-2780 ; 0x396 <EVENT_USB_Host_HostError>
EVENT_USB_Host_DeviceUnattached();
e72: 8a da rcall .-2796 ; 0x388 <EVENT_USB_Host_DeviceUnattached>
USB_HostState = HOST_STATE_Unattached;
e74: 82 e0 ldi r24, 0x02 ; 2
e76: 80 93 2b 01 sts 0x012B, r24
case USB_INT_BCERRI:
return (OTGINT & (1 << BCERRI));
case USB_INT_VBERRI:
return (OTGINT & (1 << VBERRI));
case USB_INT_SRPI:
return (OTGINT & (1 << SRPI));
e7a: 80 91 df 00 lds r24, 0x00DF
}
if (USB_INT_HasOccurred(USB_INT_SRPI) && USB_INT_IsEnabled(USB_INT_SRPI))
e7e: 80 ff sbrs r24, 0
e80: 17 c0 rjmp .+46 ; 0xeb0 <__vector_10+0xdc>
case USB_INT_BCERRI:
return (OTGIEN & (1 << BCERRE));
case USB_INT_VBERRI:
return (OTGIEN & (1 << VBERRE));
case USB_INT_SRPI:
return (OTGIEN & (1 << SRPE));
e82: 80 91 de 00 lds r24, 0x00DE
e86: 80 ff sbrs r24, 0
e88: 13 c0 rjmp .+38 ; 0xeb0 <__vector_10+0xdc>
break;
case USB_INT_VBERRI:
OTGINT &= ~(1 << VBERRI);
break;
case USB_INT_SRPI:
OTGINT &= ~(1 << SRPI);
e8a: 80 91 df 00 lds r24, 0x00DF
e8e: 8e 7f andi r24, 0xFE ; 254
e90: 80 93 df 00 sts 0x00DF, r24
break;
case USB_INT_VBERRI:
OTGIEN &= ~(1 << VBERRE);
break;
case USB_INT_SRPI:
OTGIEN &= ~(1 << SRPE);
e94: 80 91 de 00 lds r24, 0x00DE
e98: 8e 7f andi r24, 0xFE ; 254
e9a: 80 93 de 00 sts 0x00DE, r24
{
USB_INT_Clear(USB_INT_SRPI);
USB_INT_Disable(USB_INT_SRPI);
EVENT_USB_Host_DeviceAttached();
e9e: 6f da rcall .-2850 ; 0x37e <EVENT_USB_Host_DeviceAttached>
break;
case USB_INT_DCONNI:
UHIEN |= (1 << DCONNE);
break;
case USB_INT_DDISCI:
UHIEN |= (1 << DDISCE);
ea0: 80 91 a0 00 lds r24, 0x00A0
ea4: 82 60 ori r24, 0x02 ; 2
ea6: 80 93 a0 00 sts 0x00A0, r24
USB_INT_Enable(USB_INT_DDISCI);
USB_HostState = HOST_STATE_Powered;
eaa: 83 e0 ldi r24, 0x03 ; 3
eac: 80 93 2b 01 sts 0x012B, r24
case USB_INT_DDISCI:
return (UHINT & (1 << DDISCI));
case USB_INT_RSTI:
return (UHINT & (1 << RSTI));
case USB_INT_BCERRI:
return (OTGINT & (1 << BCERRI));
eb0: 80 91 df 00 lds r24, 0x00DF
}
if (USB_INT_HasOccurred(USB_INT_BCERRI) && USB_INT_IsEnabled(USB_INT_BCERRI))
eb4: 82 ff sbrs r24, 2
eb6: 0e c0 rjmp .+28 ; 0xed4 <__vector_10+0x100>
case USB_INT_DDISCI:
return (UHIEN & (1 << DDISCE));
case USB_INT_RSTI:
return (UHIEN & (1 << RSTE));
case USB_INT_BCERRI:
return (OTGIEN & (1 << BCERRE));
eb8: 80 91 de 00 lds r24, 0x00DE
ebc: 82 ff sbrs r24, 2
ebe: 0a c0 rjmp .+20 ; 0xed4 <__vector_10+0x100>
break;
case USB_INT_RSTI:
UHINT &= ~(1 << RSTI);
break;
case USB_INT_BCERRI:
OTGINT &= ~(1 << BCERRI);
ec0: 80 91 df 00 lds r24, 0x00DF
ec4: 8b 7f andi r24, 0xFB ; 251
ec6: 80 93 df 00 sts 0x00DF, r24
{
USB_INT_Clear(USB_INT_BCERRI);
EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0);
eca: 82 e0 ldi r24, 0x02 ; 2
ecc: 60 e0 ldi r22, 0x00 ; 0
ece: 82 da rcall .-2812 ; 0x3d4 <EVENT_USB_Host_DeviceEnumerationFailed>
EVENT_USB_Host_DeviceUnattached();
ed0: 5b da rcall .-2890 ; 0x388 <EVENT_USB_Host_DeviceUnattached>
USB_ResetInterface();
ed2: 1c df rcall .-456 ; 0xd0c <USB_ResetInterface>
USB_ResetInterface();
EVENT_USB_UIDChange();
}
#endif
}
ed4: ff 91 pop r31
ed6: ef 91 pop r30
ed8: bf 91 pop r27
eda: af 91 pop r26
edc: 9f 91 pop r25
ede: 8f 91 pop r24
ee0: 7f 91 pop r23
ee2: 6f 91 pop r22
ee4: 5f 91 pop r21
ee6: 4f 91 pop r20
ee8: 3f 91 pop r19
eea: 2f 91 pop r18
eec: 0f 90 pop r0
eee: 0b be out 0x3b, r0 ; 59
ef0: 0f 90 pop r0
ef2: 0f be out 0x3f, r0 ; 63
ef4: 0f 90 pop r0
ef6: 1f 90 pop r1
ef8: 18 95 reti
00000efa <USB_Host_GetDeviceConfigDescriptor>:
#if defined(USB_CAN_BE_HOST)
uint8_t USB_Host_GetDeviceConfigDescriptor(const uint8_t ConfigNumber,
uint16_t* const ConfigSizePtr,
void* const BufferPtr,
const uint16_t BufferSize)
{
efa: cf 92 push r12
efc: df 92 push r13
efe: ef 92 push r14
f00: ff 92 push r15
f02: 0f 93 push r16
f04: 1f 93 push r17
f06: df 93 push r29
f08: cf 93 push r28
f0a: cd b7 in r28, 0x3d ; 61
f0c: de b7 in r29, 0x3e ; 62
f0e: 29 97 sbiw r28, 0x09 ; 9
f10: 0f b6 in r0, 0x3f ; 63
f12: f8 94 cli
f14: de bf out 0x3e, r29 ; 62
f16: 0f be out 0x3f, r0 ; 63
f18: cd bf out 0x3d, r28 ; 61
f1a: 6b 01 movw r12, r22
f1c: 8a 01 movw r16, r20
f1e: 79 01 movw r14, r18
uint8_t ErrorCode;
uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)];
USB_ControlRequest = (USB_Request_Header_t)
f20: 90 e8 ldi r25, 0x80 ; 128
f22: 90 93 23 01 sts 0x0123, r25
f26: 96 e0 ldi r25, 0x06 ; 6
f28: 90 93 24 01 sts 0x0124, r25
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE),
.bRequest = REQ_GetDescriptor,
.wValue = ((DTYPE_Configuration << 8) | (ConfigNumber - 1)),
f2c: 90 e0 ldi r25, 0x00 ; 0
f2e: 01 97 sbiw r24, 0x01 ; 1
f30: 92 60 ori r25, 0x02 ; 2
const uint16_t BufferSize)
{
uint8_t ErrorCode;
uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)];
USB_ControlRequest = (USB_Request_Header_t)
f32: 90 93 26 01 sts 0x0126, r25
f36: 80 93 25 01 sts 0x0125, r24
f3a: 10 92 28 01 sts 0x0128, r1
f3e: 10 92 27 01 sts 0x0127, r1
f42: 89 e0 ldi r24, 0x09 ; 9
f44: 90 e0 ldi r25, 0x00 ; 0
f46: 90 93 2a 01 sts 0x012A, r25
f4a: 80 93 29 01 sts 0x0129, r24
f4e: 10 92 a7 00 sts 0x00A7, r1
.wLength = sizeof(USB_Descriptor_Configuration_Header_t),
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((ErrorCode = USB_Host_SendControlRequest(ConfigHeader)) != HOST_SENDCONTROL_Successful)
f52: ce 01 movw r24, r28
f54: 01 96 adiw r24, 0x01 ; 1
f56: 95 d0 rcall .+298 ; 0x1082 <USB_Host_SendControlRequest>
f58: 88 23 and r24, r24
f5a: b9 f4 brne .+46 ; 0xf8a <USB_Host_GetDeviceConfigDescriptor+0x90>
return ErrorCode;
*ConfigSizePtr = DESCRIPTOR_PCAST(ConfigHeader, USB_Descriptor_Configuration_Header_t)->TotalConfigurationSize;
f5c: 8b 81 ldd r24, Y+3 ; 0x03
f5e: 9c 81 ldd r25, Y+4 ; 0x04
f60: f6 01 movw r30, r12
f62: 91 83 std Z+1, r25 ; 0x01
f64: 80 83 st Z, r24
if (*ConfigSizePtr > BufferSize)
f66: e8 16 cp r14, r24
f68: f9 06 cpc r15, r25
f6a: 70 f0 brcs .+28 ; 0xf88 <USB_Host_GetDeviceConfigDescriptor+0x8e>
return HOST_GETCONFIG_BuffOverflow;
USB_ControlRequest.wLength = *ConfigSizePtr;
f6c: 90 93 2a 01 sts 0x012A, r25
f70: 80 93 29 01 sts 0x0129, r24
if ((ErrorCode = USB_Host_SendControlRequest(BufferPtr)) != HOST_SENDCONTROL_Successful)
f74: c8 01 movw r24, r16
f76: 85 d0 rcall .+266 ; 0x1082 <USB_Host_SendControlRequest>
f78: 88 23 and r24, r24
f7a: 39 f4 brne .+14 ; 0xf8a <USB_Host_GetDeviceConfigDescriptor+0x90>
return ErrorCode;
if (DESCRIPTOR_TYPE(BufferPtr) != DTYPE_Configuration)
f7c: f8 01 movw r30, r16
f7e: 91 81 ldd r25, Z+1 ; 0x01
f80: 92 30 cpi r25, 0x02 ; 2
f82: 19 f0 breq .+6 ; 0xf8a <USB_Host_GetDeviceConfigDescriptor+0x90>
return HOST_GETCONFIG_InvalidData;
f84: 86 e0 ldi r24, 0x06 ; 6
f86: 01 c0 rjmp .+2 ; 0xf8a <USB_Host_GetDeviceConfigDescriptor+0x90>
return ErrorCode;
*ConfigSizePtr = DESCRIPTOR_PCAST(ConfigHeader, USB_Descriptor_Configuration_Header_t)->TotalConfigurationSize;
if (*ConfigSizePtr > BufferSize)
return HOST_GETCONFIG_BuffOverflow;
f88: 85 e0 ldi r24, 0x05 ; 5
if (DESCRIPTOR_TYPE(BufferPtr) != DTYPE_Configuration)
return HOST_GETCONFIG_InvalidData;
return HOST_GETCONFIG_Successful;
}
f8a: 29 96 adiw r28, 0x09 ; 9
f8c: 0f b6 in r0, 0x3f ; 63
f8e: f8 94 cli
f90: de bf out 0x3e, r29 ; 62
f92: 0f be out 0x3f, r0 ; 63
f94: cd bf out 0x3d, r28 ; 61
f96: cf 91 pop r28
f98: df 91 pop r29
f9a: 1f 91 pop r17
f9c: 0f 91 pop r16
f9e: ff 90 pop r15
fa0: ef 90 pop r14
fa2: df 90 pop r13
fa4: cf 90 pop r12
fa6: 08 95 ret
00000fa8 <USB_GetNextDescriptorComp>:
}
uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem,
void** const CurrConfigLoc,
const ConfigComparatorPtr_t const ComparatorRoutine)
{
fa8: af 92 push r10
faa: bf 92 push r11
fac: cf 92 push r12
fae: df 92 push r13
fb0: ef 92 push r14
fb2: ff 92 push r15
fb4: 0f 93 push r16
fb6: 1f 93 push r17
fb8: cf 93 push r28
fba: df 93 push r29
fbc: 8c 01 movw r16, r24
fbe: eb 01 movw r28, r22
fc0: 6a 01 movw r12, r20
uint8_t ErrorCode;
while (*BytesRem)
fc2: 23 c0 rjmp .+70 ; 0x100a <USB_GetNextDescriptorComp+0x62>
{
uint8_t* PrevDescLoc = *CurrConfigLoc;
fc4: e8 81 ld r30, Y
fc6: f9 81 ldd r31, Y+1 ; 0x01
fc8: 5f 01 movw r10, r30
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
void** CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
void** CurrConfigLoc)
{
uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size;
fca: 20 81 ld r18, Z
fcc: 30 e0 ldi r19, 0x00 ; 0
fce: c7 01 movw r24, r14
fd0: 2e 15 cp r18, r14
fd2: 3f 05 cpc r19, r15
fd4: 08 f4 brcc .+2 ; 0xfd8 <USB_GetNextDescriptorComp+0x30>
fd6: c9 01 movw r24, r18
if (*BytesRem < CurrDescriptorSize)
CurrDescriptorSize = *BytesRem;
*CurrConfigLoc = (void*)((uintptr_t)*CurrConfigLoc + CurrDescriptorSize);
fd8: e8 0f add r30, r24
fda: f9 1f adc r31, r25
fdc: f9 83 std Y+1, r31 ; 0x01
fde: e8 83 st Y, r30
*BytesRem -= CurrDescriptorSize;
fe0: f8 01 movw r30, r16
fe2: 20 81 ld r18, Z
fe4: 31 81 ldd r19, Z+1 ; 0x01
fe6: 28 1b sub r18, r24
fe8: 39 0b sbc r19, r25
fea: 31 83 std Z+1, r19 ; 0x01
fec: 20 83 st Z, r18
uint16_t PrevBytesRem = *BytesRem;
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != DESCRIPTOR_SEARCH_NotFound)
fee: 88 81 ld r24, Y
ff0: 99 81 ldd r25, Y+1 ; 0x01
ff2: f6 01 movw r30, r12
ff4: 09 95 icall
ff6: 82 30 cpi r24, 0x02 ; 2
ff8: 41 f0 breq .+16 ; 0x100a <USB_GetNextDescriptorComp+0x62>
{
if (ErrorCode == DESCRIPTOR_SEARCH_Fail)
ffa: 81 30 cpi r24, 0x01 ; 1
ffc: 69 f4 brne .+26 ; 0x1018 <USB_GetNextDescriptorComp+0x70>
{
*CurrConfigLoc = PrevDescLoc;
ffe: a8 82 st Y, r10
1000: b9 82 std Y+1, r11 ; 0x01
*BytesRem = PrevBytesRem;
1002: f8 01 movw r30, r16
1004: f1 82 std Z+1, r15 ; 0x01
1006: e0 82 st Z, r14
1008: 07 c0 rjmp .+14 ; 0x1018 <USB_GetNextDescriptorComp+0x70>
void** const CurrConfigLoc,
const ConfigComparatorPtr_t const ComparatorRoutine)
{
uint8_t ErrorCode;
while (*BytesRem)
100a: f8 01 movw r30, r16
100c: e0 80 ld r14, Z
100e: f1 80 ldd r15, Z+1 ; 0x01
1010: e1 14 cp r14, r1
1012: f1 04 cpc r15, r1
1014: b9 f6 brne .-82 ; 0xfc4 <USB_GetNextDescriptorComp+0x1c>
return ErrorCode;
}
}
return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor;
1016: 82 e0 ldi r24, 0x02 ; 2
}
1018: df 91 pop r29
101a: cf 91 pop r28
101c: 1f 91 pop r17
101e: 0f 91 pop r16
1020: ff 90 pop r15
1022: ef 90 pop r14
1024: df 90 pop r13
1026: cf 90 pop r12
1028: bf 90 pop r11
102a: af 90 pop r10
102c: 08 95 ret
0000102e <USB_Event_Stub>:
#include "Events.h"
void USB_Event_Stub(void)
{
}
102e: 08 95 ret
00001030 <USB_Host_WaitForIOS>:
return ReturnStatus;
}
static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
{
1030: 1f 93 push r17
1032: cf 93 push r28
1034: df 93 push r29
1036: 18 2f mov r17, r24
#if (USB_HOST_TIMEOUT_MS < 0xFF)
uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
#else
uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
1038: c8 ee ldi r28, 0xE8 ; 232
103a: d3 e0 ldi r29, 0x03 ; 3
#endif
while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||
103c: 07 c0 rjmp .+14 ; 0x104c <USB_Host_WaitForIOS+0x1c>
((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
((WaitType == USB_HOST_WAITFOR_OutReady) && Pipe_IsOUTReady())))
{
uint8_t ErrorCode;
if ((ErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
103e: 81 e0 ldi r24, 0x01 ; 1
1040: 1e dc rcall .-1988 ; 0x87e <USB_Host_WaitMS>
1042: 88 23 and r24, r24
1044: d1 f4 brne .+52 ; 0x107a <USB_Host_WaitForIOS+0x4a>
return ErrorCode;
if (!(TimeoutCounter--))
1046: 20 97 sbiw r28, 0x00 ; 0
1048: b9 f0 breq .+46 ; 0x1078 <USB_Host_WaitForIOS+0x48>
104a: 21 97 sbiw r28, 0x01 ; 1
uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
#else
uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
#endif
while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||
104c: 11 23 and r17, r17
104e: 29 f4 brne .+10 ; 0x105a <USB_Host_WaitForIOS+0x2a>
* \return Boolean \c true if the current pipe is ready for a SETUP packet, \c false otherwise.
*/
static inline bool Pipe_IsSETUPSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsSETUPSent(void)
{
return ((UPINTX & (1 << TXSTPI)) ? true : false);
1050: 80 91 a6 00 lds r24, 0x00A6
1054: 83 ff sbrs r24, 3
1056: f3 cf rjmp .-26 ; 0x103e <USB_Host_WaitForIOS+0xe>
1058: 0d c0 rjmp .+26 ; 0x1074 <USB_Host_WaitForIOS+0x44>
105a: 11 30 cpi r17, 0x01 ; 1
105c: 29 f4 brne .+10 ; 0x1068 <USB_Host_WaitForIOS+0x38>
* \return Boolean \c true if the current pipe has received an IN packet, \c false otherwise.
*/
static inline bool Pipe_IsINReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsINReceived(void)
{
return ((UPINTX & (1 << RXINI)) ? true : false);
105e: 80 91 a6 00 lds r24, 0x00A6
((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
1062: 80 ff sbrs r24, 0
1064: ec cf rjmp .-40 ; 0x103e <USB_Host_WaitForIOS+0xe>
1066: 06 c0 rjmp .+12 ; 0x1074 <USB_Host_WaitForIOS+0x44>
uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
#else
uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
#endif
while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||
1068: 12 30 cpi r17, 0x02 ; 2
106a: 49 f7 brne .-46 ; 0x103e <USB_Host_WaitForIOS+0xe>
* \return Boolean \c true if the current pipe is ready for an OUT packet, \c false otherwise.
*/
static inline bool Pipe_IsOUTReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Pipe_IsOUTReady(void)
{
return ((UPINTX & (1 << TXOUTI)) ? true : false);
106c: 80 91 a6 00 lds r24, 0x00A6
((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
((WaitType == USB_HOST_WAITFOR_OutReady) && Pipe_IsOUTReady())))
1070: 82 ff sbrs r24, 2
1072: e5 cf rjmp .-54 ; 0x103e <USB_Host_WaitForIOS+0xe>
if (!(TimeoutCounter--))
return HOST_SENDCONTROL_SoftwareTimeOut;
}
return HOST_SENDCONTROL_Successful;
1074: 80 e0 ldi r24, 0x00 ; 0
1076: 01 c0 rjmp .+2 ; 0x107a <USB_Host_WaitForIOS+0x4a>
if ((ErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
return ErrorCode;
if (!(TimeoutCounter--))
return HOST_SENDCONTROL_SoftwareTimeOut;
1078: 84 e0 ldi r24, 0x04 ; 4
}
return HOST_SENDCONTROL_Successful;
}
107a: df 91 pop r29
107c: cf 91 pop r28
107e: 1f 91 pop r17
1080: 08 95 ret
00001082 <USB_Host_SendControlRequest>:
#define __INCLUDE_FROM_HOSTSTDREQ_C
#include "HostStandardReq.h"
uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
{
1082: ef 92 push r14
1084: ff 92 push r15
1086: 0f 93 push r16
1088: 1f 93 push r17
108a: cf 93 push r28
108c: df 93 push r29
108e: 8c 01 movw r16, r24
* \return Boolean \c true if the bus is currently suspended, \c false otherwise.
*/
static inline bool USB_Host_IsBusSuspended(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool USB_Host_IsBusSuspended(void)
{
return ((UHCON & (1 << SOFEN)) ? false : true);
1090: e0 90 9e 00 lds r14, 0x009E
1094: ff 24 eor r15, r15
1096: 81 e0 ldi r24, 0x01 ; 1
1098: e8 22 and r14, r24
109a: ff 24 eor r15, r15
uint8_t* DataStream = (uint8_t*)BufferPtr;
bool BusSuspended = USB_Host_IsBusSuspended();
uint8_t ReturnStatus = HOST_SENDCONTROL_Successful;
uint16_t DataLen = USB_ControlRequest.wLength;
109c: c0 91 29 01 lds r28, 0x0129
10a0: d0 91 2a 01 lds r29, 0x012A
* host and attached device may occur.
*/
static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_ResumeBus(void)
{
UHCON |= (1 << SOFEN);
10a4: 80 91 9e 00 lds r24, 0x009E
10a8: 81 60 ori r24, 0x01 ; 1
10aa: 80 93 9e 00 sts 0x009E, r24
USB_Host_ResumeBus();
if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
10ae: 81 e0 ldi r24, 0x01 ; 1
10b0: e6 db rcall .-2100 ; 0x87e <USB_Host_WaitMS>
10b2: 88 23 and r24, r24
10b4: 09 f0 breq .+2 ; 0x10b8 <USB_Host_SendControlRequest+0x36>
10b6: e2 c0 rjmp .+452 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
* \param[in] Token New pipe token to set the selected pipe to, as a \c PIPE_TOKEN_* mask.
*/
static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE;
static inline void Pipe_SetPipeToken(const uint8_t Token)
{
UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token);
10b8: 80 91 aa 00 lds r24, 0x00AA
10bc: 8f 7c andi r24, 0xCF ; 207
10be: 80 93 aa 00 sts 0x00AA, r24
/** Clears the error flags for the currently selected pipe. */
static inline void Pipe_ClearError(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearError(void)
{
UPERRX = 0;
10c2: 10 92 f5 00 sts 0x00F5, r1
UPINTX &= ~(1 << PERRI);
10c6: 80 91 a6 00 lds r24, 0x00A6
10ca: 8f 7e andi r24, 0xEF ; 239
10cc: 80 93 a6 00 sts 0x00A6, r24
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Unfreeze(void)
{
UPCONX &= ~(1 << PFREEZE);
10d0: 80 91 a9 00 lds r24, 0x00A9
10d4: 8f 7b andi r24, 0xBF ; 191
10d6: 80 93 a9 00 sts 0x00A9, r24
Pipe_SetPipeToken(PIPE_TOKEN_SETUP);
Pipe_ClearError();
Pipe_Unfreeze();
Pipe_Write_8(USB_ControlRequest.bmRequestType);
10da: 80 91 23 01 lds r24, 0x0123
* \param[in] Data Data to write into the the currently selected pipe's FIFO buffer.
*/
static inline void Pipe_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_8(const uint8_t Data)
{
UPDATX = Data;
10de: 80 93 af 00 sts 0x00AF, r24
Pipe_Write_8(USB_ControlRequest.bRequest);
10e2: 80 91 24 01 lds r24, 0x0124
10e6: 80 93 af 00 sts 0x00AF, r24
Pipe_Write_16_LE(USB_ControlRequest.wValue);
10ea: 90 91 25 01 lds r25, 0x0125
10ee: 80 91 26 01 lds r24, 0x0126
* \param[in] Data Data to write to the currently selected pipe's FIFO buffer.
*/
static inline void Pipe_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_16_LE(const uint16_t Data)
{
UPDATX = (Data & 0xFF);
10f2: 90 93 af 00 sts 0x00AF, r25
UPDATX = (Data >> 8);
10f6: 80 93 af 00 sts 0x00AF, r24
Pipe_Write_16_LE(USB_ControlRequest.wIndex);
10fa: 90 91 27 01 lds r25, 0x0127
10fe: 80 91 28 01 lds r24, 0x0128
* \param[in] Data Data to write to the currently selected pipe's FIFO buffer.
*/
static inline void Pipe_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_16_LE(const uint16_t Data)
{
UPDATX = (Data & 0xFF);
1102: 90 93 af 00 sts 0x00AF, r25
UPDATX = (Data >> 8);
1106: 80 93 af 00 sts 0x00AF, r24
Pipe_Write_16_LE(USB_ControlRequest.wLength);
110a: 90 91 29 01 lds r25, 0x0129
110e: 80 91 2a 01 lds r24, 0x012A
* \param[in] Data Data to write to the currently selected pipe's FIFO buffer.
*/
static inline void Pipe_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_16_LE(const uint16_t Data)
{
UPDATX = (Data & 0xFF);
1112: 90 93 af 00 sts 0x00AF, r25
UPDATX = (Data >> 8);
1116: 80 93 af 00 sts 0x00AF, r24
* \ingroup Group_PipePacketManagement_AVR8
*/
static inline void Pipe_ClearSETUP(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearSETUP(void)
{
UPINTX &= ~((1 << TXSTPI) | (1 << FIFOCON));
111a: 80 91 a6 00 lds r24, 0x00A6
111e: 87 77 andi r24, 0x77 ; 119
1120: 80 93 a6 00 sts 0x00A6, r24
Pipe_ClearSETUP();
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_SetupSent)) != HOST_SENDCONTROL_Successful)
1124: 80 e0 ldi r24, 0x00 ; 0
1126: 84 df rcall .-248 ; 0x1030 <USB_Host_WaitForIOS>
1128: 88 23 and r24, r24
112a: 09 f0 breq .+2 ; 0x112e <USB_Host_SendControlRequest+0xac>
112c: a7 c0 rjmp .+334 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
/** Freezes the selected pipe, preventing it from communicating with an attached device. */
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Freeze(void)
{
UPCONX |= (1 << PFREEZE);
112e: 80 91 a9 00 lds r24, 0x00A9
1132: 80 64 ori r24, 0x40 ; 64
1134: 80 93 a9 00 sts 0x00A9, r24
goto End_Of_Control_Send;
Pipe_Freeze();
if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
1138: 81 e0 ldi r24, 0x01 ; 1
113a: a1 db rcall .-2238 ; 0x87e <USB_Host_WaitMS>
113c: 88 23 and r24, r24
113e: 09 f0 breq .+2 ; 0x1142 <USB_Host_SendControlRequest+0xc0>
1140: 9d c0 rjmp .+314 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
goto End_Of_Control_Send;
if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_DIRECTION) == REQDIR_DEVICETOHOST)
1142: 80 91 23 01 lds r24, 0x0123
1146: 87 ff sbrs r24, 7
1148: 4f c0 rjmp .+158 ; 0x11e8 <USB_Host_SendControlRequest+0x166>
* \param[in] Token New pipe token to set the selected pipe to, as a \c PIPE_TOKEN_* mask.
*/
static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE;
static inline void Pipe_SetPipeToken(const uint8_t Token)
{
UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token);
114a: 80 91 aa 00 lds r24, 0x00AA
114e: 8f 7c andi r24, 0xCF ; 207
1150: 80 61 ori r24, 0x10 ; 16
1152: 80 93 aa 00 sts 0x00AA, r24
{
Pipe_SetPipeToken(PIPE_TOKEN_IN);
if (DataStream != NULL)
1156: 01 15 cp r16, r1
1158: 11 05 cpc r17, r1
115a: 61 f5 brne .+88 ; 0x11b4 <USB_Host_SendControlRequest+0x132>
115c: 2d c0 rjmp .+90 ; 0x11b8 <USB_Host_SendControlRequest+0x136>
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Unfreeze(void)
{
UPCONX &= ~(1 << PFREEZE);
115e: 80 91 a9 00 lds r24, 0x00A9
1162: 8f 7b andi r24, 0xBF ; 191
1164: 80 93 a9 00 sts 0x00A9, r24
{
while (DataLen)
{
Pipe_Unfreeze();
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful)
1168: 81 e0 ldi r24, 0x01 ; 1
116a: 62 df rcall .-316 ; 0x1030 <USB_Host_WaitForIOS>
116c: 88 23 and r24, r24
116e: 09 f0 breq .+2 ; 0x1172 <USB_Host_SendControlRequest+0xf0>
1170: 85 c0 rjmp .+266 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
* \return Total number of bytes in the currently selected pipe's FIFO buffer.
*/
static inline uint16_t Pipe_BytesInPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_BytesInPipe(void)
{
return UPBCX;
1172: 80 91 f6 00 lds r24, 0x00F6
1176: 90 91 f7 00 lds r25, 0x00F7
goto End_Of_Control_Send;
if (!(Pipe_BytesInPipe()))
117a: 00 97 sbiw r24, 0x00 ; 0
117c: 49 f4 brne .+18 ; 0x1190 <USB_Host_SendControlRequest+0x10e>
DataLen = 0;
117e: c0 e0 ldi r28, 0x00 ; 0
1180: d0 e0 ldi r29, 0x00 ; 0
1182: 06 c0 rjmp .+12 ; 0x1190 <USB_Host_SendControlRequest+0x10e>
* \return Next byte in the currently selected pipe's FIFO buffer.
*/
static inline uint8_t Pipe_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_Read_8(void)
{
return UPDATX;
1184: 80 91 af 00 lds r24, 0x00AF
while (Pipe_BytesInPipe() && DataLen)
{
*(DataStream++) = Pipe_Read_8();
1188: f8 01 movw r30, r16
118a: 81 93 st Z+, r24
118c: 8f 01 movw r16, r30
DataLen--;
118e: 21 97 sbiw r28, 0x01 ; 1
* \return Total number of bytes in the currently selected pipe's FIFO buffer.
*/
static inline uint16_t Pipe_BytesInPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_BytesInPipe(void)
{
return UPBCX;
1190: 80 91 f6 00 lds r24, 0x00F6
1194: 90 91 f7 00 lds r25, 0x00F7
goto End_Of_Control_Send;
if (!(Pipe_BytesInPipe()))
DataLen = 0;
while (Pipe_BytesInPipe() && DataLen)
1198: 00 97 sbiw r24, 0x00 ; 0
119a: 11 f0 breq .+4 ; 0x11a0 <USB_Host_SendControlRequest+0x11e>
119c: 20 97 sbiw r28, 0x00 ; 0
119e: 91 f7 brne .-28 ; 0x1184 <USB_Host_SendControlRequest+0x102>
/** Freezes the selected pipe, preventing it from communicating with an attached device. */
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Freeze(void)
{
UPCONX |= (1 << PFREEZE);
11a0: 80 91 a9 00 lds r24, 0x00A9
11a4: 80 64 ori r24, 0x40 ; 64
11a6: 80 93 a9 00 sts 0x00A9, r24
* \ingroup Group_PipePacketManagement_AVR8
*/
static inline void Pipe_ClearIN(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearIN(void)
{
UPINTX &= ~((1 << RXINI) | (1 << FIFOCON));
11aa: 80 91 a6 00 lds r24, 0x00A6
11ae: 8e 77 andi r24, 0x7E ; 126
11b0: 80 93 a6 00 sts 0x00A6, r24
{
Pipe_SetPipeToken(PIPE_TOKEN_IN);
if (DataStream != NULL)
{
while (DataLen)
11b4: 20 97 sbiw r28, 0x00 ; 0
11b6: 99 f6 brne .-90 ; 0x115e <USB_Host_SendControlRequest+0xdc>
* \param[in] Token New pipe token to set the selected pipe to, as a \c PIPE_TOKEN_* mask.
*/
static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE;
static inline void Pipe_SetPipeToken(const uint8_t Token)
{
UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token);
11b8: 80 91 aa 00 lds r24, 0x00AA
11bc: 8f 7c andi r24, 0xCF ; 207
11be: 80 62 ori r24, 0x20 ; 32
11c0: 80 93 aa 00 sts 0x00AA, r24
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Unfreeze(void)
{
UPCONX &= ~(1 << PFREEZE);
11c4: 80 91 a9 00 lds r24, 0x00A9
11c8: 8f 7b andi r24, 0xBF ; 191
11ca: 80 93 a9 00 sts 0x00A9, r24
}
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
Pipe_Unfreeze();
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
11ce: 82 e0 ldi r24, 0x02 ; 2
11d0: 2f df rcall .-418 ; 0x1030 <USB_Host_WaitForIOS>
11d2: 88 23 and r24, r24
11d4: 09 f0 breq .+2 ; 0x11d8 <USB_Host_SendControlRequest+0x156>
11d6: 52 c0 rjmp .+164 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
* \ingroup Group_PipePacketManagement_AVR8
*/
static inline void Pipe_ClearOUT(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearOUT(void)
{
UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON));
11d8: 80 91 a6 00 lds r24, 0x00A6
11dc: 8b 77 andi r24, 0x7B ; 123
11de: 80 93 a6 00 sts 0x00A6, r24
goto End_Of_Control_Send;
Pipe_ClearOUT();
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
11e2: 82 e0 ldi r24, 0x02 ; 2
11e4: 25 df rcall .-438 ; 0x1030 <USB_Host_WaitForIOS>
11e6: 4a c0 rjmp .+148 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
goto End_Of_Control_Send;
}
else
{
if (DataStream != NULL)
11e8: 01 15 cp r16, r1
11ea: 11 05 cpc r17, r1
11ec: 99 f1 breq .+102 ; 0x1254 <USB_Host_SendControlRequest+0x1d2>
* \param[in] Token New pipe token to set the selected pipe to, as a \c PIPE_TOKEN_* mask.
*/
static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE;
static inline void Pipe_SetPipeToken(const uint8_t Token)
{
UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token);
11ee: 80 91 aa 00 lds r24, 0x00AA
11f2: 8f 7c andi r24, 0xCF ; 207
11f4: 80 62 ori r24, 0x20 ; 32
11f6: 80 93 aa 00 sts 0x00AA, r24
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Unfreeze(void)
{
UPCONX &= ~(1 << PFREEZE);
11fa: 80 91 a9 00 lds r24, 0x00A9
11fe: 8f 7b andi r24, 0xBF ; 191
1200: 80 93 a9 00 sts 0x00A9, r24
{
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
Pipe_Unfreeze();
while (DataLen)
1204: 1c c0 rjmp .+56 ; 0x123e <USB_Host_SendControlRequest+0x1bc>
{
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
1206: 82 e0 ldi r24, 0x02 ; 2
1208: 13 df rcall .-474 ; 0x1030 <USB_Host_WaitForIOS>
120a: 88 23 and r24, r24
120c: b9 f5 brne .+110 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
120e: f8 01 movw r30, r16
1210: 06 c0 rjmp .+12 ; 0x121e <USB_Host_SendControlRequest+0x19c>
goto End_Of_Control_Send;
while (DataLen && (Pipe_BytesInPipe() < USB_ControlPipeSize))
{
Pipe_Write_8(*(DataStream++));
1212: 81 91 ld r24, Z+
1214: 8f 01 movw r16, r30
* \param[in] Data Data to write into the the currently selected pipe's FIFO buffer.
*/
static inline void Pipe_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE;
static inline void Pipe_Write_8(const uint8_t Data)
{
UPDATX = Data;
1216: 80 93 af 00 sts 0x00AF, r24
DataLen--;
121a: 21 97 sbiw r28, 0x01 ; 1
while (DataLen)
{
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
goto End_Of_Control_Send;
while (DataLen && (Pipe_BytesInPipe() < USB_ControlPipeSize))
121c: 59 f0 breq .+22 ; 0x1234 <USB_Host_SendControlRequest+0x1b2>
121e: 8f 01 movw r16, r30
* \return Total number of bytes in the currently selected pipe's FIFO buffer.
*/
static inline uint16_t Pipe_BytesInPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_BytesInPipe(void)
{
return UPBCX;
1220: 20 91 f6 00 lds r18, 0x00F6
1224: 30 91 f7 00 lds r19, 0x00F7
1228: 80 91 1b 01 lds r24, 0x011B
122c: 90 e0 ldi r25, 0x00 ; 0
122e: 28 17 cp r18, r24
1230: 39 07 cpc r19, r25
1232: 78 f3 brcs .-34 ; 0x1212 <USB_Host_SendControlRequest+0x190>
* \ingroup Group_PipePacketManagement_AVR8
*/
static inline void Pipe_ClearOUT(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearOUT(void)
{
UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON));
1234: 80 91 a6 00 lds r24, 0x00A6
1238: 8b 77 andi r24, 0x7B ; 123
123a: 80 93 a6 00 sts 0x00A6, r24
if (DataStream != NULL)
{
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
Pipe_Unfreeze();
while (DataLen)
123e: 20 97 sbiw r28, 0x00 ; 0
1240: 11 f7 brne .-60 ; 0x1206 <USB_Host_SendControlRequest+0x184>
}
Pipe_ClearOUT();
}
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
1242: 82 e0 ldi r24, 0x02 ; 2
1244: f5 de rcall .-534 ; 0x1030 <USB_Host_WaitForIOS>
1246: 88 23 and r24, r24
1248: c9 f4 brne .+50 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
/** Freezes the selected pipe, preventing it from communicating with an attached device. */
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Freeze(void)
{
UPCONX |= (1 << PFREEZE);
124a: 80 91 a9 00 lds r24, 0x00A9
124e: 80 64 ori r24, 0x40 ; 64
1250: 80 93 a9 00 sts 0x00A9, r24
* \param[in] Token New pipe token to set the selected pipe to, as a \c PIPE_TOKEN_* mask.
*/
static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE;
static inline void Pipe_SetPipeToken(const uint8_t Token)
{
UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token);
1254: 80 91 aa 00 lds r24, 0x00AA
1258: 8f 7c andi r24, 0xCF ; 207
125a: 80 61 ori r24, 0x10 ; 16
125c: 80 93 aa 00 sts 0x00AA, r24
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Unfreeze(void)
{
UPCONX &= ~(1 << PFREEZE);
1260: 80 91 a9 00 lds r24, 0x00A9
1264: 8f 7b andi r24, 0xBF ; 191
1266: 80 93 a9 00 sts 0x00A9, r24
}
Pipe_SetPipeToken(PIPE_TOKEN_IN);
Pipe_Unfreeze();
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful)
126a: 81 e0 ldi r24, 0x01 ; 1
126c: e1 de rcall .-574 ; 0x1030 <USB_Host_WaitForIOS>
126e: 88 23 and r24, r24
1270: 29 f4 brne .+10 ; 0x127c <USB_Host_SendControlRequest+0x1fa>
* \ingroup Group_PipePacketManagement_AVR8
*/
static inline void Pipe_ClearIN(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearIN(void)
{
UPINTX &= ~((1 << RXINI) | (1 << FIFOCON));
1272: 90 91 a6 00 lds r25, 0x00A6
1276: 9e 77 andi r25, 0x7E ; 126
1278: 90 93 a6 00 sts 0x00A6, r25
/** Freezes the selected pipe, preventing it from communicating with an attached device. */
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Freeze(void)
{
UPCONX |= (1 << PFREEZE);
127c: 90 91 a9 00 lds r25, 0x00A9
1280: 90 64 ori r25, 0x40 ; 64
1282: 90 93 a9 00 sts 0x00A9, r25
}
End_Of_Control_Send:
Pipe_Freeze();
if (BusSuspended)
1286: e1 14 cp r14, r1
1288: f1 04 cpc r15, r1
128a: 29 f4 brne .+10 ; 0x1296 <USB_Host_SendControlRequest+0x214>
* messages to the device.
*/
static inline void USB_Host_SuspendBus(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_SuspendBus(void)
{
UHCON &= ~(1 << SOFEN);
128c: 90 91 9e 00 lds r25, 0x009E
1290: 9e 7f andi r25, 0xFE ; 254
1292: 90 93 9e 00 sts 0x009E, r25
* \param[in] PipeNumber Index of the pipe to reset.
*/
static inline void Pipe_ResetPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_ResetPipe(const uint8_t PipeNumber)
{
UPRST = (1 << PipeNumber);
1296: 91 e0 ldi r25, 0x01 ; 1
1298: 90 93 a8 00 sts 0x00A8, r25
UPRST = 0;
129c: 10 92 a8 00 sts 0x00A8, r1
USB_Host_SuspendBus();
Pipe_ResetPipe(PIPE_CONTROLPIPE);
return ReturnStatus;
}
12a0: df 91 pop r29
12a2: cf 91 pop r28
12a4: 1f 91 pop r17
12a6: 0f 91 pop r16
12a8: ff 90 pop r15
12aa: ef 90 pop r14
12ac: 08 95 ret
000012ae <USB_USBTask>:
#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR)
volatile uint8_t USB_DeviceState;
#endif
void USB_USBTask(void)
{
12ae: 1f 93 push r17
12b0: cf 93 push r28
12b2: df 93 push r29
* \return Index of the currently selected pipe.
*/
static inline uint8_t Pipe_GetCurrentPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetCurrentPipe(void)
{
return (UPNUM & PIPE_PIPENUM_MASK);
12b4: c7 ea ldi r28, 0xA7 ; 167
12b6: d0 e0 ldi r29, 0x00 ; 0
12b8: 18 81 ld r17, Y
12ba: 17 70 andi r17, 0x07 ; 7
* \param[in] PipeNumber Index of the pipe to select.
*/
static inline void Pipe_SelectPipe(const uint8_t PipeNumber) ATTR_ALWAYS_INLINE;
static inline void Pipe_SelectPipe(const uint8_t PipeNumber)
{
UPNUM = PipeNumber;
12bc: 18 82 st Y, r1
{
uint8_t PrevPipe = Pipe_GetCurrentPipe();
Pipe_SelectPipe(PIPE_CONTROLPIPE);
USB_Host_ProcessNextHostState();
12be: 34 db rcall .-2456 ; 0x928 <USB_Host_ProcessNextHostState>
12c0: 18 83 st Y, r17
if (USB_CurrentMode == USB_MODE_Device)
USB_DeviceTask();
else if (USB_CurrentMode == USB_MODE_Host)
USB_HostTask();
#endif
}
12c2: df 91 pop r29
12c4: cf 91 pop r28
12c6: 1f 91 pop r17
12c8: 08 95 ret
000012ca <Serial_putchar>:
* \param[in] DataByte Byte to transmit through the USART.
*/
static inline void Serial_SendByte(const char DataByte) ATTR_ALWAYS_INLINE;
static inline void Serial_SendByte(const char DataByte)
{
while (!(UCSR1A & (1 << UDRE1)));
12ca: 90 91 c8 00 lds r25, 0x00C8
12ce: 95 ff sbrs r25, 5
12d0: fc cf rjmp .-8 ; 0x12ca <Serial_putchar>
UDR1 = DataByte;
12d2: 80 93 ce 00 sts 0x00CE, r24
{
(void)Stream;
Serial_SendByte(DataByte);
return 0;
}
12d6: 80 e0 ldi r24, 0x00 ; 0
12d8: 90 e0 ldi r25, 0x00 ; 0
12da: 08 95 ret
000012dc <Serial_getchar>:
* \return Boolean \c true if a character has been received, \c false otherwise.
*/
static inline bool Serial_IsCharReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool Serial_IsCharReceived(void)
{
return ((UCSR1A & (1 << RXC1)) ? true : false);
12dc: 80 91 c8 00 lds r24, 0x00C8
int Serial_getchar(FILE *Stream)
{
(void)Stream;
if (!(Serial_IsCharReceived()))
12e0: 87 ff sbrs r24, 7
12e2: 08 c0 rjmp .+16 ; 0x12f4 <Serial_getchar+0x18>
12e4: 80 91 c8 00 lds r24, 0x00C8
* \return Next byte received from the USART, or a negative value if no byte has been received.
*/
static inline int16_t Serial_ReceiveByte(void) ATTR_ALWAYS_INLINE;
static inline int16_t Serial_ReceiveByte(void)
{
if (!(Serial_IsCharReceived()))
12e8: 87 ff sbrs r24, 7
12ea: 07 c0 rjmp .+14 ; 0x12fa <Serial_getchar+0x1e>
return -1;
return UDR1;
12ec: 20 91 ce 00 lds r18, 0x00CE
12f0: 30 e0 ldi r19, 0x00 ; 0
12f2: 05 c0 rjmp .+10 ; 0x12fe <Serial_getchar+0x22>
return _FDEV_EOF;
12f4: 2e ef ldi r18, 0xFE ; 254
12f6: 3f ef ldi r19, 0xFF ; 255
12f8: 02 c0 rjmp .+4 ; 0x12fe <Serial_getchar+0x22>
*/
static inline int16_t Serial_ReceiveByte(void) ATTR_ALWAYS_INLINE;
static inline int16_t Serial_ReceiveByte(void)
{
if (!(Serial_IsCharReceived()))
return -1;
12fa: 2f ef ldi r18, 0xFF ; 255
12fc: 3f ef ldi r19, 0xFF ; 255
return Serial_ReceiveByte();
}
12fe: c9 01 movw r24, r18
1300: 08 95 ret
00001302 <printf_P>:
1302: df 93 push r29
1304: cf 93 push r28
1306: cd b7 in r28, 0x3d ; 61
1308: de b7 in r29, 0x3e ; 62
130a: fe 01 movw r30, r28
130c: 35 96 adiw r30, 0x05 ; 5
130e: 61 91 ld r22, Z+
1310: 71 91 ld r23, Z+
1312: 80 91 3c 01 lds r24, 0x013C
1316: 90 91 3d 01 lds r25, 0x013D
131a: dc 01 movw r26, r24
131c: 13 96 adiw r26, 0x03 ; 3
131e: 2c 91 ld r18, X
1320: 13 97 sbiw r26, 0x03 ; 3
1322: 28 60 ori r18, 0x08 ; 8
1324: 13 96 adiw r26, 0x03 ; 3
1326: 2c 93 st X, r18
1328: af 01 movw r20, r30
132a: 42 d0 rcall .+132 ; 0x13b0 <vfprintf>
132c: e0 91 3c 01 lds r30, 0x013C
1330: f0 91 3d 01 lds r31, 0x013D
1334: 23 81 ldd r18, Z+3 ; 0x03
1336: 27 7f andi r18, 0xF7 ; 247
1338: 23 83 std Z+3, r18 ; 0x03
133a: cf 91 pop r28
133c: df 91 pop r29
133e: 08 95 ret
00001340 <puts_P>:
1340: ef 92 push r14
1342: ff 92 push r15
1344: 0f 93 push r16
1346: 1f 93 push r17
1348: cf 93 push r28
134a: df 93 push r29
134c: 8c 01 movw r16, r24
134e: e0 91 3c 01 lds r30, 0x013C
1352: f0 91 3d 01 lds r31, 0x013D
1356: 83 81 ldd r24, Z+3 ; 0x03
1358: 81 ff sbrs r24, 1
135a: 20 c0 rjmp .+64 ; 0x139c <puts_P+0x5c>
135c: c0 e0 ldi r28, 0x00 ; 0
135e: d0 e0 ldi r29, 0x00 ; 0
1360: 0c c0 rjmp .+24 ; 0x137a <puts_P+0x3a>
1362: db 01 movw r26, r22
1364: 18 96 adiw r26, 0x08 ; 8
1366: ed 91 ld r30, X+
1368: fc 91 ld r31, X
136a: 19 97 sbiw r26, 0x09 ; 9
136c: 09 95 icall
136e: 00 97 sbiw r24, 0x00 ; 0
1370: 11 f0 breq .+4 ; 0x1376 <puts_P+0x36>
1372: cf ef ldi r28, 0xFF ; 255
1374: df ef ldi r29, 0xFF ; 255
1376: 0f 5f subi r16, 0xFF ; 255
1378: 1f 4f sbci r17, 0xFF ; 255
137a: f8 01 movw r30, r16
137c: 84 91 lpm r24, Z+
137e: 60 91 3c 01 lds r22, 0x013C
1382: 70 91 3d 01 lds r23, 0x013D
1386: 88 23 and r24, r24
1388: 61 f7 brne .-40 ; 0x1362 <puts_P+0x22>
138a: db 01 movw r26, r22
138c: 18 96 adiw r26, 0x08 ; 8
138e: ed 91 ld r30, X+
1390: fc 91 ld r31, X
1392: 19 97 sbiw r26, 0x09 ; 9
1394: 8a e0 ldi r24, 0x0A ; 10
1396: 09 95 icall
1398: 00 97 sbiw r24, 0x00 ; 0
139a: 11 f0 breq .+4 ; 0x13a0 <puts_P+0x60>
139c: cf ef ldi r28, 0xFF ; 255
139e: df ef ldi r29, 0xFF ; 255
13a0: ce 01 movw r24, r28
13a2: df 91 pop r29
13a4: cf 91 pop r28
13a6: 1f 91 pop r17
13a8: 0f 91 pop r16
13aa: ff 90 pop r15
13ac: ef 90 pop r14
13ae: 08 95 ret
000013b0 <vfprintf>:
13b0: 2f 92 push r2
13b2: 3f 92 push r3
13b4: 4f 92 push r4
13b6: 5f 92 push r5
13b8: 6f 92 push r6
13ba: 7f 92 push r7
13bc: 8f 92 push r8
13be: 9f 92 push r9
13c0: af 92 push r10
13c2: bf 92 push r11
13c4: cf 92 push r12
13c6: df 92 push r13
13c8: ef 92 push r14
13ca: ff 92 push r15
13cc: 0f 93 push r16
13ce: 1f 93 push r17
13d0: df 93 push r29
13d2: cf 93 push r28
13d4: cd b7 in r28, 0x3d ; 61
13d6: de b7 in r29, 0x3e ; 62
13d8: 2c 97 sbiw r28, 0x0c ; 12
13da: 0f b6 in r0, 0x3f ; 63
13dc: f8 94 cli
13de: de bf out 0x3e, r29 ; 62
13e0: 0f be out 0x3f, r0 ; 63
13e2: cd bf out 0x3d, r28 ; 61
13e4: 6c 01 movw r12, r24
13e6: 1b 01 movw r2, r22
13e8: 8a 01 movw r16, r20
13ea: fc 01 movw r30, r24
13ec: 17 82 std Z+7, r1 ; 0x07
13ee: 16 82 std Z+6, r1 ; 0x06
13f0: 83 81 ldd r24, Z+3 ; 0x03
13f2: 81 ff sbrs r24, 1
13f4: c4 c1 rjmp .+904 ; 0x177e <vfprintf+0x3ce>
13f6: 2e 01 movw r4, r28
13f8: 08 94 sec
13fa: 41 1c adc r4, r1
13fc: 51 1c adc r5, r1
13fe: f6 01 movw r30, r12
1400: 93 81 ldd r25, Z+3 ; 0x03
1402: f1 01 movw r30, r2
1404: 93 fd sbrc r25, 3
1406: 85 91 lpm r24, Z+
1408: 93 ff sbrs r25, 3
140a: 81 91 ld r24, Z+
140c: 1f 01 movw r2, r30
140e: 88 23 and r24, r24
1410: 09 f4 brne .+2 ; 0x1414 <vfprintf+0x64>
1412: b1 c1 rjmp .+866 ; 0x1776 <vfprintf+0x3c6>
1414: 85 32 cpi r24, 0x25 ; 37
1416: 39 f4 brne .+14 ; 0x1426 <vfprintf+0x76>
1418: 93 fd sbrc r25, 3
141a: 85 91 lpm r24, Z+
141c: 93 ff sbrs r25, 3
141e: 81 91 ld r24, Z+
1420: 1f 01 movw r2, r30
1422: 85 32 cpi r24, 0x25 ; 37
1424: 21 f4 brne .+8 ; 0x142e <vfprintf+0x7e>
1426: 90 e0 ldi r25, 0x00 ; 0
1428: b6 01 movw r22, r12
142a: db d1 rcall .+950 ; 0x17e2 <fputc>
142c: e8 cf rjmp .-48 ; 0x13fe <vfprintf+0x4e>
142e: ee 24 eor r14, r14
1430: ff 24 eor r15, r15
1432: 20 e0 ldi r18, 0x00 ; 0
1434: 20 32 cpi r18, 0x20 ; 32
1436: b0 f4 brcc .+44 ; 0x1464 <vfprintf+0xb4>
1438: 8b 32 cpi r24, 0x2B ; 43
143a: 69 f0 breq .+26 ; 0x1456 <vfprintf+0xa6>
143c: 8c 32 cpi r24, 0x2C ; 44
143e: 28 f4 brcc .+10 ; 0x144a <vfprintf+0x9a>
1440: 80 32 cpi r24, 0x20 ; 32
1442: 51 f0 breq .+20 ; 0x1458 <vfprintf+0xa8>
1444: 83 32 cpi r24, 0x23 ; 35
1446: 71 f4 brne .+28 ; 0x1464 <vfprintf+0xb4>
1448: 0b c0 rjmp .+22 ; 0x1460 <vfprintf+0xb0>
144a: 8d 32 cpi r24, 0x2D ; 45
144c: 39 f0 breq .+14 ; 0x145c <vfprintf+0xac>
144e: 80 33 cpi r24, 0x30 ; 48
1450: 49 f4 brne .+18 ; 0x1464 <vfprintf+0xb4>
1452: 21 60 ori r18, 0x01 ; 1
1454: 2c c0 rjmp .+88 ; 0x14ae <vfprintf+0xfe>
1456: 22 60 ori r18, 0x02 ; 2
1458: 24 60 ori r18, 0x04 ; 4
145a: 29 c0 rjmp .+82 ; 0x14ae <vfprintf+0xfe>
145c: 28 60 ori r18, 0x08 ; 8
145e: 27 c0 rjmp .+78 ; 0x14ae <vfprintf+0xfe>
1460: 20 61 ori r18, 0x10 ; 16
1462: 25 c0 rjmp .+74 ; 0x14ae <vfprintf+0xfe>
1464: 27 fd sbrc r18, 7
1466: 2c c0 rjmp .+88 ; 0x14c0 <vfprintf+0x110>
1468: 38 2f mov r19, r24
146a: 30 53 subi r19, 0x30 ; 48
146c: 3a 30 cpi r19, 0x0A ; 10
146e: 98 f4 brcc .+38 ; 0x1496 <vfprintf+0xe6>
1470: 26 ff sbrs r18, 6
1472: 08 c0 rjmp .+16 ; 0x1484 <vfprintf+0xd4>
1474: 8e 2d mov r24, r14
1476: 88 0f add r24, r24
1478: e8 2e mov r14, r24
147a: ee 0c add r14, r14
147c: ee 0c add r14, r14
147e: e8 0e add r14, r24
1480: e3 0e add r14, r19
1482: 15 c0 rjmp .+42 ; 0x14ae <vfprintf+0xfe>
1484: 8f 2d mov r24, r15
1486: 88 0f add r24, r24
1488: f8 2e mov r15, r24
148a: ff 0c add r15, r15
148c: ff 0c add r15, r15
148e: f8 0e add r15, r24
1490: f3 0e add r15, r19
1492: 20 62 ori r18, 0x20 ; 32
1494: 0c c0 rjmp .+24 ; 0x14ae <vfprintf+0xfe>
1496: 8e 32 cpi r24, 0x2E ; 46
1498: 21 f4 brne .+8 ; 0x14a2 <vfprintf+0xf2>
149a: 26 fd sbrc r18, 6
149c: 6c c1 rjmp .+728 ; 0x1776 <vfprintf+0x3c6>
149e: 20 64 ori r18, 0x40 ; 64
14a0: 06 c0 rjmp .+12 ; 0x14ae <vfprintf+0xfe>
14a2: 8c 36 cpi r24, 0x6C ; 108
14a4: 11 f4 brne .+4 ; 0x14aa <vfprintf+0xfa>
14a6: 20 68 ori r18, 0x80 ; 128
14a8: 02 c0 rjmp .+4 ; 0x14ae <vfprintf+0xfe>
14aa: 88 36 cpi r24, 0x68 ; 104
14ac: 49 f4 brne .+18 ; 0x14c0 <vfprintf+0x110>
14ae: f1 01 movw r30, r2
14b0: 93 fd sbrc r25, 3
14b2: 85 91 lpm r24, Z+
14b4: 93 ff sbrs r25, 3
14b6: 81 91 ld r24, Z+
14b8: 1f 01 movw r2, r30
14ba: 88 23 and r24, r24
14bc: 09 f0 breq .+2 ; 0x14c0 <vfprintf+0x110>
14be: ba cf rjmp .-140 ; 0x1434 <vfprintf+0x84>
14c0: 98 2f mov r25, r24
14c2: 95 54 subi r25, 0x45 ; 69
14c4: 93 30 cpi r25, 0x03 ; 3
14c6: 18 f0 brcs .+6 ; 0x14ce <vfprintf+0x11e>
14c8: 90 52 subi r25, 0x20 ; 32
14ca: 93 30 cpi r25, 0x03 ; 3
14cc: 28 f4 brcc .+10 ; 0x14d8 <vfprintf+0x128>
14ce: 0c 5f subi r16, 0xFC ; 252
14d0: 1f 4f sbci r17, 0xFF ; 255
14d2: ff e3 ldi r31, 0x3F ; 63
14d4: f9 83 std Y+1, r31 ; 0x01
14d6: 0d c0 rjmp .+26 ; 0x14f2 <vfprintf+0x142>
14d8: 83 36 cpi r24, 0x63 ; 99
14da: 31 f0 breq .+12 ; 0x14e8 <vfprintf+0x138>
14dc: 83 37 cpi r24, 0x73 ; 115
14de: 71 f0 breq .+28 ; 0x14fc <vfprintf+0x14c>
14e0: 83 35 cpi r24, 0x53 ; 83
14e2: 09 f0 breq .+2 ; 0x14e6 <vfprintf+0x136>
14e4: 5c c0 rjmp .+184 ; 0x159e <vfprintf+0x1ee>
14e6: 21 c0 rjmp .+66 ; 0x152a <vfprintf+0x17a>
14e8: f8 01 movw r30, r16
14ea: 80 81 ld r24, Z
14ec: 89 83 std Y+1, r24 ; 0x01
14ee: 0e 5f subi r16, 0xFE ; 254
14f0: 1f 4f sbci r17, 0xFF ; 255
14f2: 42 01 movw r8, r4
14f4: 71 e0 ldi r23, 0x01 ; 1
14f6: a7 2e mov r10, r23
14f8: b1 2c mov r11, r1
14fa: 15 c0 rjmp .+42 ; 0x1526 <vfprintf+0x176>
14fc: 62 e0 ldi r22, 0x02 ; 2
14fe: 66 2e mov r6, r22
1500: 71 2c mov r7, r1
1502: 60 0e add r6, r16
1504: 71 1e adc r7, r17
1506: f8 01 movw r30, r16
1508: 80 80 ld r8, Z
150a: 91 80 ldd r9, Z+1 ; 0x01
150c: 26 ff sbrs r18, 6
150e: 03 c0 rjmp .+6 ; 0x1516 <vfprintf+0x166>
1510: 6e 2d mov r22, r14
1512: 70 e0 ldi r23, 0x00 ; 0
1514: 02 c0 rjmp .+4 ; 0x151a <vfprintf+0x16a>
1516: 6f ef ldi r22, 0xFF ; 255
1518: 7f ef ldi r23, 0xFF ; 255
151a: c4 01 movw r24, r8
151c: 2c 87 std Y+12, r18 ; 0x0c
151e: 56 d1 rcall .+684 ; 0x17cc <strnlen>
1520: 5c 01 movw r10, r24
1522: 83 01 movw r16, r6
1524: 2c 85 ldd r18, Y+12 ; 0x0c
1526: 2f 77 andi r18, 0x7F ; 127
1528: 16 c0 rjmp .+44 ; 0x1556 <vfprintf+0x1a6>
152a: 52 e0 ldi r21, 0x02 ; 2
152c: 65 2e mov r6, r21
152e: 71 2c mov r7, r1
1530: 60 0e add r6, r16
1532: 71 1e adc r7, r17
1534: f8 01 movw r30, r16
1536: 80 80 ld r8, Z
1538: 91 80 ldd r9, Z+1 ; 0x01
153a: 26 ff sbrs r18, 6
153c: 03 c0 rjmp .+6 ; 0x1544 <vfprintf+0x194>
153e: 6e 2d mov r22, r14
1540: 70 e0 ldi r23, 0x00 ; 0
1542: 02 c0 rjmp .+4 ; 0x1548 <vfprintf+0x198>
1544: 6f ef ldi r22, 0xFF ; 255
1546: 7f ef ldi r23, 0xFF ; 255
1548: c4 01 movw r24, r8
154a: 2c 87 std Y+12, r18 ; 0x0c
154c: 34 d1 rcall .+616 ; 0x17b6 <strnlen_P>
154e: 5c 01 movw r10, r24
1550: 2c 85 ldd r18, Y+12 ; 0x0c
1552: 20 68 ori r18, 0x80 ; 128
1554: 83 01 movw r16, r6
1556: 23 fd sbrc r18, 3
1558: 1e c0 rjmp .+60 ; 0x1596 <vfprintf+0x1e6>
155a: 07 c0 rjmp .+14 ; 0x156a <vfprintf+0x1ba>
155c: 80 e2 ldi r24, 0x20 ; 32
155e: 90 e0 ldi r25, 0x00 ; 0
1560: b6 01 movw r22, r12
1562: 2c 87 std Y+12, r18 ; 0x0c
1564: 3e d1 rcall .+636 ; 0x17e2 <fputc>
1566: fa 94 dec r15
1568: 2c 85 ldd r18, Y+12 ; 0x0c
156a: 8f 2d mov r24, r15
156c: 90 e0 ldi r25, 0x00 ; 0
156e: a8 16 cp r10, r24
1570: b9 06 cpc r11, r25
1572: a0 f3 brcs .-24 ; 0x155c <vfprintf+0x1ac>
1574: 10 c0 rjmp .+32 ; 0x1596 <vfprintf+0x1e6>
1576: f4 01 movw r30, r8
1578: 27 fd sbrc r18, 7
157a: 85 91 lpm r24, Z+
157c: 27 ff sbrs r18, 7
157e: 81 91 ld r24, Z+
1580: 4f 01 movw r8, r30
1582: 90 e0 ldi r25, 0x00 ; 0
1584: b6 01 movw r22, r12
1586: 2c 87 std Y+12, r18 ; 0x0c
1588: 2c d1 rcall .+600 ; 0x17e2 <fputc>
158a: 2c 85 ldd r18, Y+12 ; 0x0c
158c: f1 10 cpse r15, r1
158e: fa 94 dec r15
1590: 08 94 sec
1592: a1 08 sbc r10, r1
1594: b1 08 sbc r11, r1
1596: a1 14 cp r10, r1
1598: b1 04 cpc r11, r1
159a: 69 f7 brne .-38 ; 0x1576 <vfprintf+0x1c6>
159c: e9 c0 rjmp .+466 ; 0x1770 <vfprintf+0x3c0>
159e: 84 36 cpi r24, 0x64 ; 100
15a0: 11 f0 breq .+4 ; 0x15a6 <vfprintf+0x1f6>
15a2: 89 36 cpi r24, 0x69 ; 105
15a4: 41 f5 brne .+80 ; 0x15f6 <vfprintf+0x246>
15a6: 27 ff sbrs r18, 7
15a8: 08 c0 rjmp .+16 ; 0x15ba <vfprintf+0x20a>
15aa: f8 01 movw r30, r16
15ac: 60 81 ld r22, Z
15ae: 71 81 ldd r23, Z+1 ; 0x01
15b0: 82 81 ldd r24, Z+2 ; 0x02
15b2: 93 81 ldd r25, Z+3 ; 0x03
15b4: 0c 5f subi r16, 0xFC ; 252
15b6: 1f 4f sbci r17, 0xFF ; 255
15b8: 09 c0 rjmp .+18 ; 0x15cc <vfprintf+0x21c>
15ba: f8 01 movw r30, r16
15bc: 60 81 ld r22, Z
15be: 71 81 ldd r23, Z+1 ; 0x01
15c0: 88 27 eor r24, r24
15c2: 77 fd sbrc r23, 7
15c4: 80 95 com r24
15c6: 98 2f mov r25, r24
15c8: 0e 5f subi r16, 0xFE ; 254
15ca: 1f 4f sbci r17, 0xFF ; 255
15cc: 4f e6 ldi r20, 0x6F ; 111
15ce: b4 2e mov r11, r20
15d0: b2 22 and r11, r18
15d2: 97 ff sbrs r25, 7
15d4: 09 c0 rjmp .+18 ; 0x15e8 <vfprintf+0x238>
15d6: 90 95 com r25
15d8: 80 95 com r24
15da: 70 95 com r23
15dc: 61 95 neg r22
15de: 7f 4f sbci r23, 0xFF ; 255
15e0: 8f 4f sbci r24, 0xFF ; 255
15e2: 9f 4f sbci r25, 0xFF ; 255
15e4: f0 e8 ldi r31, 0x80 ; 128
15e6: bf 2a or r11, r31
15e8: a2 01 movw r20, r4
15ea: 2a e0 ldi r18, 0x0A ; 10
15ec: 30 e0 ldi r19, 0x00 ; 0
15ee: 25 d1 rcall .+586 ; 0x183a <__ultoa_invert>
15f0: 78 2e mov r7, r24
15f2: 74 18 sub r7, r4
15f4: 44 c0 rjmp .+136 ; 0x167e <vfprintf+0x2ce>
15f6: 85 37 cpi r24, 0x75 ; 117
15f8: 31 f4 brne .+12 ; 0x1606 <vfprintf+0x256>
15fa: 3f ee ldi r19, 0xEF ; 239
15fc: b3 2e mov r11, r19
15fe: b2 22 and r11, r18
1600: 2a e0 ldi r18, 0x0A ; 10
1602: 30 e0 ldi r19, 0x00 ; 0
1604: 25 c0 rjmp .+74 ; 0x1650 <vfprintf+0x2a0>
1606: 99 ef ldi r25, 0xF9 ; 249
1608: b9 2e mov r11, r25
160a: b2 22 and r11, r18
160c: 8f 36 cpi r24, 0x6F ; 111
160e: c1 f0 breq .+48 ; 0x1640 <vfprintf+0x290>
1610: 80 37 cpi r24, 0x70 ; 112
1612: 20 f4 brcc .+8 ; 0x161c <vfprintf+0x26c>
1614: 88 35 cpi r24, 0x58 ; 88
1616: 09 f0 breq .+2 ; 0x161a <vfprintf+0x26a>
1618: ae c0 rjmp .+348 ; 0x1776 <vfprintf+0x3c6>
161a: 0d c0 rjmp .+26 ; 0x1636 <vfprintf+0x286>
161c: 80 37 cpi r24, 0x70 ; 112
161e: 21 f0 breq .+8 ; 0x1628 <vfprintf+0x278>
1620: 88 37 cpi r24, 0x78 ; 120
1622: 09 f0 breq .+2 ; 0x1626 <vfprintf+0x276>
1624: a8 c0 rjmp .+336 ; 0x1776 <vfprintf+0x3c6>
1626: 02 c0 rjmp .+4 ; 0x162c <vfprintf+0x27c>
1628: 20 e1 ldi r18, 0x10 ; 16
162a: b2 2a or r11, r18
162c: b4 fe sbrs r11, 4
162e: 0b c0 rjmp .+22 ; 0x1646 <vfprintf+0x296>
1630: 84 e0 ldi r24, 0x04 ; 4
1632: b8 2a or r11, r24
1634: 08 c0 rjmp .+16 ; 0x1646 <vfprintf+0x296>
1636: b4 fe sbrs r11, 4
1638: 09 c0 rjmp .+18 ; 0x164c <vfprintf+0x29c>
163a: e6 e0 ldi r30, 0x06 ; 6
163c: be 2a or r11, r30
163e: 06 c0 rjmp .+12 ; 0x164c <vfprintf+0x29c>
1640: 28 e0 ldi r18, 0x08 ; 8
1642: 30 e0 ldi r19, 0x00 ; 0
1644: 05 c0 rjmp .+10 ; 0x1650 <vfprintf+0x2a0>
1646: 20 e1 ldi r18, 0x10 ; 16
1648: 30 e0 ldi r19, 0x00 ; 0
164a: 02 c0 rjmp .+4 ; 0x1650 <vfprintf+0x2a0>
164c: 20 e1 ldi r18, 0x10 ; 16
164e: 32 e0 ldi r19, 0x02 ; 2
1650: b7 fe sbrs r11, 7
1652: 08 c0 rjmp .+16 ; 0x1664 <vfprintf+0x2b4>
1654: f8 01 movw r30, r16
1656: 60 81 ld r22, Z
1658: 71 81 ldd r23, Z+1 ; 0x01
165a: 82 81 ldd r24, Z+2 ; 0x02
165c: 93 81 ldd r25, Z+3 ; 0x03
165e: 0c 5f subi r16, 0xFC ; 252
1660: 1f 4f sbci r17, 0xFF ; 255
1662: 07 c0 rjmp .+14 ; 0x1672 <vfprintf+0x2c2>
1664: f8 01 movw r30, r16
1666: 60 81 ld r22, Z
1668: 71 81 ldd r23, Z+1 ; 0x01
166a: 80 e0 ldi r24, 0x00 ; 0
166c: 90 e0 ldi r25, 0x00 ; 0
166e: 0e 5f subi r16, 0xFE ; 254
1670: 1f 4f sbci r17, 0xFF ; 255
1672: a2 01 movw r20, r4
1674: e2 d0 rcall .+452 ; 0x183a <__ultoa_invert>
1676: 78 2e mov r7, r24
1678: 74 18 sub r7, r4
167a: ff e7 ldi r31, 0x7F ; 127
167c: bf 22 and r11, r31
167e: b6 fe sbrs r11, 6
1680: 0b c0 rjmp .+22 ; 0x1698 <vfprintf+0x2e8>
1682: 2e ef ldi r18, 0xFE ; 254
1684: b2 22 and r11, r18
1686: 7e 14 cp r7, r14
1688: 38 f4 brcc .+14 ; 0x1698 <vfprintf+0x2e8>
168a: b4 fe sbrs r11, 4
168c: 07 c0 rjmp .+14 ; 0x169c <vfprintf+0x2ec>
168e: b2 fc sbrc r11, 2
1690: 05 c0 rjmp .+10 ; 0x169c <vfprintf+0x2ec>
1692: 8f ee ldi r24, 0xEF ; 239
1694: b8 22 and r11, r24
1696: 02 c0 rjmp .+4 ; 0x169c <vfprintf+0x2ec>
1698: a7 2c mov r10, r7
169a: 01 c0 rjmp .+2 ; 0x169e <vfprintf+0x2ee>
169c: ae 2c mov r10, r14
169e: 8b 2d mov r24, r11
16a0: 90 e0 ldi r25, 0x00 ; 0
16a2: b4 fe sbrs r11, 4
16a4: 0d c0 rjmp .+26 ; 0x16c0 <vfprintf+0x310>
16a6: fe 01 movw r30, r28
16a8: e7 0d add r30, r7
16aa: f1 1d adc r31, r1
16ac: 20 81 ld r18, Z
16ae: 20 33 cpi r18, 0x30 ; 48
16b0: 19 f4 brne .+6 ; 0x16b8 <vfprintf+0x308>
16b2: e9 ee ldi r30, 0xE9 ; 233
16b4: be 22 and r11, r30
16b6: 09 c0 rjmp .+18 ; 0x16ca <vfprintf+0x31a>
16b8: a3 94 inc r10
16ba: b2 fe sbrs r11, 2
16bc: 06 c0 rjmp .+12 ; 0x16ca <vfprintf+0x31a>
16be: 04 c0 rjmp .+8 ; 0x16c8 <vfprintf+0x318>
16c0: 86 78 andi r24, 0x86 ; 134
16c2: 90 70 andi r25, 0x00 ; 0
16c4: 00 97 sbiw r24, 0x00 ; 0
16c6: 09 f0 breq .+2 ; 0x16ca <vfprintf+0x31a>
16c8: a3 94 inc r10
16ca: 8b 2c mov r8, r11
16cc: 99 24 eor r9, r9
16ce: b3 fc sbrc r11, 3
16d0: 13 c0 rjmp .+38 ; 0x16f8 <vfprintf+0x348>
16d2: b0 fe sbrs r11, 0
16d4: 0e c0 rjmp .+28 ; 0x16f2 <vfprintf+0x342>
16d6: af 14 cp r10, r15
16d8: 28 f4 brcc .+10 ; 0x16e4 <vfprintf+0x334>
16da: e7 2c mov r14, r7
16dc: ef 0c add r14, r15
16de: ea 18 sub r14, r10
16e0: af 2c mov r10, r15
16e2: 07 c0 rjmp .+14 ; 0x16f2 <vfprintf+0x342>
16e4: e7 2c mov r14, r7
16e6: 05 c0 rjmp .+10 ; 0x16f2 <vfprintf+0x342>
16e8: 80 e2 ldi r24, 0x20 ; 32
16ea: 90 e0 ldi r25, 0x00 ; 0
16ec: b6 01 movw r22, r12
16ee: 79 d0 rcall .+242 ; 0x17e2 <fputc>
16f0: a3 94 inc r10
16f2: af 14 cp r10, r15
16f4: c8 f3 brcs .-14 ; 0x16e8 <vfprintf+0x338>
16f6: 04 c0 rjmp .+8 ; 0x1700 <vfprintf+0x350>
16f8: af 14 cp r10, r15
16fa: 10 f4 brcc .+4 ; 0x1700 <vfprintf+0x350>
16fc: fa 18 sub r15, r10
16fe: 01 c0 rjmp .+2 ; 0x1702 <vfprintf+0x352>
1700: ff 24 eor r15, r15
1702: 84 fe sbrs r8, 4
1704: 0e c0 rjmp .+28 ; 0x1722 <vfprintf+0x372>
1706: 80 e3 ldi r24, 0x30 ; 48
1708: 90 e0 ldi r25, 0x00 ; 0
170a: b6 01 movw r22, r12
170c: 6a d0 rcall .+212 ; 0x17e2 <fputc>
170e: 82 fe sbrs r8, 2
1710: 1d c0 rjmp .+58 ; 0x174c <vfprintf+0x39c>
1712: 81 fe sbrs r8, 1
1714: 03 c0 rjmp .+6 ; 0x171c <vfprintf+0x36c>
1716: 88 e5 ldi r24, 0x58 ; 88
1718: 90 e0 ldi r25, 0x00 ; 0
171a: 10 c0 rjmp .+32 ; 0x173c <vfprintf+0x38c>
171c: 88 e7 ldi r24, 0x78 ; 120
171e: 90 e0 ldi r25, 0x00 ; 0
1720: 0d c0 rjmp .+26 ; 0x173c <vfprintf+0x38c>
1722: c4 01 movw r24, r8
1724: 86 78 andi r24, 0x86 ; 134
1726: 90 70 andi r25, 0x00 ; 0
1728: 00 97 sbiw r24, 0x00 ; 0
172a: 81 f0 breq .+32 ; 0x174c <vfprintf+0x39c>
172c: 81 fc sbrc r8, 1
172e: 02 c0 rjmp .+4 ; 0x1734 <vfprintf+0x384>
1730: 80 e2 ldi r24, 0x20 ; 32
1732: 01 c0 rjmp .+2 ; 0x1736 <vfprintf+0x386>
1734: 8b e2 ldi r24, 0x2B ; 43
1736: b7 fc sbrc r11, 7
1738: 8d e2 ldi r24, 0x2D ; 45
173a: 90 e0 ldi r25, 0x00 ; 0
173c: b6 01 movw r22, r12
173e: 51 d0 rcall .+162 ; 0x17e2 <fputc>
1740: 05 c0 rjmp .+10 ; 0x174c <vfprintf+0x39c>
1742: 80 e3 ldi r24, 0x30 ; 48
1744: 90 e0 ldi r25, 0x00 ; 0
1746: b6 01 movw r22, r12
1748: 4c d0 rcall .+152 ; 0x17e2 <fputc>
174a: ea 94 dec r14
174c: 7e 14 cp r7, r14
174e: c8 f3 brcs .-14 ; 0x1742 <vfprintf+0x392>
1750: 7a 94 dec r7
1752: f2 01 movw r30, r4
1754: e7 0d add r30, r7
1756: f1 1d adc r31, r1
1758: 80 81 ld r24, Z
175a: 90 e0 ldi r25, 0x00 ; 0
175c: b6 01 movw r22, r12
175e: 41 d0 rcall .+130 ; 0x17e2 <fputc>
1760: 77 20 and r7, r7
1762: b1 f7 brne .-20 ; 0x1750 <vfprintf+0x3a0>
1764: 05 c0 rjmp .+10 ; 0x1770 <vfprintf+0x3c0>
1766: 80 e2 ldi r24, 0x20 ; 32
1768: 90 e0 ldi r25, 0x00 ; 0
176a: b6 01 movw r22, r12
176c: 3a d0 rcall .+116 ; 0x17e2 <fputc>
176e: fa 94 dec r15
1770: ff 20 and r15, r15
1772: c9 f7 brne .-14 ; 0x1766 <vfprintf+0x3b6>
1774: 44 ce rjmp .-888 ; 0x13fe <vfprintf+0x4e>
1776: f6 01 movw r30, r12
1778: 26 81 ldd r18, Z+6 ; 0x06
177a: 37 81 ldd r19, Z+7 ; 0x07
177c: 02 c0 rjmp .+4 ; 0x1782 <vfprintf+0x3d2>
177e: 2f ef ldi r18, 0xFF ; 255
1780: 3f ef ldi r19, 0xFF ; 255
1782: c9 01 movw r24, r18
1784: 2c 96 adiw r28, 0x0c ; 12
1786: 0f b6 in r0, 0x3f ; 63
1788: f8 94 cli
178a: de bf out 0x3e, r29 ; 62
178c: 0f be out 0x3f, r0 ; 63
178e: cd bf out 0x3d, r28 ; 61
1790: cf 91 pop r28
1792: df 91 pop r29
1794: 1f 91 pop r17
1796: 0f 91 pop r16
1798: ff 90 pop r15
179a: ef 90 pop r14
179c: df 90 pop r13
179e: cf 90 pop r12
17a0: bf 90 pop r11
17a2: af 90 pop r10
17a4: 9f 90 pop r9
17a6: 8f 90 pop r8
17a8: 7f 90 pop r7
17aa: 6f 90 pop r6
17ac: 5f 90 pop r5
17ae: 4f 90 pop r4
17b0: 3f 90 pop r3
17b2: 2f 90 pop r2
17b4: 08 95 ret
000017b6 <strnlen_P>:
17b6: fc 01 movw r30, r24
17b8: 05 90 lpm r0, Z+
17ba: 61 50 subi r22, 0x01 ; 1
17bc: 70 40 sbci r23, 0x00 ; 0
17be: 01 10 cpse r0, r1
17c0: d8 f7 brcc .-10 ; 0x17b8 <strnlen_P+0x2>
17c2: 80 95 com r24
17c4: 90 95 com r25
17c6: 8e 0f add r24, r30
17c8: 9f 1f adc r25, r31
17ca: 08 95 ret
000017cc <strnlen>:
17cc: fc 01 movw r30, r24
17ce: 61 50 subi r22, 0x01 ; 1
17d0: 70 40 sbci r23, 0x00 ; 0
17d2: 01 90 ld r0, Z+
17d4: 01 10 cpse r0, r1
17d6: d8 f7 brcc .-10 ; 0x17ce <strnlen+0x2>
17d8: 80 95 com r24
17da: 90 95 com r25
17dc: 8e 0f add r24, r30
17de: 9f 1f adc r25, r31
17e0: 08 95 ret
000017e2 <fputc>:
17e2: 0f 93 push r16
17e4: 1f 93 push r17
17e6: cf 93 push r28
17e8: df 93 push r29
17ea: 8c 01 movw r16, r24
17ec: eb 01 movw r28, r22
17ee: 8b 81 ldd r24, Y+3 ; 0x03
17f0: 81 ff sbrs r24, 1
17f2: 1b c0 rjmp .+54 ; 0x182a <fputc+0x48>
17f4: 82 ff sbrs r24, 2
17f6: 0d c0 rjmp .+26 ; 0x1812 <fputc+0x30>
17f8: 2e 81 ldd r18, Y+6 ; 0x06
17fa: 3f 81 ldd r19, Y+7 ; 0x07
17fc: 8c 81 ldd r24, Y+4 ; 0x04
17fe: 9d 81 ldd r25, Y+5 ; 0x05
1800: 28 17 cp r18, r24
1802: 39 07 cpc r19, r25
1804: 64 f4 brge .+24 ; 0x181e <fputc+0x3c>
1806: e8 81 ld r30, Y
1808: f9 81 ldd r31, Y+1 ; 0x01
180a: 01 93 st Z+, r16
180c: f9 83 std Y+1, r31 ; 0x01
180e: e8 83 st Y, r30
1810: 06 c0 rjmp .+12 ; 0x181e <fputc+0x3c>
1812: e8 85 ldd r30, Y+8 ; 0x08
1814: f9 85 ldd r31, Y+9 ; 0x09
1816: 80 2f mov r24, r16
1818: 09 95 icall
181a: 00 97 sbiw r24, 0x00 ; 0
181c: 31 f4 brne .+12 ; 0x182a <fputc+0x48>
181e: 8e 81 ldd r24, Y+6 ; 0x06
1820: 9f 81 ldd r25, Y+7 ; 0x07
1822: 01 96 adiw r24, 0x01 ; 1
1824: 9f 83 std Y+7, r25 ; 0x07
1826: 8e 83 std Y+6, r24 ; 0x06
1828: 02 c0 rjmp .+4 ; 0x182e <fputc+0x4c>
182a: 0f ef ldi r16, 0xFF ; 255
182c: 1f ef ldi r17, 0xFF ; 255
182e: c8 01 movw r24, r16
1830: df 91 pop r29
1832: cf 91 pop r28
1834: 1f 91 pop r17
1836: 0f 91 pop r16
1838: 08 95 ret
0000183a <__ultoa_invert>:
183a: fa 01 movw r30, r20
183c: aa 27 eor r26, r26
183e: 28 30 cpi r18, 0x08 ; 8
1840: 51 f1 breq .+84 ; 0x1896 <__ultoa_invert+0x5c>
1842: 20 31 cpi r18, 0x10 ; 16
1844: 81 f1 breq .+96 ; 0x18a6 <__ultoa_invert+0x6c>
1846: e8 94 clt
1848: 6f 93 push r22
184a: 6e 7f andi r22, 0xFE ; 254
184c: 6e 5f subi r22, 0xFE ; 254
184e: 7f 4f sbci r23, 0xFF ; 255
1850: 8f 4f sbci r24, 0xFF ; 255
1852: 9f 4f sbci r25, 0xFF ; 255
1854: af 4f sbci r26, 0xFF ; 255
1856: b1 e0 ldi r27, 0x01 ; 1
1858: 3e d0 rcall .+124 ; 0x18d6 <__ultoa_invert+0x9c>
185a: b4 e0 ldi r27, 0x04 ; 4
185c: 3c d0 rcall .+120 ; 0x18d6 <__ultoa_invert+0x9c>
185e: 67 0f add r22, r23
1860: 78 1f adc r23, r24
1862: 89 1f adc r24, r25
1864: 9a 1f adc r25, r26
1866: a1 1d adc r26, r1
1868: 68 0f add r22, r24
186a: 79 1f adc r23, r25
186c: 8a 1f adc r24, r26
186e: 91 1d adc r25, r1
1870: a1 1d adc r26, r1
1872: 6a 0f add r22, r26
1874: 71 1d adc r23, r1
1876: 81 1d adc r24, r1
1878: 91 1d adc r25, r1
187a: a1 1d adc r26, r1
187c: 20 d0 rcall .+64 ; 0x18be <__ultoa_invert+0x84>
187e: 09 f4 brne .+2 ; 0x1882 <__ultoa_invert+0x48>
1880: 68 94 set
1882: 3f 91 pop r19
1884: 2a e0 ldi r18, 0x0A ; 10
1886: 26 9f mul r18, r22
1888: 11 24 eor r1, r1
188a: 30 19 sub r19, r0
188c: 30 5d subi r19, 0xD0 ; 208
188e: 31 93 st Z+, r19
1890: de f6 brtc .-74 ; 0x1848 <__ultoa_invert+0xe>
1892: cf 01 movw r24, r30
1894: 08 95 ret
1896: 46 2f mov r20, r22
1898: 47 70 andi r20, 0x07 ; 7
189a: 40 5d subi r20, 0xD0 ; 208
189c: 41 93 st Z+, r20
189e: b3 e0 ldi r27, 0x03 ; 3
18a0: 0f d0 rcall .+30 ; 0x18c0 <__ultoa_invert+0x86>
18a2: c9 f7 brne .-14 ; 0x1896 <__ultoa_invert+0x5c>
18a4: f6 cf rjmp .-20 ; 0x1892 <__ultoa_invert+0x58>
18a6: 46 2f mov r20, r22
18a8: 4f 70 andi r20, 0x0F ; 15
18aa: 40 5d subi r20, 0xD0 ; 208
18ac: 4a 33 cpi r20, 0x3A ; 58
18ae: 18 f0 brcs .+6 ; 0x18b6 <__ultoa_invert+0x7c>
18b0: 49 5d subi r20, 0xD9 ; 217
18b2: 31 fd sbrc r19, 1
18b4: 40 52 subi r20, 0x20 ; 32
18b6: 41 93 st Z+, r20
18b8: 02 d0 rcall .+4 ; 0x18be <__ultoa_invert+0x84>
18ba: a9 f7 brne .-22 ; 0x18a6 <__ultoa_invert+0x6c>
18bc: ea cf rjmp .-44 ; 0x1892 <__ultoa_invert+0x58>
18be: b4 e0 ldi r27, 0x04 ; 4
18c0: a6 95 lsr r26
18c2: 97 95 ror r25
18c4: 87 95 ror r24
18c6: 77 95 ror r23
18c8: 67 95 ror r22
18ca: ba 95 dec r27
18cc: c9 f7 brne .-14 ; 0x18c0 <__ultoa_invert+0x86>
18ce: 00 97 sbiw r24, 0x00 ; 0
18d0: 61 05 cpc r22, r1
18d2: 71 05 cpc r23, r1
18d4: 08 95 ret
18d6: 9b 01 movw r18, r22
18d8: ac 01 movw r20, r24
18da: 0a 2e mov r0, r26
18dc: 06 94 lsr r0
18de: 57 95 ror r21
18e0: 47 95 ror r20
18e2: 37 95 ror r19
18e4: 27 95 ror r18
18e6: ba 95 dec r27
18e8: c9 f7 brne .-14 ; 0x18dc <__ultoa_invert+0xa2>
18ea: 62 0f add r22, r18
18ec: 73 1f adc r23, r19
18ee: 84 1f adc r24, r20
18f0: 95 1f adc r25, r21
18f2: a0 1d adc r26, r0
18f4: 08 95 ret
000018f6 <_exit>:
18f6: f8 94 cli
000018f8 <__stop_program>:
18f8: ff cf rjmp .-2 ; 0x18f8 <__stop_program>