From 0c0436f47c296513dace43d3ba20e3cc36f8f527 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 25 Mar 2012 17:46:26 +0200 Subject: Board, rev A. --- firmware/VirtualSerial.lss | 3526 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3526 insertions(+) create mode 100644 firmware/VirtualSerial.lss (limited to 'firmware/VirtualSerial.lss') diff --git a/firmware/VirtualSerial.lss b/firmware/VirtualSerial.lss new file mode 100644 index 0000000..c2bb1c1 --- /dev/null +++ b/firmware/VirtualSerial.lss @@ -0,0 +1,3526 @@ + +VirtualSerial.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 000000d8 00800100 00000ece 00000f62 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 00000ece 00000000 00000000 00000094 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .bss 0000003e 008001d8 008001d8 0000103a 2**0 + ALLOC + 3 .stab 00001080 00000000 00000000 0000103c 2**2 + CONTENTS, READONLY, DEBUGGING + 4 .stabstr 000009a6 00000000 00000000 000020bc 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_aranges 00000438 00000000 00000000 00002a62 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_pubnames 00000b8d 00000000 00000000 00002e9a 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_info 00006c93 00000000 00000000 00003a27 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_abbrev 00001dd1 00000000 00000000 0000a6ba 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_line 00005218 00000000 00000000 0000c48b 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_frame 00000650 00000000 00000000 000116a4 2**2 + CONTENTS, READONLY, DEBUGGING + 11 .debug_str 00002b5d 00000000 00000000 00011cf4 2**0 + CONTENTS, READONLY, DEBUGGING + 12 .debug_loc 00002be2 00000000 00000000 00014851 2**0 + CONTENTS, READONLY, DEBUGGING + 13 .debug_ranges 00000458 00000000 00000000 00017433 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + USB_Init(); +} + +/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */ +void CheckPinStatus(void) +{ + 0: 81 c0 rjmp .+258 ; 0x104 <__ctors_end> + + return Endpoint_IsConfigured(); +} + +void Endpoint_ClearEndpoints(void) +{ + 2: 00 00 nop + #if defined(USB_CAN_BE_BOTH) + USB_CurrentMode = USB_MODE_None; + #endif + + USB_IsInitialized = false; +} + 4: 9a c0 rjmp .+308 ; 0x13a <__bad_interrupt> +uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, + uint16_t Length) +{ + 6: 00 00 nop + + return ENDPOINT_READYWAIT_NoError; +} + +uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + 8: 98 c0 rjmp .+304 ; 0x13a <__bad_interrupt> + a: 00 00 nop + c: 96 c0 rjmp .+300 ; 0x13a <__bad_interrupt> + e: 00 00 nop + 10: 94 c0 rjmp .+296 ; 0x13a <__bad_interrupt> + 12: 00 00 nop + 14: 92 c0 rjmp .+292 ; 0x13a <__bad_interrupt> + 16: 00 00 nop + 18: 90 c0 rjmp .+288 ; 0x13a <__bad_interrupt> + 1a: 00 00 nop + 1c: 8e c0 rjmp .+284 ; 0x13a <__bad_interrupt> + 1e: 00 00 nop + 20: 8c c0 rjmp .+280 ; 0x13a <__bad_interrupt> + 22: 00 00 nop + 24: 8a c0 rjmp .+276 ; 0x13a <__bad_interrupt> + 26: 00 00 nop + 28: 88 c0 rjmp .+272 ; 0x13a <__bad_interrupt> + 2a: 00 00 nop + 2c: 80 c2 rjmp .+1280 ; 0x52e <__vector_11> + 2e: 00 00 nop + 30: 84 c0 rjmp .+264 ; 0x13a <__bad_interrupt> + 32: 00 00 nop + 34: 82 c0 rjmp .+260 ; 0x13a <__bad_interrupt> + 36: 00 00 nop + 38: 80 c0 rjmp .+256 ; 0x13a <__bad_interrupt> + 3a: 00 00 nop + 3c: 93 c0 rjmp .+294 ; 0x164 <__vector_15> + 3e: 00 00 nop + 40: 7c c0 rjmp .+248 ; 0x13a <__bad_interrupt> + 42: 00 00 nop + 44: 7a c0 rjmp .+244 ; 0x13a <__bad_interrupt> + 46: 00 00 nop + 48: 78 c0 rjmp .+240 ; 0x13a <__bad_interrupt> + 4a: 00 00 nop + 4c: 76 c0 rjmp .+236 ; 0x13a <__bad_interrupt> + 4e: 00 00 nop + 50: 74 c0 rjmp .+232 ; 0x13a <__bad_interrupt> + 52: 00 00 nop + 54: 72 c0 rjmp .+228 ; 0x13a <__bad_interrupt> + 56: 00 00 nop + 58: 70 c0 rjmp .+224 ; 0x13a <__bad_interrupt> + 5a: 00 00 nop + 5c: 6e c0 rjmp .+220 ; 0x13a <__bad_interrupt> + 5e: 00 00 nop + 60: 6c c0 rjmp .+216 ; 0x13a <__bad_interrupt> + 62: 00 00 nop + 64: 6a c0 rjmp .+212 ; 0x13a <__bad_interrupt> + 66: 00 00 nop + 68: 68 c0 rjmp .+208 ; 0x13a <__bad_interrupt> + 6a: 00 00 nop + 6c: 66 c0 rjmp .+204 ; 0x13a <__bad_interrupt> + 6e: 00 00 nop + 70: 64 c0 rjmp .+200 ; 0x13a <__bad_interrupt> + 72: 00 00 nop + +00000074 : + 74: 12 01 10 01 02 00 00 08 eb 03 6f 20 01 00 01 02 ..........o .... + 84: 00 01 .. + +00000086 : + 86: 09 02 3e 00 02 01 00 c0 32 09 04 00 00 01 02 02 ..>.....2....... + 96: 01 00 05 24 00 10 01 04 24 02 06 05 24 06 00 01 ...$....$...$... + a6: 07 05 82 03 08 00 ff 09 04 01 00 02 0a 00 00 00 ................ + b6: 07 05 04 02 10 00 01 07 05 83 02 10 00 01 .............. + +000000c4 : + c4: 04 03 09 04 .... + +000000c8 : + c8: 18 03 50 00 49 00 4e 00 47 00 20 00 4c 00 61 00 ..P.I.N.G. .L.a. + d8: 62 00 73 00 00 00 b.s... + +000000de : + de: 26 03 46 00 72 00 69 00 64 00 67 00 65 00 20 00 &.F.r.i.d.g.e. . + ee: 43 00 6f 00 6e 00 74 00 72 00 6f 00 6c 00 6c 00 C.o.n.t.r.o.l.l. + fe: 65 00 72 00 00 00 e.r... + +00000104 <__ctors_end>: + 104: 11 24 eor r1, r1 + 106: 1f be out 0x3f, r1 ; 63 + 108: cf ef ldi r28, 0xFF ; 255 + 10a: d2 e0 ldi r29, 0x02 ; 2 + 10c: de bf out 0x3e, r29 ; 62 + 10e: cd bf out 0x3d, r28 ; 61 + +00000110 <__do_copy_data>: + 110: 11 e0 ldi r17, 0x01 ; 1 + 112: a0 e0 ldi r26, 0x00 ; 0 + 114: b1 e0 ldi r27, 0x01 ; 1 + 116: ee ec ldi r30, 0xCE ; 206 + 118: fe e0 ldi r31, 0x0E ; 14 + 11a: 02 c0 rjmp .+4 ; 0x120 <.do_copy_data_start> + +0000011c <.do_copy_data_loop>: + 11c: 05 90 lpm r0, Z+ + 11e: 0d 92 st X+, r0 + +00000120 <.do_copy_data_start>: + 120: a8 3d cpi r26, 0xD8 ; 216 + 122: b1 07 cpc r27, r17 + 124: d9 f7 brne .-10 ; 0x11c <.do_copy_data_loop> + +00000126 <__do_clear_bss>: + 126: 12 e0 ldi r17, 0x02 ; 2 + 128: a8 ed ldi r26, 0xD8 ; 216 + 12a: b1 e0 ldi r27, 0x01 ; 1 + 12c: 01 c0 rjmp .+2 ; 0x130 <.do_clear_bss_start> + +0000012e <.do_clear_bss_loop>: + 12e: 1d 92 st X+, r1 + +00000130 <.do_clear_bss_start>: + 130: a6 31 cpi r26, 0x16 ; 22 + 132: b1 07 cpc r27, r17 + 134: e1 f7 brne .-8 ; 0x12e <.do_clear_bss_loop> + 136: eb d0 rcall .+470 ; 0x30e
+ 138: c8 c6 rjmp .+3472 ; 0xeca <_exit> + +0000013a <__bad_interrupt>: + 13a: 62 cf rjmp .-316 ; 0x0 <__vectors> + +0000013c : + +static volatile uint8_t lock_timer_ticks; + +void lock_timer_setup(void) +{ + OCR1A = 128; + 13c: e0 e8 ldi r30, 0x80 ; 128 + 13e: f0 e0 ldi r31, 0x00 ; 0 + 140: f0 93 89 00 sts 0x0089, r31 + 144: e0 93 88 00 sts 0x0088, r30 + + // CTC mode + TCCR1A = (1 << WGM12); + 148: 88 e0 ldi r24, 0x08 ; 8 + 14a: 80 83 st Z, r24 + + // Prescaler + TCCR1B = (1 << CS12); + 14c: 84 e0 ldi r24, 0x04 ; 4 + 14e: 80 93 81 00 sts 0x0081, r24 + + // Enable interrupt + TIMSK1 = (1 << OCIE1A); + 152: 82 e0 ldi r24, 0x02 ; 2 + 154: 80 93 6f 00 sts 0x006F, r24 +} + 158: 08 95 ret + +0000015a : + +void lock_timer_reset(void) +{ + lock_timer_ticks = 0; + 15a: 10 92 08 02 sts 0x0208, r1 +} + 15e: 08 95 ret + +00000160 : + +/** Event handler for the library USB Connection event. */ +void EVENT_USB_Device_Connect(void) +{ +// LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); +} + 160: 08 95 ret + +00000162 : + +/** Event handler for the library USB Disconnection event. */ +void EVENT_USB_Device_Disconnect(void) +{ +// LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); +} + 162: 08 95 ret + +00000164 <__vector_15>: +{ + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); +} + +ISR(TIMER1_COMPA_vect) +{ + 164: 1f 92 push r1 + 166: 0f 92 push r0 + 168: 0f b6 in r0, 0x3f ; 63 + 16a: 0f 92 push r0 + 16c: 11 24 eor r1, r1 + 16e: 8f 93 push r24 + if(PINB & (1 << PB5)) + 170: 1d 99 sbic 0x03, 5 ; 3 + PORTB |= 1 << PB4; + 172: 2c 9a sbi 0x05, 4 ; 5 + + if(lock_timer_ticks == 0xff) + 174: 80 91 08 02 lds r24, 0x0208 + 178: 8f 3f cpi r24, 0xFF ; 255 + 17a: 61 f0 breq .+24 ; 0x194 <__vector_15+0x30> + return; + + if(lock_timer_ticks < 30) + 17c: 80 91 08 02 lds r24, 0x0208 + 180: 8e 31 cpi r24, 0x1E ; 30 + 182: 20 f4 brcc .+8 ; 0x18c <__vector_15+0x28> + { + ++lock_timer_ticks; + 184: 80 91 08 02 lds r24, 0x0208 + 188: 8f 5f subi r24, 0xFF ; 255 + 18a: 02 c0 rjmp .+4 ; 0x190 <__vector_15+0x2c> + return; + } + + PORTB |= 1 << PB4; + 18c: 2c 9a sbi 0x05, 4 ; 5 + lock_timer_ticks = 0xff; + 18e: 8f ef ldi r24, 0xFF ; 255 + 190: 80 93 08 02 sts 0x0208, r24 +} + 194: 8f 91 pop r24 + 196: 0f 90 pop r0 + 198: 0f be out 0x3f, r0 ; 63 + 19a: 0f 90 pop r0 + 19c: 1f 90 pop r1 + 19e: 18 95 reti + +000001a0 : +} + +/** Event handler for the library USB Control Request reception event. */ +void EVENT_USB_Device_ControlRequest(void) +{ + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + 1a0: 80 ec ldi r24, 0xC0 ; 192 + 1a2: 91 e0 ldi r25, 0x01 ; 1 +} + 1a4: ad c5 rjmp .+2906 ; 0xd00 + +000001a6 : +/** Event handler for the library USB Configuration Changed event. */ +void EVENT_USB_Device_ConfigurationChanged(void) +{ + bool ConfigSuccess = true; + + ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); + 1a6: 80 ec ldi r24, 0xC0 ; 192 + 1a8: 91 e0 ldi r25, 0x01 ; 1 + +// LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); +} + 1aa: 61 c5 rjmp .+2754 ; 0xc6e + +000001ac : + +/** 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); + 1ac: 84 b7 in r24, 0x34 ; 52 + 1ae: 87 7f andi r24, 0xF7 ; 247 + 1b0: 84 bf out 0x34, r24 ; 52 + + /* Enable the watchdog timer. */ + wdt_enable(WDTO_1S); + 1b2: 2e e0 ldi r18, 0x0E ; 14 + 1b4: 88 e1 ldi r24, 0x18 ; 24 + 1b6: 90 e0 ldi r25, 0x00 ; 0 + 1b8: 0f b6 in r0, 0x3f ; 63 + 1ba: f8 94 cli + 1bc: a8 95 wdr + 1be: 80 93 60 00 sts 0x0060, r24 + 1c2: 0f be out 0x3f, r0 ; 63 + 1c4: 20 93 60 00 sts 0x0060, r18 +The type of x is clock_div_t. +*/ +void clock_prescale_set(clock_div_t __x) +{ + uint8_t __tmp = _BV(CLKPCE); + __asm__ __volatile__ ( + 1c8: 90 e0 ldi r25, 0x00 ; 0 + 1ca: 80 e8 ldi r24, 0x80 ; 128 + 1cc: 0f b6 in r0, 0x3f ; 63 + 1ce: f8 94 cli + 1d0: 80 93 61 00 sts 0x0061, r24 + 1d4: 90 93 61 00 sts 0x0061, r25 + 1d8: 0f be out 0x3f, r0 ; 63 + /* Disable clock division */ + clock_prescale_set(clock_div_1); + + /* Hardware Initialization */ + USB_Init(); +} + 1da: 9a c1 rjmp .+820 ; 0x510 + +000001dc : + + for (;;); +} + +void handle_command(const char *buf) +{ + 1dc: cf 93 push r28 + 1de: df 93 push r29 + 1e0: ec 01 movw r28, r24 + if (strcmp("cola", buf) == 0) + 1e2: 8d e1 ldi r24, 0x1D ; 29 + 1e4: 91 e0 ldi r25, 0x01 ; 1 + 1e6: be 01 movw r22, r28 + 1e8: f8 d5 rcall .+3056 ; 0xdda + 1ea: 00 97 sbiw r24, 0x00 ; 0 + 1ec: 39 f4 brne .+14 ; 0x1fc + { + PORTB ^= 1 << PB5; + 1ee: 85 b1 in r24, 0x05 ; 5 + 1f0: 90 e2 ldi r25, 0x20 ; 32 + 1f2: 89 27 eor r24, r25 + 1f4: 85 b9 out 0x05, r24 ; 5 + fputs("mmm! LED toggeled\r\n", &USBSerialStream); + 1f6: 82 e2 ldi r24, 0x22 ; 34 + 1f8: 91 e0 ldi r25, 0x01 ; 1 + 1fa: 4e c0 rjmp .+156 ; 0x298 + } + + else if (strcmp("reboot", buf) == 0 || strcmp("reset", buf) == 0) + 1fc: 86 e3 ldi r24, 0x36 ; 54 + 1fe: 91 e0 ldi r25, 0x01 ; 1 + 200: be 01 movw r22, r28 + 202: eb d5 rcall .+3030 ; 0xdda + 204: 00 97 sbiw r24, 0x00 ; 0 + 206: 31 f0 breq .+12 ; 0x214 + 208: 8d e3 ldi r24, 0x3D ; 61 + 20a: 91 e0 ldi r25, 0x01 ; 1 + 20c: be 01 movw r22, r28 + 20e: e5 d5 rcall .+3018 ; 0xdda + 210: 00 97 sbiw r24, 0x00 ; 0 + 212: 51 f4 brne .+20 ; 0x228 + { + fputs("Rebooting!\r\n", &USBSerialStream); + 214: 80 e1 ldi r24, 0x10 ; 16 + 216: 91 e0 ldi r25, 0x01 ; 1 + 218: 6a ef ldi r22, 0xFA ; 250 + 21a: 71 e0 ldi r23, 0x01 ; 1 + 21c: 13 d6 rcall .+3110 ; 0xe44 + running = false; + 21e: 10 92 d7 01 sts 0x01D7, r1 + 222: 10 92 d6 01 sts 0x01D6, r1 + 226: 3b c0 rjmp .+118 ; 0x29e + } + + else if (strcmp("toggle", buf) == 0) + 228: 83 e4 ldi r24, 0x43 ; 67 + 22a: 91 e0 ldi r25, 0x01 ; 1 + 22c: be 01 movw r22, r28 + 22e: d5 d5 rcall .+2986 ; 0xdda + 230: 00 97 sbiw r24, 0x00 ; 0 + 232: 51 f4 brne .+20 ; 0x248 + { + fputs("Toggling Magnet Lock\r\n", &USBSerialStream); + 234: 8a e4 ldi r24, 0x4A ; 74 + 236: 91 e0 ldi r25, 0x01 ; 1 + 238: 6a ef ldi r22, 0xFA ; 250 + 23a: 71 e0 ldi r23, 0x01 ; 1 + 23c: 03 d6 rcall .+3078 ; 0xe44 + PORTB ^= 1 << PB4; + 23e: 85 b1 in r24, 0x05 ; 5 + 240: 90 e1 ldi r25, 0x10 ; 16 + 242: 89 27 eor r24, r25 + 244: 85 b9 out 0x05, r24 ; 5 + 246: 2b c0 rjmp .+86 ; 0x29e + } + + else if (strcmp("lock", buf) == 0) + 248: 81 e6 ldi r24, 0x61 ; 97 + 24a: 91 e0 ldi r25, 0x01 ; 1 + 24c: be 01 movw r22, r28 + 24e: c5 d5 rcall .+2954 ; 0xdda + 250: 00 97 sbiw r24, 0x00 ; 0 + 252: 39 f4 brne .+14 ; 0x262 + { + fputs("status: locked\n", &USBSerialStream); + 254: 86 e6 ldi r24, 0x66 ; 102 + 256: 91 e0 ldi r25, 0x01 ; 1 + 258: 6a ef ldi r22, 0xFA ; 250 + 25a: 71 e0 ldi r23, 0x01 ; 1 + 25c: f3 d5 rcall .+3046 ; 0xe44 + PORTB |= 1 << PB4; + 25e: 2c 9a sbi 0x05, 4 ; 5 + 260: 1e c0 rjmp .+60 ; 0x29e + } + + else if (strcmp("unlock", buf) == 0) + 262: 86 e7 ldi r24, 0x76 ; 118 + 264: 91 e0 ldi r25, 0x01 ; 1 + 266: be 01 movw r22, r28 + 268: b8 d5 rcall .+2928 ; 0xdda + 26a: 00 97 sbiw r24, 0x00 ; 0 + 26c: 41 f4 brne .+16 ; 0x27e + { + fputs("status: unlocked\n", &USBSerialStream); + 26e: 8d e7 ldi r24, 0x7D ; 125 + 270: 91 e0 ldi r25, 0x01 ; 1 + 272: 6a ef ldi r22, 0xFA ; 250 + 274: 71 e0 ldi r23, 0x01 ; 1 + 276: e6 d5 rcall .+3020 ; 0xe44 + PORTB &= ~(1 << PB4); + 278: 2c 98 cbi 0x05, 4 ; 5 + lock_timer_reset(); + 27a: 6f df rcall .-290 ; 0x15a + 27c: 10 c0 rjmp .+32 ; 0x29e + } + + else if (strcmp("doorstatus", buf) == 0) + 27e: 8f e8 ldi r24, 0x8F ; 143 + 280: 91 e0 ldi r25, 0x01 ; 1 + 282: be 01 movw r22, r28 + 284: aa d5 rcall .+2900 ; 0xdda + 286: 00 97 sbiw r24, 0x00 ; 0 + 288: 51 f4 brne .+20 ; 0x29e + { + if (PINB & (1 << PB5)) + 28a: 1d 9b sbis 0x03, 5 ; 3 + 28c: 03 c0 rjmp .+6 ; 0x294 + fputs("doorstatus: open\n", &USBSerialStream); + 28e: 8a e9 ldi r24, 0x9A ; 154 + 290: 91 e0 ldi r25, 0x01 ; 1 + 292: 02 c0 rjmp .+4 ; 0x298 + else + fputs("doorstatus: closed\n", &USBSerialStream); + 294: 8c ea ldi r24, 0xAC ; 172 + 296: 91 e0 ldi r25, 0x01 ; 1 + 298: 6a ef ldi r22, 0xFA ; 250 + 29a: 71 e0 ldi r23, 0x01 ; 1 + 29c: d3 d5 rcall .+2982 ; 0xe44 + } +} + 29e: df 91 pop r29 + 2a0: cf 91 pop r28 + 2a2: 08 95 ret + +000002a4 : + +void CheckACMStatus() +{ + 2a4: cf 93 push r28 + 2a6: df 93 push r29 + 2a8: 28 c0 rjmp .+80 ; 0x2fa + static uint8_t len = 0; + + int c; + while((c = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface)) > 0) + { + putc(c, &USBSerialStream); + 2aa: ce 01 movw r24, r28 + 2ac: 6a ef ldi r22, 0xFA ; 250 + 2ae: 71 e0 ldi r23, 0x01 ; 1 + 2b0: 9d d5 rcall .+2874 ; 0xdec + + if (c == '\r') + 2b2: cd 30 cpi r28, 0x0D ; 13 + 2b4: d1 05 cpc r29, r1 + 2b6: 99 f4 brne .+38 ; 0x2de + { + putc('\n', &USBSerialStream); + 2b8: 8a e0 ldi r24, 0x0A ; 10 + 2ba: 90 e0 ldi r25, 0x00 ; 0 + 2bc: 6a ef ldi r22, 0xFA ; 250 + 2be: 71 e0 ldi r23, 0x01 ; 1 + 2c0: 95 d5 rcall .+2858 ; 0xdec + buf[len++] = '\0'; + 2c2: 80 91 d9 01 lds r24, 0x01D9 + 2c6: e8 2f mov r30, r24 + 2c8: f0 e0 ldi r31, 0x00 ; 0 + 2ca: e6 52 subi r30, 0x26 ; 38 + 2cc: fe 4f sbci r31, 0xFE ; 254 + 2ce: 10 82 st Z, r1 + 2d0: 8f 5f subi r24, 0xFF ; 255 + 2d2: 80 93 d9 01 sts 0x01D9, r24 + handle_command(buf); + 2d6: 8a ed ldi r24, 0xDA ; 218 + 2d8: 91 e0 ldi r25, 0x01 ; 1 + 2da: 80 df rcall .-256 ; 0x1dc + 2dc: 0c c0 rjmp .+24 ; 0x2f6 + len = 0; + continue; + } + + buf[len++] = c; + 2de: 80 91 d9 01 lds r24, 0x01D9 + 2e2: e8 2f mov r30, r24 + 2e4: f0 e0 ldi r31, 0x00 ; 0 + 2e6: e6 52 subi r30, 0x26 ; 38 + 2e8: fe 4f sbci r31, 0xFE ; 254 + 2ea: c0 83 st Z, r28 + 2ec: 8f 5f subi r24, 0xFF ; 255 + 2ee: 80 93 d9 01 sts 0x01D9, r24 + + if (len == sizeof(buf)) + 2f2: 80 32 cpi r24, 0x20 ; 32 + 2f4: 11 f4 brne .+4 ; 0x2fa + { + len = 0; + 2f6: 10 92 d9 01 sts 0x01D9, r1 +{ + static char buf[32]; + static uint8_t len = 0; + + int c; + while((c = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface)) > 0) + 2fa: 80 ec ldi r24, 0xC0 ; 192 + 2fc: 91 e0 ldi r25, 0x01 ; 1 + 2fe: fc d3 rcall .+2040 ; 0xaf8 + 300: ec 01 movw r28, r24 + 302: 18 16 cp r1, r24 + 304: 19 06 cpc r1, r25 + 306: 8c f2 brlt .-94 ; 0x2aa + { + len = 0; + continue; + } + } +} + 308: df 91 pop r29 + 30a: cf 91 pop r28 + 30c: 08 95 ret + +0000030e
: + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ +int main(void) +{ + 30e: cf 93 push r28 + 310: df 93 push r29 + DDRB = 1 << PB0 | 1 << PB4 | 0 << PB5; + 312: 81 e1 ldi r24, 0x11 ; 17 + 314: 84 b9 out 0x04, r24 ; 4 + PORTB = 0 << PB0; + 316: 15 b8 out 0x05, r1 ; 5 + + SetupHardware(); + 318: 49 df rcall .-366 ; 0x1ac + + lock_timer_setup(); + 31a: 10 df rcall .-480 ; 0x13c + + /* Create a regular character stream for the interface so that it can be used with the stdio.h functions */ + CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream); + 31c: 80 ec ldi r24, 0xC0 ; 192 + 31e: 91 e0 ldi r25, 0x01 ; 1 + 320: 6a ef ldi r22, 0xFA ; 250 + 322: 71 e0 ldi r23, 0x01 ; 1 + 324: 16 d4 rcall .+2092 ; 0xb52 + +// LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + sei(); + 326: 78 94 sei + milliseconds can be achieved. + */ +void +_delay_loop_2(uint16_t __count) +{ + __asm__ volatile ( + 328: c0 e9 ldi r28, 0x90 ; 144 + 32a: d1 e0 ldi r29, 0x01 ; 1 + 32c: 0d c0 rjmp .+26 ; 0x348 + + while(running) + { + wdt_reset(); + 32e: a8 95 wdr + 330: 84 ec ldi r24, 0xC4 ; 196 + 332: 99 e0 ldi r25, 0x09 ; 9 + 334: fe 01 movw r30, r28 + 336: 31 97 sbiw r30, 0x01 ; 1 + 338: f1 f7 brne .-4 ; 0x336 + __ticks = (uint16_t) (__ms * 10.0); + while(__ticks) + { + // wait 1/10 ms + _delay_loop_2(((F_CPU) / 4e3) / 10); + __ticks --; + 33a: 01 97 sbiw r24, 0x01 ; 1 + __ticks = 1; + else if (__tmp > 65535) + { + // __ticks = requested delay in 1/10 ms + __ticks = (uint16_t) (__ms * 10.0); + while(__ticks) + 33c: d9 f7 brne .-10 ; 0x334 + _delay_ms(250); +// PORTB ^= 1 << PB0; // Toggle external LED + +// CheckPinStatus(); + + CheckACMStatus(); + 33e: b2 df rcall .-156 ; 0x2a4 + + CDC_Device_USBTask(&VirtualSerial_CDC_Interface); + 340: 80 ec ldi r24, 0xC0 ; 192 + 342: 91 e0 ldi r25, 0x01 ; 1 + 344: 50 d4 rcall .+2208 ; 0xbe6 + USB_USBTask(); + 346: c4 d3 rcall .+1928 ; 0xad0 + CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream); + +// LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + sei(); + + while(running) + 348: 80 91 d6 01 lds r24, 0x01D6 + 34c: 90 91 d7 01 lds r25, 0x01D7 + 350: 89 2b or r24, r25 + 352: 69 f7 brne .-38 ; 0x32e + * 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); + 354: 80 91 e0 00 lds r24, 0x00E0 + 358: 81 60 ori r24, 0x01 ; 1 + 35a: 80 93 e0 00 sts 0x00E0, r24 + } + + USB_Detach(); + + /* Enable the watchdog and force a timeout to reset the AVR */ + wdt_enable(WDTO_250MS); + 35e: 2c e0 ldi r18, 0x0C ; 12 + 360: 88 e1 ldi r24, 0x18 ; 24 + 362: 90 e0 ldi r25, 0x00 ; 0 + 364: 0f b6 in r0, 0x3f ; 63 + 366: f8 94 cli + 368: a8 95 wdr + 36a: 80 93 60 00 sts 0x0060, r24 + 36e: 0f be out 0x3f, r0 ; 63 + 370: 20 93 60 00 sts 0x0060, r18 + 374: ff cf rjmp .-2 ; 0x374 + +00000376 : + * USB host. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) +{ + 376: da 01 movw r26, r20 + const uint8_t DescriptorNumber = (wValue & 0xFF); + + const void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + 378: 92 30 cpi r25, 0x02 ; 2 + 37a: 49 f0 breq .+18 ; 0x38e + 37c: 93 30 cpi r25, 0x03 ; 3 + 37e: 61 f0 breq .+24 ; 0x398 + 380: 91 30 cpi r25, 0x01 ; 1 + 382: f9 f4 brne .+62 ; 0x3c2 + 384: e4 e7 ldi r30, 0x74 ; 116 + 386: f0 e0 ldi r31, 0x00 ; 0 + 388: 22 e1 ldi r18, 0x12 ; 18 + 38a: 30 e0 ldi r19, 0x00 ; 0 + 38c: 1e c0 rjmp .+60 ; 0x3ca + 38e: e6 e8 ldi r30, 0x86 ; 134 + 390: f0 e0 ldi r31, 0x00 ; 0 + 392: 2e e3 ldi r18, 0x3E ; 62 + 394: 30 e0 ldi r19, 0x00 ; 0 + 396: 19 c0 rjmp .+50 ; 0x3ca + case DTYPE_Configuration: + Address = &ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + 398: 81 30 cpi r24, 0x01 ; 1 + 39a: 49 f0 breq .+18 ; 0x3ae + 39c: 81 30 cpi r24, 0x01 ; 1 + 39e: 18 f0 brcs .+6 ; 0x3a6 + 3a0: 82 30 cpi r24, 0x02 ; 2 + 3a2: 79 f4 brne .+30 ; 0x3c2 + 3a4: 08 c0 rjmp .+16 ; 0x3b6 + { + case 0x00: + Address = &LanguageString; + Size = pgm_read_byte(&LanguageString.Header.Size); + 3a6: e4 ec ldi r30, 0xC4 ; 196 + 3a8: f0 e0 ldi r31, 0x00 ; 0 + 3aa: 84 91 lpm r24, Z+ + 3ac: 07 c0 rjmp .+14 ; 0x3bc + break; + case 0x01: + Address = &ManufacturerString; + Size = pgm_read_byte(&ManufacturerString.Header.Size); + 3ae: e8 ec ldi r30, 0xC8 ; 200 + 3b0: f0 e0 ldi r31, 0x00 ; 0 + 3b2: 84 91 lpm r24, Z+ + 3b4: 03 c0 rjmp .+6 ; 0x3bc + break; + case 0x02: + Address = &ProductString; + Size = pgm_read_byte(&ProductString.Header.Size); + 3b6: ee ed ldi r30, 0xDE ; 222 + 3b8: f0 e0 ldi r31, 0x00 ; 0 + 3ba: 84 91 lpm r24, Z+ + 3bc: 28 2f mov r18, r24 + 3be: 30 e0 ldi r19, 0x00 ; 0 + 3c0: 04 c0 rjmp .+8 ; 0x3ca + 3c2: e0 e0 ldi r30, 0x00 ; 0 + 3c4: f0 e0 ldi r31, 0x00 ; 0 + 3c6: 20 e0 ldi r18, 0x00 ; 0 + 3c8: 30 e0 ldi r19, 0x00 ; 0 + } + + break; + } + + *DescriptorAddress = Address; + 3ca: ed 93 st X+, r30 + 3cc: fc 93 st X, r31 + return Size; +} + 3ce: c9 01 movw r24, r18 + 3d0: 08 95 ret + +000003d2 : + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + 3d2: 80 93 e9 00 sts 0x00E9, r24 + * \note Endpoints must first be configured properly via \ref Endpoint_ConfigureEndpoint(). + */ + static inline void Endpoint_EnableEndpoint(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_EnableEndpoint(void) + { + UECONX |= (1 << EPEN); + 3d6: 80 91 eb 00 lds r24, 0x00EB + 3da: 81 60 ori r24, 0x01 ; 1 + 3dc: 80 93 eb 00 sts 0x00EB, r24 + const uint8_t UECFG1XData) +{ + Endpoint_SelectEndpoint(Number); + Endpoint_EnableEndpoint(); + + UECFG1X = 0; + 3e0: 10 92 ed 00 sts 0x00ED, r1 + UECFG0X = UECFG0XData; + 3e4: 60 93 ec 00 sts 0x00EC, r22 + UECFG1X = UECFG1XData; + 3e8: 40 93 ed 00 sts 0x00ED, r20 + * \return Boolean true if the currently selected endpoint has been configured, false otherwise. + */ + static inline bool Endpoint_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsConfigured(void) + { + return ((UESTA0X & (1 << CFGOK)) ? true : false); + 3ec: 80 91 ee 00 lds r24, 0x00EE + + return Endpoint_IsConfigured(); +} + 3f0: 88 1f adc r24, r24 + 3f2: 88 27 eor r24, r24 + 3f4: 88 1f adc r24, r24 + 3f6: 08 95 ret + +000003f8 : + } +} + +void Endpoint_ClearStatusStage(void) +{ + if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST) + 3f8: 80 91 0e 02 lds r24, 0x020E + 3fc: 88 23 and r24, r24 + 3fe: 9c f4 brge .+38 ; 0x426 + 400: 04 c0 rjmp .+8 ; 0x40a + { + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + 402: 80 91 0d 02 lds r24, 0x020D + 406: 88 23 and r24, r24 + 408: b9 f0 breq .+46 ; 0x438 + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + 40a: 80 91 e8 00 lds r24, 0x00E8 + +void Endpoint_ClearStatusStage(void) +{ + if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST) + { + while (!(Endpoint_IsOUTReceived())) + 40e: 82 ff sbrs r24, 2 + 410: f8 cf rjmp .-16 ; 0x402 + */ + static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearOUT(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); + 412: 80 91 e8 00 lds r24, 0x00E8 + 416: 8b 77 andi r24, 0x7B ; 123 + 418: 80 93 e8 00 sts 0x00E8, r24 + 41c: 08 95 ret + } + else + { + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + 41e: 80 91 0d 02 lds r24, 0x020D + 422: 88 23 and r24, r24 + 424: 49 f0 breq .+18 ; 0x438 + * \return Boolean true if the current endpoint is ready for an IN packet, false otherwise. + */ + static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsINReady(void) + { + return ((UEINTX & (1 << TXINI)) ? true : false); + 426: 80 91 e8 00 lds r24, 0x00E8 + + Endpoint_ClearOUT(); + } + else + { + while (!(Endpoint_IsINReady())) + 42a: 80 ff sbrs r24, 0 + 42c: f8 cf rjmp .-16 ; 0x41e + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + 42e: 80 91 e8 00 lds r24, 0x00E8 + 432: 8e 77 andi r24, 0x7E ; 126 + 434: 80 93 e8 00 sts 0x00E8, r24 + 438: 08 95 ret + +0000043a : + /** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host) + * the frame number is incremented by one. + */ + static inline uint16_t USB_Device_GetFrameNumber(void) + { + return UDFNUM; + 43a: 40 91 e4 00 lds r20, 0x00E4 + 43e: 50 91 e5 00 lds r21, 0x00E5 + 442: 24 e6 ldi r18, 0x64 ; 100 + * \return The currently selected endpoint's direction, as a ENDPOINT_DIR_* mask. + */ + static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_GetEndpointDirection(void) + { + return (UECFG0X & ENDPOINT_DIR_IN); + 444: 80 91 ec 00 lds r24, 0x00EC + + uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber(); + + for (;;) + { + if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) + 448: 80 ff sbrs r24, 0 + 44a: 05 c0 rjmp .+10 ; 0x456 + * \return Boolean true if the current endpoint is ready for an IN packet, false otherwise. + */ + static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsINReady(void) + { + return ((UEINTX & (1 << TXINI)) ? true : false); + 44c: 80 91 e8 00 lds r24, 0x00E8 + { + if (Endpoint_IsINReady()) + 450: 80 ff sbrs r24, 0 + 452: 05 c0 rjmp .+10 ; 0x45e + 454: 22 c0 rjmp .+68 ; 0x49a + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + 456: 80 91 e8 00 lds r24, 0x00E8 + return ENDPOINT_READYWAIT_NoError; + } + else + { + if (Endpoint_IsOUTReceived()) + 45a: 82 fd sbrc r24, 2 + 45c: 1e c0 rjmp .+60 ; 0x49a + return ENDPOINT_READYWAIT_NoError; + } + + uint8_t USB_DeviceState_LCL = USB_DeviceState; + 45e: 80 91 0d 02 lds r24, 0x020D + + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) + 462: 88 23 and r24, r24 + 464: 11 f4 brne .+4 ; 0x46a + 466: 82 e0 ldi r24, 0x02 ; 2 + 468: 08 95 ret + return ENDPOINT_READYWAIT_DeviceDisconnected; + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + 46a: 85 30 cpi r24, 0x05 ; 5 + 46c: 11 f4 brne .+4 ; 0x472 + 46e: 83 e0 ldi r24, 0x03 ; 3 + 470: 08 95 ret + * \return Boolean true if the currently selected endpoint is stalled, false otherwise. + */ + static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsStalled(void) + { + return ((UECONX & (1 << STALLRQ)) ? true : false); + 472: 80 91 eb 00 lds r24, 0x00EB + return ENDPOINT_READYWAIT_BusSuspended; + else if (Endpoint_IsStalled()) + 476: 85 ff sbrs r24, 5 + 478: 02 c0 rjmp .+4 ; 0x47e + 47a: 81 e0 ldi r24, 0x01 ; 1 + 47c: 08 95 ret + 47e: 80 91 e4 00 lds r24, 0x00E4 + 482: 90 91 e5 00 lds r25, 0x00E5 + return ENDPOINT_READYWAIT_EndpointStalled; + + uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber(); + + if (CurrentFrameNumber != PreviousFrameNumber) + 486: 84 17 cp r24, r20 + 488: 95 07 cpc r25, r21 + 48a: e1 f2 breq .-72 ; 0x444 + { + PreviousFrameNumber = CurrentFrameNumber; + + if (!(TimeoutMSRem--)) + 48c: 22 23 and r18, r18 + 48e: 11 f4 brne .+4 ; 0x494 + 490: 84 e0 ldi r24, 0x04 ; 4 + 492: 08 95 ret + 494: 21 50 subi r18, 0x01 ; 1 + 496: ac 01 movw r20, r24 + 498: d5 cf rjmp .-86 ; 0x444 + 49a: 80 e0 ldi r24, 0x00 ; 0 + return ENDPOINT_READYWAIT_Timeout; + } + } +} + 49c: 08 95 ret + +0000049e : +{ + #if defined(USB_CAN_BE_BOTH) + bool UIDModeSelectEnabled = ((UHWCON & (1 << UIDE)) != 0); + #endif + + USB_INT_DisableAllInterrupts(); + 49e: 41 d0 rcall .+130 ; 0x522 + USB_INT_ClearAllInterrupts(); + 4a0: 43 d0 rcall .+134 ; 0x528 + } + + static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; + static inline void USB_Controller_Reset(void) + { + const uint8_t Temp = USBCON; + 4a2: 80 91 d8 00 lds r24, 0x00D8 + + USBCON = (Temp & ~(1 << USBE)); + 4a6: 98 2f mov r25, r24 + 4a8: 9f 77 andi r25, 0x7F ; 127 + 4aa: 90 93 d8 00 sts 0x00D8, r25 + USBCON = (Temp | (1 << USBE)); + 4ae: 80 68 ori r24, 0x80 ; 128 + 4b0: 80 93 d8 00 sts 0x00D8, r24 + + /* Inline Functions: */ + static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE; + static inline void USB_PLL_On(void) + { + PLLCSR = USB_PLL_PSC; + 4b4: 84 e0 ldi r24, 0x04 ; 4 + 4b6: 89 bd out 0x29, r24 ; 41 + PLLCSR |= (1 << PLLE); + 4b8: 89 b5 in r24, 0x29 ; 41 + 4ba: 82 60 ori r24, 0x02 ; 2 + 4bc: 89 bd out 0x29, r24 ; 41 + #if defined(USB_SERIES_4_AVR) + PLLFRQ = ((1 << PLLUSB) | (1 << PDIV3) | (1 << PDIV1)); + #endif + + USB_PLL_On(); + while (!(USB_PLL_IsReady())); + 4be: 09 b4 in r0, 0x29 ; 41 + 4c0: 00 fe sbrs r0, 0 + 4c2: fd cf rjmp .-6 ; 0x4be + } + + static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE; + static inline void USB_CLK_Unfreeze(void) + { + USBCON &= ~(1 << FRZCLK); + 4c4: 80 91 d8 00 lds r24, 0x00D8 + 4c8: 8f 7d andi r24, 0xDF ; 223 + 4ca: 80 93 d8 00 sts 0x00D8, r24 +} + +#if defined(USB_CAN_BE_DEVICE) +static void USB_Init_Device(void) +{ + USB_DeviceState = DEVICE_STATE_Unattached; + 4ce: 10 92 0d 02 sts 0x020D, r1 + USB_ConfigurationNumber = 0; + 4d2: 10 92 0b 02 sts 0x020B, r1 + + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + USB_RemoteWakeupEnabled = false; + 4d6: 10 92 0a 02 sts 0x020A, r1 + #endif + + #if !defined(NO_DEVICE_SELF_POWER) + USB_CurrentlySelfPowered = false; + 4da: 10 92 09 02 sts 0x0209, r1 + const uint8_t Type, + const uint8_t Direction, + const uint16_t Size, + const uint8_t Banks) + { + return Endpoint_ConfigureEndpoint_Prv(Number, (((Type) << EPTYPE0) | (Direction)), + 4de: 80 e0 ldi r24, 0x00 ; 0 + 4e0: 60 e0 ldi r22, 0x00 ; 0 + 4e2: 42 e0 ldi r20, 0x02 ; 2 + 4e4: 76 df rcall .-276 ; 0x3d2 + + Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, + ENDPOINT_DIR_OUT, USB_ControlEndpointSize, + ENDPOINT_BANK_SINGLE); + + USB_INT_Clear(USB_INT_SUSPI); + 4e6: 80 91 e1 00 lds r24, 0x00E1 + 4ea: 8e 7f andi r24, 0xFE ; 254 + 4ec: 80 93 e1 00 sts 0x00E1, r24 + USB_INT_Enable(USB_INT_SUSPI); + 4f0: 80 91 e2 00 lds r24, 0x00E2 + 4f4: 81 60 ori r24, 0x01 ; 1 + 4f6: 80 93 e2 00 sts 0x00E2, r24 + USB_INT_Enable(USB_INT_EORSTI); + 4fa: 80 91 e2 00 lds r24, 0x00E2 + 4fe: 88 60 ori r24, 0x08 ; 8 + 500: 80 93 e2 00 sts 0x00E2, 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); + 504: 80 91 e0 00 lds r24, 0x00E0 + 508: 8e 7f andi r24, 0xFE ; 254 + 50a: 80 93 e0 00 sts 0x00E0, r24 + } + + #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) + USB_OTGPAD_On(); + #endif +} + 50e: 08 95 ret + +00000510 : + 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); + #else + REGCR &= ~(1 << REGDIS); + 510: e3 e6 ldi r30, 0x63 ; 99 + 512: f0 e0 ldi r31, 0x00 ; 0 + 514: 80 81 ld r24, Z + 516: 8e 7f andi r24, 0xFE ; 254 + 518: 80 83 st Z, r24 + { + USB_CurrentMode = Mode; + } + #endif + + USB_IsInitialized = true; + 51a: 81 e0 ldi r24, 0x01 ; 1 + 51c: 80 93 0c 02 sts 0x020C, r24 + + USB_ResetInterface(); +} + 520: be cf rjmp .-132 ; 0x49e + +00000522 : + #if defined(USB_CAN_BE_HOST) + UHIEN = 0; + #endif + + #if defined(USB_CAN_BE_DEVICE) + UDIEN = 0; + 522: 10 92 e2 00 sts 0x00E2, r1 + #endif +} + 526: 08 95 ret + +00000528 : + #if defined(USB_CAN_BE_HOST) + UHINT = 0; + #endif + + #if defined(USB_CAN_BE_DEVICE) + UDINT = 0; + 528: 10 92 e1 00 sts 0x00E1, r1 + #endif +} + 52c: 08 95 ret + +0000052e <__vector_11>: + +ISR(USB_GEN_vect, ISR_BLOCK) +{ + 52e: 1f 92 push r1 + 530: 0f 92 push r0 + 532: 0f b6 in r0, 0x3f ; 63 + 534: 0f 92 push r0 + 536: 11 24 eor r1, r1 + 538: 2f 93 push r18 + 53a: 3f 93 push r19 + 53c: 4f 93 push r20 + 53e: 5f 93 push r21 + 540: 6f 93 push r22 + 542: 7f 93 push r23 + 544: 8f 93 push r24 + 546: 9f 93 push r25 + 548: af 93 push r26 + 54a: bf 93 push r27 + 54c: ef 93 push r30 + 54e: ff 93 push r31 + EVENT_USB_Device_Disconnect(); + } + } + #endif + + if (USB_INT_HasOccurred(USB_INT_SUSPI) && USB_INT_IsEnabled(USB_INT_SUSPI)) + 550: 80 91 e1 00 lds r24, 0x00E1 + 554: 80 ff sbrs r24, 0 + 556: 1c c0 rjmp .+56 ; 0x590 <__vector_11+0x62> + 558: 80 91 e2 00 lds r24, 0x00E2 + 55c: 80 ff sbrs r24, 0 + 55e: 18 c0 rjmp .+48 ; 0x590 <__vector_11+0x62> + { + USB_INT_Clear(USB_INT_SUSPI); + 560: 80 91 e1 00 lds r24, 0x00E1 + 564: 8e 7f andi r24, 0xFE ; 254 + 566: 80 93 e1 00 sts 0x00E1, r24 + + USB_INT_Disable(USB_INT_SUSPI); + 56a: 80 91 e2 00 lds r24, 0x00E2 + 56e: 8e 7f andi r24, 0xFE ; 254 + 570: 80 93 e2 00 sts 0x00E2, r24 + USB_INT_Enable(USB_INT_WAKEUPI); + 574: 80 91 e2 00 lds r24, 0x00E2 + 578: 80 61 ori r24, 0x10 ; 16 + 57a: 80 93 e2 00 sts 0x00E2, r24 + #endif + + static inline void USB_CLK_Freeze(void) ATTR_ALWAYS_INLINE; + static inline void USB_CLK_Freeze(void) + { + USBCON |= (1 << FRZCLK); + 57e: 80 91 d8 00 lds r24, 0x00D8 + 582: 80 62 ori r24, 0x20 ; 32 + 584: 80 93 d8 00 sts 0x00D8, r24 + } + + static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE; + static inline void USB_PLL_Off(void) + { + PLLCSR = 0; + 588: 19 bc out 0x29, r1 ; 41 + + if (!(USB_Options & USB_OPT_MANUAL_PLL)) + USB_PLL_Off(); + + #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) + USB_DeviceState = DEVICE_STATE_Unattached; + 58a: 10 92 0d 02 sts 0x020D, r1 + EVENT_USB_Device_Disconnect(); + 58e: e9 dd rcall .-1070 ; 0x162 + USB_DeviceState = DEVICE_STATE_Suspended; + EVENT_USB_Device_Suspend(); + #endif + } + + if (USB_INT_HasOccurred(USB_INT_WAKEUPI) && USB_INT_IsEnabled(USB_INT_WAKEUPI)) + 590: 80 91 e1 00 lds r24, 0x00E1 + 594: 84 ff sbrs r24, 4 + 596: 2e c0 rjmp .+92 ; 0x5f4 <__vector_11+0xc6> + 598: 80 91 e2 00 lds r24, 0x00E2 + 59c: 84 ff sbrs r24, 4 + 59e: 2a c0 rjmp .+84 ; 0x5f4 <__vector_11+0xc6> + + /* Inline Functions: */ + static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE; + static inline void USB_PLL_On(void) + { + PLLCSR = USB_PLL_PSC; + 5a0: 84 e0 ldi r24, 0x04 ; 4 + 5a2: 89 bd out 0x29, r24 ; 41 + PLLCSR |= (1 << PLLE); + 5a4: 89 b5 in r24, 0x29 ; 41 + 5a6: 82 60 ori r24, 0x02 ; 2 + 5a8: 89 bd out 0x29, r24 ; 41 + { + if (!(USB_Options & USB_OPT_MANUAL_PLL)) + { + USB_PLL_On(); + while (!(USB_PLL_IsReady())); + 5aa: 09 b4 in r0, 0x29 ; 41 + 5ac: 00 fe sbrs r0, 0 + 5ae: fd cf rjmp .-6 ; 0x5aa <__vector_11+0x7c> + } + + static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE; + static inline void USB_CLK_Unfreeze(void) + { + USBCON &= ~(1 << FRZCLK); + 5b0: 80 91 d8 00 lds r24, 0x00D8 + 5b4: 8f 7d andi r24, 0xDF ; 223 + 5b6: 80 93 d8 00 sts 0x00D8, r24 + } + + USB_CLK_Unfreeze(); + + USB_INT_Clear(USB_INT_WAKEUPI); + 5ba: 80 91 e1 00 lds r24, 0x00E1 + 5be: 8f 7e andi r24, 0xEF ; 239 + 5c0: 80 93 e1 00 sts 0x00E1, r24 + + USB_INT_Disable(USB_INT_WAKEUPI); + 5c4: 80 91 e2 00 lds r24, 0x00E2 + 5c8: 8f 7e andi r24, 0xEF ; 239 + 5ca: 80 93 e2 00 sts 0x00E2, r24 + USB_INT_Enable(USB_INT_SUSPI); + 5ce: 80 91 e2 00 lds r24, 0x00E2 + 5d2: 81 60 ori r24, 0x01 ; 1 + 5d4: 80 93 e2 00 sts 0x00E2, r24 + + if (USB_ConfigurationNumber) + 5d8: 80 91 0b 02 lds r24, 0x020B + 5dc: 88 23 and r24, r24 + 5de: 31 f4 brne .+12 ; 0x5ec <__vector_11+0xbe> + } + + static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE; + static inline bool USB_Device_IsAddressSet(void) + { + return (UDADDR & (1 << ADDEN)); + 5e0: 80 91 e3 00 lds r24, 0x00E3 + USB_DeviceState = DEVICE_STATE_Configured; + else + USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; + 5e4: 87 fd sbrc r24, 7 + 5e6: 02 c0 rjmp .+4 ; 0x5ec <__vector_11+0xbe> + 5e8: 81 e0 ldi r24, 0x01 ; 1 + 5ea: 01 c0 rjmp .+2 ; 0x5ee <__vector_11+0xc0> + 5ec: 84 e0 ldi r24, 0x04 ; 4 + 5ee: 80 93 0d 02 sts 0x020D, r24 + + #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) + EVENT_USB_Device_Connect(); + 5f2: b6 dd rcall .-1172 ; 0x160 + #else + EVENT_USB_Device_WakeUp(); + #endif + } + + if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI)) + 5f4: 80 91 e1 00 lds r24, 0x00E1 + 5f8: 83 ff sbrs r24, 3 + 5fa: 22 c0 rjmp .+68 ; 0x640 <__vector_11+0x112> + 5fc: 80 91 e2 00 lds r24, 0x00E2 + 600: 83 ff sbrs r24, 3 + 602: 1e c0 rjmp .+60 ; 0x640 <__vector_11+0x112> + { + USB_INT_Clear(USB_INT_EORSTI); + 604: 80 91 e1 00 lds r24, 0x00E1 + 608: 87 7f andi r24, 0xF7 ; 247 + 60a: 80 93 e1 00 sts 0x00E1, r24 + + USB_DeviceState = DEVICE_STATE_Default; + 60e: 82 e0 ldi r24, 0x02 ; 2 + 610: 80 93 0d 02 sts 0x020D, r24 + USB_ConfigurationNumber = 0; + 614: 10 92 0b 02 sts 0x020B, r1 + + USB_INT_Clear(USB_INT_SUSPI); + 618: 80 91 e1 00 lds r24, 0x00E1 + 61c: 8e 7f andi r24, 0xFE ; 254 + 61e: 80 93 e1 00 sts 0x00E1, r24 + USB_INT_Disable(USB_INT_SUSPI); + 622: 80 91 e2 00 lds r24, 0x00E2 + 626: 8e 7f andi r24, 0xFE ; 254 + 628: 80 93 e2 00 sts 0x00E2, r24 + USB_INT_Enable(USB_INT_WAKEUPI); + 62c: 80 91 e2 00 lds r24, 0x00E2 + 630: 80 61 ori r24, 0x10 ; 16 + 632: 80 93 e2 00 sts 0x00E2, r24 + 636: 80 e0 ldi r24, 0x00 ; 0 + 638: 60 e0 ldi r22, 0x00 ; 0 + 63a: 42 e0 ldi r20, 0x02 ; 2 + 63c: ca de rcall .-620 ; 0x3d2 + + #if defined(INTERRUPT_CONTROL_ENDPOINT) + USB_INT_Enable(USB_INT_RXSTPI); + #endif + + EVENT_USB_Device_Reset(); + 63e: 4b d1 rcall .+662 ; 0x8d6 + } + + #if !defined(NO_SOF_EVENTS) + if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI)) + 640: 80 91 e1 00 lds r24, 0x00E1 + 644: 82 ff sbrs r24, 2 + 646: 0a c0 rjmp .+20 ; 0x65c <__vector_11+0x12e> + 648: 80 91 e2 00 lds r24, 0x00E2 + 64c: 82 ff sbrs r24, 2 + 64e: 06 c0 rjmp .+12 ; 0x65c <__vector_11+0x12e> + { + USB_INT_Clear(USB_INT_SOFI); + 650: 80 91 e1 00 lds r24, 0x00E1 + 654: 8b 7f andi r24, 0xFB ; 251 + 656: 80 93 e1 00 sts 0x00E1, r24 + + EVENT_USB_Device_StartOfFrame(); + 65a: 3d d1 rcall .+634 ; 0x8d6 + USB_ResetInterface(); + + EVENT_USB_UIDChange(); + } + #endif +} + 65c: ff 91 pop r31 + 65e: ef 91 pop r30 + 660: bf 91 pop r27 + 662: af 91 pop r26 + 664: 9f 91 pop r25 + 666: 8f 91 pop r24 + 668: 7f 91 pop r23 + 66a: 6f 91 pop r22 + 66c: 5f 91 pop r21 + 66e: 4f 91 pop r20 + 670: 3f 91 pop r19 + 672: 2f 91 pop r18 + 674: 0f 90 pop r0 + 676: 0f be out 0x3f, r0 ; 63 + 678: 0f 90 pop r0 + 67a: 1f 90 pop r1 + 67c: 18 95 reti + +0000067e : +#if !defined(NO_DEVICE_REMOTE_WAKEUP) +bool USB_RemoteWakeupEnabled; +#endif + +void USB_Device_ProcessControlRequest(void) +{ + 67e: 0f 93 push r16 + 680: 1f 93 push r17 + 682: df 93 push r29 + 684: cf 93 push r28 + 686: 00 d0 rcall .+0 ; 0x688 + 688: cd b7 in r28, 0x3d ; 61 + 68a: de b7 in r29, 0x3e ; 62 + 68c: ee e0 ldi r30, 0x0E ; 14 + 68e: f2 e0 ldi r31, 0x02 ; 2 + * \return Next byte in the currently selected endpoint's FIFO buffer. + */ + static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_Read_Byte(void) + { + return UEDATX; + 690: 80 91 f1 00 lds r24, 0x00F1 + uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest; + + for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++) + *(RequestHeader++) = Endpoint_Read_Byte(); + 694: 81 93 st Z+, r24 + +void USB_Device_ProcessControlRequest(void) +{ + uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest; + + for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++) + 696: 82 e0 ldi r24, 0x02 ; 2 + 698: e6 31 cpi r30, 0x16 ; 22 + 69a: f8 07 cpc r31, r24 + 69c: c9 f7 brne .-14 ; 0x690 + *(RequestHeader++) = Endpoint_Read_Byte(); + + EVENT_USB_Device_ControlRequest(); + 69e: 80 dd rcall .-1280 ; 0x1a0 + * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise. + */ + static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsSETUPReceived(void) + { + return ((UEINTX & (1 << RXSTPI)) ? true : false); + 6a0: 80 91 e8 00 lds r24, 0x00E8 + + if (Endpoint_IsSETUPReceived()) + 6a4: 83 ff sbrs r24, 3 + 6a6: 02 c1 rjmp .+516 ; 0x8ac + { + uint8_t bmRequestType = USB_ControlRequest.bmRequestType; + 6a8: 80 91 0e 02 lds r24, 0x020E + + switch (USB_ControlRequest.bRequest) + 6ac: 30 91 0f 02 lds r19, 0x020F + 6b0: 35 30 cpi r19, 0x05 ; 5 + 6b2: 09 f4 brne .+2 ; 0x6b6 + 6b4: 87 c0 rjmp .+270 ; 0x7c4 + 6b6: 36 30 cpi r19, 0x06 ; 6 + 6b8: 40 f4 brcc .+16 ; 0x6ca + 6ba: 31 30 cpi r19, 0x01 ; 1 + 6bc: c9 f1 breq .+114 ; 0x730 + 6be: 31 30 cpi r19, 0x01 ; 1 + 6c0: 70 f0 brcs .+28 ; 0x6de + 6c2: 33 30 cpi r19, 0x03 ; 3 + 6c4: 09 f0 breq .+2 ; 0x6c8 + 6c6: f2 c0 rjmp .+484 ; 0x8ac + 6c8: 33 c0 rjmp .+102 ; 0x730 + 6ca: 38 30 cpi r19, 0x08 ; 8 + 6cc: 09 f4 brne .+2 ; 0x6d0 + 6ce: c0 c0 rjmp .+384 ; 0x850 + 6d0: 39 30 cpi r19, 0x09 ; 9 + 6d2: 09 f4 brne .+2 ; 0x6d6 + 6d4: cf c0 rjmp .+414 ; 0x874 + 6d6: 36 30 cpi r19, 0x06 ; 6 + 6d8: 09 f0 breq .+2 ; 0x6dc + 6da: e8 c0 rjmp .+464 ; 0x8ac + 6dc: 99 c0 rjmp .+306 ; 0x810 + { + case REQ_GetStatus: + if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) || + 6de: 80 38 cpi r24, 0x80 ; 128 + 6e0: 21 f0 breq .+8 ; 0x6ea + 6e2: 82 38 cpi r24, 0x82 ; 130 + 6e4: 09 f0 breq .+2 ; 0x6e8 + 6e6: e2 c0 rjmp .+452 ; 0x8ac + 6e8: 08 c0 rjmp .+16 ; 0x6fa + 6ea: 90 91 09 02 lds r25, 0x0209 + if (USB_CurrentlySelfPowered) + CurrentStatus |= FEATURE_SELFPOWERED_ENABLED; + #endif + + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + if (USB_RemoteWakeupEnabled) + 6ee: 80 91 0a 02 lds r24, 0x020A + 6f2: 88 23 and r24, r24 + 6f4: 99 f0 breq .+38 ; 0x71c + CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED; + 6f6: 92 60 ori r25, 0x02 ; 2 + 6f8: 11 c0 rjmp .+34 ; 0x71c + #endif + break; + #endif + #if !defined(CONTROL_ONLY_DEVICE) + case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT): + Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); + 6fa: 80 91 12 02 lds r24, 0x0212 + 6fe: 87 70 andi r24, 0x07 ; 7 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + 700: 80 93 e9 00 sts 0x00E9, r24 + * \return Boolean true if the currently selected endpoint is stalled, false otherwise. + */ + static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsStalled(void) + { + return ((UECONX & (1 << STALLRQ)) ? true : false); + 704: 80 91 eb 00 lds r24, 0x00EB + + CurrentStatus = Endpoint_IsStalled(); + 708: 90 e0 ldi r25, 0x00 ; 0 + 70a: 25 e0 ldi r18, 0x05 ; 5 + 70c: 96 95 lsr r25 + 70e: 87 95 ror r24 + 710: 2a 95 dec r18 + 712: e1 f7 brne .-8 ; 0x70c + 714: 98 2f mov r25, r24 + 716: 91 70 andi r25, 0x01 ; 1 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + 718: 10 92 e9 00 sts 0x00E9, r1 + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + 71c: 80 91 e8 00 lds r24, 0x00E8 + 720: 87 7f andi r24, 0xF7 ; 247 + 722: 80 93 e8 00 sts 0x00E8, r24 + * \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_Word_LE(const uint16_t Word) + { + UEDATX = (Word & 0xFF); + 726: 90 93 f1 00 sts 0x00F1, r25 + UEDATX = (Word >> 8); + 72a: 10 92 f1 00 sts 0x00F1, r1 + 72e: 9b c0 rjmp .+310 ; 0x866 + } + + break; + case REQ_ClearFeature: + case REQ_SetFeature: + if ((bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) || + 730: 88 23 and r24, r24 + 732: 19 f0 breq .+6 ; 0x73a + 734: 82 30 cpi r24, 0x02 ; 2 + 736: 09 f0 breq .+2 ; 0x73a + 738: b9 c0 rjmp .+370 ; 0x8ac + Endpoint_ClearStatusStage(); +} + +static void USB_Device_ClearSetFeature(void) +{ + switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) + 73a: 90 e0 ldi r25, 0x00 ; 0 + 73c: 8f 71 andi r24, 0x1F ; 31 + 73e: 90 70 andi r25, 0x00 ; 0 + 740: 00 97 sbiw r24, 0x00 ; 0 + 742: 21 f0 breq .+8 ; 0x74c + 744: 02 97 sbiw r24, 0x02 ; 2 + 746: 09 f0 breq .+2 ; 0x74a + 748: b1 c0 rjmp .+354 ; 0x8ac + 74a: 0c c0 rjmp .+24 ; 0x764 + { + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + case REQREC_DEVICE: + if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup) + 74c: 80 91 10 02 lds r24, 0x0210 + 750: 81 30 cpi r24, 0x01 ; 1 + 752: 09 f0 breq .+2 ; 0x756 + 754: ab c0 rjmp .+342 ; 0x8ac + USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature); + 756: 10 92 0a 02 sts 0x020A, r1 + 75a: 33 30 cpi r19, 0x03 ; 3 + 75c: 69 f5 brne .+90 ; 0x7b8 + 75e: 80 93 0a 02 sts 0x020A, r24 + 762: 2a c0 rjmp .+84 ; 0x7b8 + + break; + #endif + #if !defined(CONTROL_ONLY_DEVICE) + case REQREC_ENDPOINT: + if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt) + 764: 80 91 10 02 lds r24, 0x0210 + 768: 88 23 and r24, r24 + 76a: 31 f5 brne .+76 ; 0x7b8 + { + uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); + 76c: 20 91 12 02 lds r18, 0x0212 + 770: 27 70 andi r18, 0x07 ; 7 + + if (EndpointIndex == ENDPOINT_CONTROLEP) + 772: 09 f4 brne .+2 ; 0x776 + 774: 9b c0 rjmp .+310 ; 0x8ac + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + 776: 20 93 e9 00 sts 0x00E9, r18 + * \return Boolean True if the currently selected endpoint is enabled, false otherwise. + */ + static inline bool Endpoint_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsEnabled(void) + { + return ((UECONX & (1 << EPEN)) ? true : false); + 77a: 80 91 eb 00 lds r24, 0x00EB + return; + + Endpoint_SelectEndpoint(EndpointIndex); + + if (Endpoint_IsEnabled()) + 77e: 80 ff sbrs r24, 0 + 780: 1b c0 rjmp .+54 ; 0x7b8 + { + if (USB_ControlRequest.bRequest == REQ_SetFeature) + 782: 33 30 cpi r19, 0x03 ; 3 + 784: 21 f4 brne .+8 ; 0x78e + * \ingroup Group_EndpointPacketManagement + */ + static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_StallTransaction(void) + { + UECONX |= (1 << STALLRQ); + 786: 80 91 eb 00 lds r24, 0x00EB + 78a: 80 62 ori r24, 0x20 ; 32 + 78c: 13 c0 rjmp .+38 ; 0x7b4 + * \ingroup Group_EndpointPacketManagement + */ + static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearStall(void) + { + UECONX |= (1 << STALLRQC); + 78e: 80 91 eb 00 lds r24, 0x00EB + 792: 80 61 ori r24, 0x10 ; 16 + 794: 80 93 eb 00 sts 0x00EB, r24 + * \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset. + */ + static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber) + { + UERST = (1 << EndpointNumber); + 798: 81 e0 ldi r24, 0x01 ; 1 + 79a: 90 e0 ldi r25, 0x00 ; 0 + 79c: 02 c0 rjmp .+4 ; 0x7a2 + 79e: 88 0f add r24, r24 + 7a0: 99 1f adc r25, r25 + 7a2: 2a 95 dec r18 + 7a4: e2 f7 brpl .-8 ; 0x79e + 7a6: 80 93 ea 00 sts 0x00EA, r24 + UERST = 0; + 7aa: 10 92 ea 00 sts 0x00EA, r1 + + /** Resets the data toggle of the currently selected endpoint. */ + static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ResetDataToggle(void) + { + UECONX |= (1 << RSTDT); + 7ae: 80 91 eb 00 lds r24, 0x00EB + 7b2: 88 60 ori r24, 0x08 ; 8 + 7b4: 80 93 eb 00 sts 0x00EB, r24 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + 7b8: 10 92 e9 00 sts 0x00E9, r1 + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + 7bc: 80 91 e8 00 lds r24, 0x00E8 + 7c0: 87 7f andi r24, 0xF7 ; 247 + 7c2: 54 c0 rjmp .+168 ; 0x86c + USB_Device_ClearSetFeature(); + } + + break; + case REQ_SetAddress: + if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) + 7c4: 88 23 and r24, r24 + 7c6: 09 f0 breq .+2 ; 0x7ca + 7c8: 71 c0 rjmp .+226 ; 0x8ac + } +} + +static void USB_Device_SetAddress(void) +{ + uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); + 7ca: 10 91 10 02 lds r17, 0x0210 + 7ce: 1f 77 andi r17, 0x7F ; 127 + + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + 7d0: 0f b7 in r16, 0x3f ; 63 + return 1; +} + +static __inline__ uint8_t __iCliRetVal(void) +{ + cli(); + 7d2: f8 94 cli + 7d4: 80 91 e8 00 lds r24, 0x00E8 + 7d8: 87 7f andi r24, 0xF7 ; 247 + 7da: 80 93 e8 00 sts 0x00E8, r24 + { + Endpoint_ClearSETUP(); + + Endpoint_ClearStatusStage(); + 7de: 0c de rcall .-1000 ; 0x3f8 + * \return Boolean true if the current endpoint is ready for an IN packet, false otherwise. + */ + static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsINReady(void) + { + return ((UEINTX & (1 << TXINI)) ? true : false); + 7e0: 80 91 e8 00 lds r24, 0x00E8 + + while (!(Endpoint_IsINReady())); + 7e4: 80 ff sbrs r24, 0 + 7e6: fc cf rjmp .-8 ; 0x7e0 + + USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default; + 7e8: 11 23 and r17, r17 + 7ea: 11 f4 brne .+4 ; 0x7f0 + 7ec: 82 e0 ldi r24, 0x02 ; 2 + 7ee: 01 c0 rjmp .+2 ; 0x7f2 + 7f0: 83 e0 ldi r24, 0x03 ; 3 + 7f2: 80 93 0d 02 sts 0x020D, r24 + #endif + + static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; + static inline void USB_Device_SetDeviceAddress(const uint8_t Address) + { + UDADDR = ((UDADDR & (1 << ADDEN)) | (Address & 0x7F)); + 7f6: 80 91 e3 00 lds r24, 0x00E3 + 7fa: 80 78 andi r24, 0x80 ; 128 + 7fc: 18 2b or r17, r24 + 7fe: 10 93 e3 00 sts 0x00E3, r17 + UDADDR |= (1 << ADDEN); + 802: 80 91 e3 00 lds r24, 0x00E3 + 806: 80 68 ori r24, 0x80 ; 128 + 808: 80 93 e3 00 sts 0x00E3, r24 + (void)__s; +} + +static __inline__ void __iRestore(const uint8_t *__s) +{ + SREG = *__s; + 80c: 0f bf out 0x3f, r16 ; 63 + __asm__ volatile ("" ::: "memory"); + 80e: 4e c0 rjmp .+156 ; 0x8ac + if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) + USB_Device_SetAddress(); + + break; + case REQ_GetDescriptor: + if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) || + 810: 80 58 subi r24, 0x80 ; 128 + 812: 82 30 cpi r24, 0x02 ; 2 + 814: 08 f0 brcs .+2 ; 0x818 + 816: 4a c0 rjmp .+148 ; 0x8ac + USB_Device_GetInternalSerialDescriptor(); + return; + } + #endif + + if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex, + 818: 80 91 10 02 lds r24, 0x0210 + 81c: 90 91 11 02 lds r25, 0x0211 + 820: 60 91 12 02 lds r22, 0x0212 + 824: ae 01 movw r20, r28 + 826: 4f 5f subi r20, 0xFF ; 255 + 828: 5f 4f sbci r21, 0xFF ; 255 + 82a: a5 dd rcall .-1206 ; 0x376 + 82c: bc 01 movw r22, r24 + 82e: 00 97 sbiw r24, 0x00 ; 0 + 830: 09 f4 brne .+2 ; 0x834 + 832: 3c c0 rjmp .+120 ; 0x8ac + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + 834: 80 91 e8 00 lds r24, 0x00E8 + 838: 87 7f andi r24, 0xF7 ; 247 + 83a: 80 93 e8 00 sts 0x00E8, r24 + #if defined(USE_RAM_DESCRIPTORS) + Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize); + #elif defined(USE_EEPROM_DESCRIPTORS) + Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize); + #elif defined(USE_FLASH_DESCRIPTORS) + Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize); + 83e: 89 81 ldd r24, Y+1 ; 0x01 + 840: 9a 81 ldd r25, Y+2 ; 0x02 + 842: a8 d0 rcall .+336 ; 0x994 + */ + static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearOUT(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); + 844: 80 91 e8 00 lds r24, 0x00E8 + 848: 8b 77 andi r24, 0x7B ; 123 + 84a: 80 93 e8 00 sts 0x00E8, r24 + 84e: 2e c0 rjmp .+92 ; 0x8ac + USB_Device_GetDescriptor(); + } + + break; + case REQ_GetConfiguration: + if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) + 850: 80 38 cpi r24, 0x80 ; 128 + 852: 61 f5 brne .+88 ; 0x8ac + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + 854: 80 91 e8 00 lds r24, 0x00E8 + 858: 87 7f andi r24, 0xF7 ; 247 + 85a: 80 93 e8 00 sts 0x00E8, r24 + +static void USB_Device_GetConfiguration(void) +{ + Endpoint_ClearSETUP(); + + Endpoint_Write_Byte(USB_ConfigurationNumber); + 85e: 80 91 0b 02 lds r24, 0x020B + * \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_Byte(const uint8_t Byte) + { + UEDATX = Byte; + 862: 80 93 f1 00 sts 0x00F1, r24 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + 866: 80 91 e8 00 lds r24, 0x00E8 + 86a: 8e 77 andi r24, 0x7E ; 126 + 86c: 80 93 e8 00 sts 0x00E8, r24 + Endpoint_ClearIN(); + + Endpoint_ClearStatusStage(); + 870: c3 dd rcall .-1146 ; 0x3f8 + 872: 1c c0 rjmp .+56 ; 0x8ac + if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) + USB_Device_GetConfiguration(); + + break; + case REQ_SetConfiguration: + if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) + 874: 88 23 and r24, r24 + 876: d1 f4 brne .+52 ; 0x8ac +} + +static void USB_Device_SetConfiguration(void) +{ + #if defined(FIXED_NUM_CONFIGURATIONS) + if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS) + 878: 90 91 10 02 lds r25, 0x0210 + 87c: 92 30 cpi r25, 0x02 ; 2 + 87e: b0 f4 brcc .+44 ; 0x8ac + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + 880: 80 91 e8 00 lds r24, 0x00E8 + 884: 87 7f andi r24, 0xF7 ; 247 + 886: 80 93 e8 00 sts 0x00E8, r24 + } + #endif + + Endpoint_ClearSETUP(); + + USB_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue; + 88a: 90 93 0b 02 sts 0x020B, r25 + + Endpoint_ClearStatusStage(); + 88e: b4 dd rcall .-1176 ; 0x3f8 + + if (USB_ConfigurationNumber) + 890: 80 91 0b 02 lds r24, 0x020B + 894: 88 23 and r24, r24 + 896: 31 f4 brne .+12 ; 0x8a4 + } + + static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE; + static inline bool USB_Device_IsAddressSet(void) + { + return (UDADDR & (1 << ADDEN)); + 898: 80 91 e3 00 lds r24, 0x00E3 + USB_DeviceState = DEVICE_STATE_Configured; + else + USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; + 89c: 87 fd sbrc r24, 7 + 89e: 02 c0 rjmp .+4 ; 0x8a4 + 8a0: 81 e0 ldi r24, 0x01 ; 1 + 8a2: 01 c0 rjmp .+2 ; 0x8a6 + 8a4: 84 e0 ldi r24, 0x04 ; 4 + 8a6: 80 93 0d 02 sts 0x020D, r24 + + EVENT_USB_Device_ConfigurationChanged(); + 8aa: 7d dc rcall .-1798 ; 0x1a6 + * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise. + */ + static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsSETUPReceived(void) + { + return ((UEINTX & (1 << RXSTPI)) ? true : false); + 8ac: 80 91 e8 00 lds r24, 0x00E8 + + break; + } + } + + if (Endpoint_IsSETUPReceived()) + 8b0: 83 ff sbrs r24, 3 + 8b2: 0a c0 rjmp .+20 ; 0x8c8 + * \ingroup Group_EndpointPacketManagement + */ + static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_StallTransaction(void) + { + UECONX |= (1 << STALLRQ); + 8b4: 80 91 eb 00 lds r24, 0x00EB + 8b8: 80 62 ori r24, 0x20 ; 32 + 8ba: 80 93 eb 00 sts 0x00EB, r24 + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + 8be: 80 91 e8 00 lds r24, 0x00E8 + 8c2: 87 7f andi r24, 0xF7 ; 247 + 8c4: 80 93 e8 00 sts 0x00E8, r24 + { + Endpoint_StallTransaction(); + Endpoint_ClearSETUP(); + } +} + 8c8: 0f 90 pop r0 + 8ca: 0f 90 pop r0 + 8cc: cf 91 pop r28 + 8ce: df 91 pop r29 + 8d0: 1f 91 pop r17 + 8d2: 0f 91 pop r16 + 8d4: 08 95 ret + +000008d6 : +#include "Events.h" + +void USB_Event_Stub(void) +{ + +} + 8d6: 08 95 ret + +000008d8 : + 8d8: 9c 01 movw r18, r24 + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + bool LastPacketFull = false; + + if (Length > USB_ControlRequest.wLength) + 8da: 40 91 14 02 lds r20, 0x0214 + 8de: 50 91 15 02 lds r21, 0x0215 + 8e2: 46 17 cp r20, r22 + 8e4: 57 07 cpc r21, r23 + 8e6: 18 f4 brcc .+6 ; 0x8ee +uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, + uint16_t Length) +{ + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + 8e8: f9 01 movw r30, r18 + 8ea: 90 e0 ldi r25, 0x00 ; 0 + 8ec: 3d c0 rjmp .+122 ; 0x968 + bool LastPacketFull = false; + + if (Length > USB_ControlRequest.wLength) + Length = USB_ControlRequest.wLength; + else if (!(Length)) + 8ee: 61 15 cp r22, r1 + 8f0: 71 05 cpc r23, r1 + 8f2: 11 f0 breq .+4 ; 0x8f8 + 8f4: ab 01 movw r20, r22 + 8f6: f8 cf rjmp .-16 ; 0x8e8 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + 8f8: 80 91 e8 00 lds r24, 0x00E8 + 8fc: 8e 77 andi r24, 0x7E ; 126 + 8fe: 80 93 e8 00 sts 0x00E8, r24 + 902: 40 e0 ldi r20, 0x00 ; 0 + 904: 50 e0 ldi r21, 0x00 ; 0 + 906: f0 cf rjmp .-32 ; 0x8e8 + Endpoint_ClearIN(); + + while (Length || LastPacketFull) + { + uint8_t USB_DeviceState_LCL = USB_DeviceState; + 908: 80 91 0d 02 lds r24, 0x020D + + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) + 90c: 88 23 and r24, r24 + 90e: f1 f1 breq .+124 ; 0x98c + return ENDPOINT_RWCSTREAM_DeviceDisconnected; + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + 910: 85 30 cpi r24, 0x05 ; 5 + 912: f1 f1 breq .+124 ; 0x990 + * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise. + */ + static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsSETUPReceived(void) + { + return ((UEINTX & (1 << RXSTPI)) ? true : false); + 914: 80 91 e8 00 lds r24, 0x00E8 + return ENDPOINT_RWCSTREAM_BusSuspended; + else if (Endpoint_IsSETUPReceived()) + 918: 83 ff sbrs r24, 3 + 91a: 02 c0 rjmp .+4 ; 0x920 + 91c: 81 e0 ldi r24, 0x01 ; 1 + 91e: 08 95 ret + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + 920: 80 91 e8 00 lds r24, 0x00E8 + return ENDPOINT_RWCSTREAM_HostAborted; + else if (Endpoint_IsOUTReceived()) + 924: 82 fd sbrc r24, 2 + 926: 2c c0 rjmp .+88 ; 0x980 + * \return Boolean true if the current endpoint is ready for an IN packet, false otherwise. + */ + static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsINReady(void) + { + return ((UEINTX & (1 << TXINI)) ? true : false); + 928: 80 91 e8 00 lds r24, 0x00E8 + break; + + if (Endpoint_IsINReady()) + 92c: 80 ff sbrs r24, 0 + 92e: 1c c0 rjmp .+56 ; 0x968 + #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + return UEBCX; + #elif defined(USB_SERIES_4_AVR) + return (((uint16_t)UEBCHX << 8) | UEBCLX); + #elif defined(USB_SERIES_2_AVR) + return UEBCLX; + 930: 80 91 f2 00 lds r24, 0x00F2 + 934: 28 2f mov r18, r24 + 936: 30 e0 ldi r19, 0x00 ; 0 + 938: 07 c0 rjmp .+14 ; 0x948 + { + uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); + + while (Length && (BytesInEndpoint < USB_ControlEndpointSize)) + { + TEMPLATE_TRANSFER_BYTE(DataStream); + 93a: 81 91 ld r24, Z+ + * \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_Byte(const uint8_t Byte) + { + UEDATX = Byte; + 93c: 80 93 f1 00 sts 0x00F1, r24 + Length--; + 940: 41 50 subi r20, 0x01 ; 1 + 942: 50 40 sbci r21, 0x00 ; 0 + BytesInEndpoint++; + 944: 2f 5f subi r18, 0xFF ; 255 + 946: 3f 4f sbci r19, 0xFF ; 255 + + if (Endpoint_IsINReady()) + { + uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); + + while (Length && (BytesInEndpoint < USB_ControlEndpointSize)) + 948: 41 15 cp r20, r1 + 94a: 51 05 cpc r21, r1 + 94c: 19 f0 breq .+6 ; 0x954 + 94e: 28 30 cpi r18, 0x08 ; 8 + 950: 31 05 cpc r19, r1 + 952: 98 f3 brcs .-26 ; 0x93a + TEMPLATE_TRANSFER_BYTE(DataStream); + Length--; + BytesInEndpoint++; + } + + LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize); + 954: 90 e0 ldi r25, 0x00 ; 0 + 956: 28 30 cpi r18, 0x08 ; 8 + 958: 31 05 cpc r19, r1 + 95a: 09 f4 brne .+2 ; 0x95e + 95c: 91 e0 ldi r25, 0x01 ; 1 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + 95e: 80 91 e8 00 lds r24, 0x00E8 + 962: 8e 77 andi r24, 0x7E ; 126 + 964: 80 93 e8 00 sts 0x00E8, r24 + if (Length > USB_ControlRequest.wLength) + Length = USB_ControlRequest.wLength; + else if (!(Length)) + Endpoint_ClearIN(); + + while (Length || LastPacketFull) + 968: 41 15 cp r20, r1 + 96a: 51 05 cpc r21, r1 + 96c: 69 f6 brne .-102 ; 0x908 + 96e: 99 23 and r25, r25 + 970: 59 f6 brne .-106 ; 0x908 + 972: 06 c0 rjmp .+12 ; 0x980 + } + } + + while (!(Endpoint_IsOUTReceived())) + { + uint8_t USB_DeviceState_LCL = USB_DeviceState; + 974: 80 91 0d 02 lds r24, 0x020D + + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) + 978: 88 23 and r24, r24 + 97a: 41 f0 breq .+16 ; 0x98c + return ENDPOINT_RWCSTREAM_DeviceDisconnected; + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + 97c: 85 30 cpi r24, 0x05 ; 5 + 97e: 41 f0 breq .+16 ; 0x990 + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + 980: 80 91 e8 00 lds r24, 0x00E8 + LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize); + Endpoint_ClearIN(); + } + } + + while (!(Endpoint_IsOUTReceived())) + 984: 82 ff sbrs r24, 2 + 986: f6 cf rjmp .-20 ; 0x974 + 988: 80 e0 ldi r24, 0x00 ; 0 + 98a: 08 95 ret + 98c: 82 e0 ldi r24, 0x02 ; 2 + 98e: 08 95 ret + 990: 83 e0 ldi r24, 0x03 ; 3 + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + return ENDPOINT_RWCSTREAM_BusSuspended; + } + + return ENDPOINT_RWCSTREAM_NoError; +} + 992: 08 95 ret + +00000994 : +uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, + uint16_t Length) +{ + 994: 9c 01 movw r18, r24 + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + bool LastPacketFull = false; + + if (Length > USB_ControlRequest.wLength) + 996: 40 91 14 02 lds r20, 0x0214 + 99a: 50 91 15 02 lds r21, 0x0215 + 99e: 46 17 cp r20, r22 + 9a0: 57 07 cpc r21, r23 + 9a2: 10 f4 brcc .+4 ; 0x9a8 +uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, + uint16_t Length) +{ + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + 9a4: 60 e0 ldi r22, 0x00 ; 0 + 9a6: 3f c0 rjmp .+126 ; 0xa26 + bool LastPacketFull = false; + + if (Length > USB_ControlRequest.wLength) + Length = USB_ControlRequest.wLength; + else if (!(Length)) + 9a8: 61 15 cp r22, r1 + 9aa: 71 05 cpc r23, r1 + 9ac: 11 f0 breq .+4 ; 0x9b2 + 9ae: ab 01 movw r20, r22 + 9b0: f9 cf rjmp .-14 ; 0x9a4 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + 9b2: 80 91 e8 00 lds r24, 0x00E8 + 9b6: 8e 77 andi r24, 0x7E ; 126 + 9b8: 80 93 e8 00 sts 0x00E8, r24 + 9bc: 40 e0 ldi r20, 0x00 ; 0 + 9be: 50 e0 ldi r21, 0x00 ; 0 + 9c0: f1 cf rjmp .-30 ; 0x9a4 + Endpoint_ClearIN(); + + while (Length || LastPacketFull) + { + uint8_t USB_DeviceState_LCL = USB_DeviceState; + 9c2: 80 91 0d 02 lds r24, 0x020D + + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) + 9c6: 88 23 and r24, r24 + 9c8: 09 f4 brne .+2 ; 0x9cc + 9ca: 3f c0 rjmp .+126 ; 0xa4a + return ENDPOINT_RWCSTREAM_DeviceDisconnected; + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + 9cc: 85 30 cpi r24, 0x05 ; 5 + 9ce: 09 f4 brne .+2 ; 0x9d2 + 9d0: 3e c0 rjmp .+124 ; 0xa4e + * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise. + */ + static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsSETUPReceived(void) + { + return ((UEINTX & (1 << RXSTPI)) ? true : false); + 9d2: 80 91 e8 00 lds r24, 0x00E8 + return ENDPOINT_RWCSTREAM_BusSuspended; + else if (Endpoint_IsSETUPReceived()) + 9d6: 83 ff sbrs r24, 3 + 9d8: 02 c0 rjmp .+4 ; 0x9de + 9da: 81 e0 ldi r24, 0x01 ; 1 + 9dc: 08 95 ret + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + 9de: 80 91 e8 00 lds r24, 0x00E8 + return ENDPOINT_RWCSTREAM_HostAborted; + else if (Endpoint_IsOUTReceived()) + 9e2: 82 fd sbrc r24, 2 + 9e4: 2c c0 rjmp .+88 ; 0xa3e + * \return Boolean true if the current endpoint is ready for an IN packet, false otherwise. + */ + static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsINReady(void) + { + return ((UEINTX & (1 << TXINI)) ? true : false); + 9e6: 80 91 e8 00 lds r24, 0x00E8 + break; + + if (Endpoint_IsINReady()) + 9ea: 80 ff sbrs r24, 0 + 9ec: 1c c0 rjmp .+56 ; 0xa26 + #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + return UEBCX; + #elif defined(USB_SERIES_4_AVR) + return (((uint16_t)UEBCHX << 8) | UEBCLX); + #elif defined(USB_SERIES_2_AVR) + return UEBCLX; + 9ee: 80 91 f2 00 lds r24, 0x00F2 + 9f2: 90 e0 ldi r25, 0x00 ; 0 + 9f4: 09 c0 rjmp .+18 ; 0xa08 + { + uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); + + while (Length && (BytesInEndpoint < USB_ControlEndpointSize)) + 9f6: f9 01 movw r30, r18 + { + TEMPLATE_TRANSFER_BYTE(DataStream); + 9f8: 2f 5f subi r18, 0xFF ; 255 + 9fa: 3f 4f sbci r19, 0xFF ; 255 + 9fc: e4 91 lpm r30, Z+ + * \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_Byte(const uint8_t Byte) + { + UEDATX = Byte; + 9fe: e0 93 f1 00 sts 0x00F1, r30 + Length--; + a02: 41 50 subi r20, 0x01 ; 1 + a04: 50 40 sbci r21, 0x00 ; 0 + BytesInEndpoint++; + a06: 01 96 adiw r24, 0x01 ; 1 + + if (Endpoint_IsINReady()) + { + uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); + + while (Length && (BytesInEndpoint < USB_ControlEndpointSize)) + a08: 41 15 cp r20, r1 + a0a: 51 05 cpc r21, r1 + a0c: 19 f0 breq .+6 ; 0xa14 + a0e: 88 30 cpi r24, 0x08 ; 8 + a10: 91 05 cpc r25, r1 + a12: 88 f3 brcs .-30 ; 0x9f6 + TEMPLATE_TRANSFER_BYTE(DataStream); + Length--; + BytesInEndpoint++; + } + + LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize); + a14: 60 e0 ldi r22, 0x00 ; 0 + a16: 08 97 sbiw r24, 0x08 ; 8 + a18: 09 f4 brne .+2 ; 0xa1c + a1a: 61 e0 ldi r22, 0x01 ; 1 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + a1c: 80 91 e8 00 lds r24, 0x00E8 + a20: 8e 77 andi r24, 0x7E ; 126 + a22: 80 93 e8 00 sts 0x00E8, r24 + if (Length > USB_ControlRequest.wLength) + Length = USB_ControlRequest.wLength; + else if (!(Length)) + Endpoint_ClearIN(); + + while (Length || LastPacketFull) + a26: 41 15 cp r20, r1 + a28: 51 05 cpc r21, r1 + a2a: 59 f6 brne .-106 ; 0x9c2 + a2c: 66 23 and r22, r22 + a2e: 49 f6 brne .-110 ; 0x9c2 + a30: 06 c0 rjmp .+12 ; 0xa3e + } + } + + while (!(Endpoint_IsOUTReceived())) + { + uint8_t USB_DeviceState_LCL = USB_DeviceState; + a32: 80 91 0d 02 lds r24, 0x020D + + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) + a36: 88 23 and r24, r24 + a38: 41 f0 breq .+16 ; 0xa4a + return ENDPOINT_RWCSTREAM_DeviceDisconnected; + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + a3a: 85 30 cpi r24, 0x05 ; 5 + a3c: 41 f0 breq .+16 ; 0xa4e + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + a3e: 80 91 e8 00 lds r24, 0x00E8 + LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize); + Endpoint_ClearIN(); + } + } + + while (!(Endpoint_IsOUTReceived())) + a42: 82 ff sbrs r24, 2 + a44: f6 cf rjmp .-20 ; 0xa32 + a46: 80 e0 ldi r24, 0x00 ; 0 + a48: 08 95 ret + a4a: 82 e0 ldi r24, 0x02 ; 2 + a4c: 08 95 ret + a4e: 83 e0 ldi r24, 0x03 ; 3 + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + return ENDPOINT_RWCSTREAM_BusSuspended; + } + + return ENDPOINT_RWCSTREAM_NoError; +} + a50: 08 95 ret + +00000a52 : +uint8_t TEMPLATE_FUNC_NAME (void* Buffer, + uint16_t Length) +{ + a52: 9c 01 movw r18, r24 + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + + if (!(Length)) + a54: 61 15 cp r22, r1 + a56: 71 05 cpc r23, r1 + a58: 29 f4 brne .+10 ; 0xa64 + */ + static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearOUT(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); + a5a: 80 91 e8 00 lds r24, 0x00E8 + a5e: 8b 77 andi r24, 0x7B ; 123 + a60: 80 93 e8 00 sts 0x00E8, r24 +uint8_t TEMPLATE_FUNC_NAME (void* Buffer, + uint16_t Length) +{ + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + a64: f9 01 movw r30, r18 + a66: 20 c0 rjmp .+64 ; 0xaa8 + if (!(Length)) + Endpoint_ClearOUT(); + + while (Length) + { + uint8_t USB_DeviceState_LCL = USB_DeviceState; + a68: 80 91 0d 02 lds r24, 0x020D + + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) + a6c: 88 23 and r24, r24 + a6e: 61 f1 breq .+88 ; 0xac8 + return ENDPOINT_RWCSTREAM_DeviceDisconnected; + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + a70: 85 30 cpi r24, 0x05 ; 5 + a72: 61 f1 breq .+88 ; 0xacc + * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise. + */ + static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsSETUPReceived(void) + { + return ((UEINTX & (1 << RXSTPI)) ? true : false); + a74: 80 91 e8 00 lds r24, 0x00E8 + return ENDPOINT_RWCSTREAM_BusSuspended; + else if (Endpoint_IsSETUPReceived()) + a78: 83 ff sbrs r24, 3 + a7a: 02 c0 rjmp .+4 ; 0xa80 + a7c: 81 e0 ldi r24, 0x01 ; 1 + a7e: 08 95 ret + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + a80: 80 91 e8 00 lds r24, 0x00E8 + return ENDPOINT_RWCSTREAM_HostAborted; + + if (Endpoint_IsOUTReceived()) + a84: 82 ff sbrs r24, 2 + a86: f0 cf rjmp .-32 ; 0xa68 + a88: 06 c0 rjmp .+12 ; 0xa96 + * \return Next byte in the currently selected endpoint's FIFO buffer. + */ + static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_Read_Byte(void) + { + return UEDATX; + a8a: 80 91 f1 00 lds r24, 0x00F1 + { + while (Length && Endpoint_BytesInEndpoint()) + { + TEMPLATE_TRANSFER_BYTE(DataStream); + a8e: 81 93 st Z+, r24 + Length--; + a90: 61 50 subi r22, 0x01 ; 1 + a92: 70 40 sbci r23, 0x00 ; 0 + else if (Endpoint_IsSETUPReceived()) + return ENDPOINT_RWCSTREAM_HostAborted; + + if (Endpoint_IsOUTReceived()) + { + while (Length && Endpoint_BytesInEndpoint()) + a94: 21 f0 breq .+8 ; 0xa9e + #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + return UEBCX; + #elif defined(USB_SERIES_4_AVR) + return (((uint16_t)UEBCHX << 8) | UEBCLX); + #elif defined(USB_SERIES_2_AVR) + return UEBCLX; + a96: 80 91 f2 00 lds r24, 0x00F2 + a9a: 88 23 and r24, r24 + a9c: b1 f7 brne .-20 ; 0xa8a + */ + static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearOUT(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); + a9e: 80 91 e8 00 lds r24, 0x00E8 + aa2: 8b 77 andi r24, 0x7B ; 123 + aa4: 80 93 e8 00 sts 0x00E8, r24 + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + + if (!(Length)) + Endpoint_ClearOUT(); + + while (Length) + aa8: 61 15 cp r22, r1 + aaa: 71 05 cpc r23, r1 + aac: e9 f6 brne .-70 ; 0xa68 + aae: 06 c0 rjmp .+12 ; 0xabc + } + } + + while (!(Endpoint_IsINReady())) + { + uint8_t USB_DeviceState_LCL = USB_DeviceState; + ab0: 80 91 0d 02 lds r24, 0x020D + + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) + ab4: 88 23 and r24, r24 + ab6: 41 f0 breq .+16 ; 0xac8 + return ENDPOINT_RWCSTREAM_DeviceDisconnected; + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + ab8: 85 30 cpi r24, 0x05 ; 5 + aba: 41 f0 breq .+16 ; 0xacc + * \return Boolean true if the current endpoint is ready for an IN packet, false otherwise. + */ + static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsINReady(void) + { + return ((UEINTX & (1 << TXINI)) ? true : false); + abc: 80 91 e8 00 lds r24, 0x00E8 + + Endpoint_ClearOUT(); + } + } + + while (!(Endpoint_IsINReady())) + ac0: 80 ff sbrs r24, 0 + ac2: f6 cf rjmp .-20 ; 0xab0 + ac4: 80 e0 ldi r24, 0x00 ; 0 + ac6: 08 95 ret + ac8: 82 e0 ldi r24, 0x02 ; 2 + aca: 08 95 ret + acc: 83 e0 ldi r24, 0x03 ; 3 + else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) + return ENDPOINT_RWCSTREAM_BusSuspended; + } + + return ENDPOINT_RWCSTREAM_NoError; +} + ace: 08 95 ret + +00000ad0 : +#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR) +volatile uint8_t USB_DeviceState; +#endif + +void USB_USBTask(void) +{ + ad0: 1f 93 push r17 +} + +#if defined(USB_CAN_BE_DEVICE) +static void USB_DeviceTask(void) +{ + if (USB_DeviceState != DEVICE_STATE_Unattached) + ad2: 80 91 0d 02 lds r24, 0x020D + ad6: 88 23 and r24, r24 + ad8: 61 f0 breq .+24 ; 0xaf2 + */ + static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_GetCurrentEndpoint(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + return (UENUM & ENDPOINT_EPNUM_MASK); + ada: 10 91 e9 00 lds r17, 0x00E9 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + ade: 10 92 e9 00 sts 0x00E9, r1 + * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise. + */ + static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsSETUPReceived(void) + { + return ((UEINTX & (1 << RXSTPI)) ? true : false); + ae2: 80 91 e8 00 lds r24, 0x00E8 + { + uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); + + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + + if (Endpoint_IsSETUPReceived()) + ae6: 83 ff sbrs r24, 3 + ae8: 01 c0 rjmp .+2 ; 0xaec + USB_Device_ProcessControlRequest(); + aea: c9 dd rcall .-1134 ; 0x67e + */ + static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_GetCurrentEndpoint(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + return (UENUM & ENDPOINT_EPNUM_MASK); + aec: 17 70 andi r17, 0x07 ; 7 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + aee: 10 93 e9 00 sts 0x00E9, r17 + if (USB_CurrentMode == USB_MODE_Device) + USB_DeviceTask(); + else if (USB_CurrentMode == USB_MODE_Host) + USB_HostTask(); + #endif +} + af2: 1f 91 pop r17 + af4: 08 95 ret + +00000af6 : +#include "CDC.h" + +void CDC_Device_Event_Stub(void) +{ + +} + af6: 08 95 ret + +00000af8 : + return 0; + } +} + +int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + af8: fc 01 movw r30, r24 + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + afa: 80 91 0d 02 lds r24, 0x020D + afe: 84 30 cpi r24, 0x04 ; 4 + b00: 21 f5 brne .+72 ; 0xb4a + b02: 87 85 ldd r24, Z+15 ; 0x0f + b04: 90 89 ldd r25, Z+16 ; 0x10 + b06: a1 89 ldd r26, Z+17 ; 0x11 + b08: b2 89 ldd r27, Z+18 ; 0x12 + b0a: 00 97 sbiw r24, 0x00 ; 0 + b0c: a1 05 cpc r26, r1 + b0e: b1 05 cpc r27, r1 + b10: e1 f0 breq .+56 ; 0xb4a + return -1; + + int16_t ReceivedByte = -1; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber); + b12: 85 81 ldd r24, Z+5 ; 0x05 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + b14: 80 93 e9 00 sts 0x00E9, r24 + * \return Boolean true if current endpoint is has received an OUT packet, false otherwise. + */ + static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsOUTReceived(void) + { + return ((UEINTX & (1 << RXOUTI)) ? true : false); + b18: 80 91 e8 00 lds r24, 0x00E8 + + if (Endpoint_IsOUTReceived()) + b1c: 82 ff sbrs r24, 2 + b1e: 15 c0 rjmp .+42 ; 0xb4a + #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + return UEBCX; + #elif defined(USB_SERIES_4_AVR) + return (((uint16_t)UEBCHX << 8) | UEBCLX); + #elif defined(USB_SERIES_2_AVR) + return UEBCLX; + b20: 80 91 f2 00 lds r24, 0x00F2 + { + if (Endpoint_BytesInEndpoint()) + b24: 88 23 and r24, r24 + b26: 19 f4 brne .+6 ; 0xb2e + b28: 2f ef ldi r18, 0xFF ; 255 + b2a: 3f ef ldi r19, 0xFF ; 255 + b2c: 04 c0 rjmp .+8 ; 0xb36 + * \return Next byte in the currently selected endpoint's FIFO buffer. + */ + static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_Read_Byte(void) + { + return UEDATX; + b2e: 80 91 f1 00 lds r24, 0x00F1 + ReceivedByte = Endpoint_Read_Byte(); + b32: 28 2f mov r18, r24 + b34: 30 e0 ldi r19, 0x00 ; 0 + #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + return UEBCX; + #elif defined(USB_SERIES_4_AVR) + return (((uint16_t)UEBCHX << 8) | UEBCLX); + #elif defined(USB_SERIES_2_AVR) + return UEBCLX; + b36: 80 91 f2 00 lds r24, 0x00F2 + + if (!(Endpoint_BytesInEndpoint())) + b3a: 88 23 and r24, r24 + b3c: 41 f4 brne .+16 ; 0xb4e + */ + static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearOUT(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); + b3e: 80 91 e8 00 lds r24, 0x00E8 + b42: 8b 77 andi r24, 0x7B ; 123 + b44: 80 93 e8 00 sts 0x00E8, r24 + b48: 02 c0 rjmp .+4 ; 0xb4e + b4a: 2f ef ldi r18, 0xFF ; 255 + b4c: 3f ef ldi r19, 0xFF ; 255 + Endpoint_ClearOUT(); + } + + return ReceivedByte; +} + b4e: c9 01 movw r24, r18 + b50: 08 95 ret + +00000b52 : + Endpoint_ClearIN(); +} + +void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + FILE* const Stream) +{ + b52: fb 01 movw r30, r22 + *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Device_putchar, CDC_Device_getchar, _FDEV_SETUP_RW); + b54: 2e e0 ldi r18, 0x0E ; 14 + b56: db 01 movw r26, r22 + b58: 1d 92 st X+, r1 + b5a: 2a 95 dec r18 + b5c: e9 f7 brne .-6 ; 0xb58 + b5e: 23 e0 ldi r18, 0x03 ; 3 + b60: 23 83 std Z+3, r18 ; 0x03 + b62: 28 e2 ldi r18, 0x28 ; 40 + b64: 36 e0 ldi r19, 0x06 ; 6 + b66: 31 87 std Z+9, r19 ; 0x09 + b68: 20 87 std Z+8, r18 ; 0x08 + b6a: 2c eb ldi r18, 0xBC ; 188 + b6c: 35 e0 ldi r19, 0x05 ; 5 + b6e: 33 87 std Z+11, r19 ; 0x0b + b70: 22 87 std Z+10, r18 ; 0x0a + fdev_set_udata(Stream, CDCInterfaceInfo); + b72: 95 87 std Z+13, r25 ; 0x0d + b74: 84 87 std Z+12, r24 ; 0x0c +} + b76: 08 95 ret + +00000b78 : + return CDC_Device_SendByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; +} + +static int CDC_Device_getchar(FILE* Stream) +{ + int16_t ReceivedByte = CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream)); + b78: fc 01 movw r30, r24 + b7a: 84 85 ldd r24, Z+12 ; 0x0c + b7c: 95 85 ldd r25, Z+13 ; 0x0d + b7e: bc df rcall .-136 ; 0xaf8 + b80: 9c 01 movw r18, r24 + + if (ReceivedByte < 0) + b82: 97 ff sbrs r25, 7 + b84: 02 c0 rjmp .+4 ; 0xb8a + b86: 2e ef ldi r18, 0xFE ; 254 + b88: 3f ef ldi r19, 0xFF ; 255 + return _FDEV_EOF; + + return ReceivedByte; +} + b8a: c9 01 movw r24, r18 + b8c: 08 95 ret + +00000b8e : + Endpoint_Write_Byte(Data); + return ENDPOINT_READYWAIT_NoError; +} + +uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + b8e: fc 01 movw r30, r24 + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + b90: 80 91 0d 02 lds r24, 0x020D + b94: 84 30 cpi r24, 0x04 ; 4 + b96: 11 f5 brne .+68 ; 0xbdc + b98: 87 85 ldd r24, Z+15 ; 0x0f + b9a: 90 89 ldd r25, Z+16 ; 0x10 + b9c: a1 89 ldd r26, Z+17 ; 0x11 + b9e: b2 89 ldd r27, Z+18 ; 0x12 + ba0: 00 97 sbiw r24, 0x00 ; 0 + ba2: a1 05 cpc r26, r1 + ba4: b1 05 cpc r27, r1 + ba6: d1 f0 breq .+52 ; 0xbdc + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + uint8_t ErrorCode; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber); + ba8: 81 81 ldd r24, Z+1 ; 0x01 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + baa: 80 93 e9 00 sts 0x00E9, r24 + #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + return UEBCX; + #elif defined(USB_SERIES_4_AVR) + return (((uint16_t)UEBCHX << 8) | UEBCLX); + #elif defined(USB_SERIES_2_AVR) + return UEBCLX; + bae: 80 91 f2 00 lds r24, 0x00F2 + + if (!(Endpoint_BytesInEndpoint())) + bb2: 88 23 and r24, r24 + bb4: a9 f0 breq .+42 ; 0xbe0 + * \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction. + */ + static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsReadWriteAllowed(void) + { + return ((UEINTX & (1 << RWAL)) ? true : false); + bb6: 90 91 e8 00 lds r25, 0x00E8 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + bba: 80 91 e8 00 lds r24, 0x00E8 + bbe: 8e 77 andi r24, 0x7E ; 126 + bc0: 80 93 e8 00 sts 0x00E8, r24 + + bool BankFull = !(Endpoint_IsReadWriteAllowed()); + + Endpoint_ClearIN(); + + if (BankFull) + bc4: 95 fd sbrc r25, 5 + bc6: 0c c0 rjmp .+24 ; 0xbe0 + { + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + bc8: 38 dc rcall .-1936 ; 0x43a + bca: 98 2f mov r25, r24 + bcc: 88 23 and r24, r24 + bce: 49 f4 brne .+18 ; 0xbe2 + bd0: 80 91 e8 00 lds r24, 0x00E8 + bd4: 8e 77 andi r24, 0x7E ; 126 + bd6: 80 93 e8 00 sts 0x00E8, r24 + bda: 03 c0 rjmp .+6 ; 0xbe2 + bdc: 92 e0 ldi r25, 0x02 ; 2 + bde: 01 c0 rjmp .+2 ; 0xbe2 + be0: 90 e0 ldi r25, 0x00 ; 0 + + Endpoint_ClearIN(); + } + + return ENDPOINT_READYWAIT_NoError; +} + be2: 89 2f mov r24, r25 + be4: 08 95 ret + +00000be6 : + + return true; +} + +void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + be6: fc 01 movw r30, r24 + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + be8: 80 91 0d 02 lds r24, 0x020D + bec: 84 30 cpi r24, 0x04 ; 4 + bee: 51 f4 brne .+20 ; 0xc04 + bf0: 87 85 ldd r24, Z+15 ; 0x0f + bf2: 90 89 ldd r25, Z+16 ; 0x10 + bf4: a1 89 ldd r26, Z+17 ; 0x11 + bf6: b2 89 ldd r27, Z+18 ; 0x12 + bf8: 00 97 sbiw r24, 0x00 ; 0 + bfa: a1 05 cpc r26, r1 + bfc: b1 05 cpc r27, r1 + bfe: 11 f0 breq .+4 ; 0xc04 + return; + + #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) + CDC_Device_Flush(CDCInterfaceInfo); + c00: cf 01 movw r24, r30 + c02: c5 cf rjmp .-118 ; 0xb8e + c04: 08 95 ret + +00000c06 : + return Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK); +} + +uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const uint8_t Data) +{ + c06: 1f 93 push r17 + c08: fc 01 movw r30, r24 + c0a: 16 2f mov r17, r22 + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + c0c: 80 91 0d 02 lds r24, 0x020D + c10: 84 30 cpi r24, 0x04 ; 4 + c12: d9 f4 brne .+54 ; 0xc4a + c14: 87 85 ldd r24, Z+15 ; 0x0f + c16: 90 89 ldd r25, Z+16 ; 0x10 + c18: a1 89 ldd r26, Z+17 ; 0x11 + c1a: b2 89 ldd r27, Z+18 ; 0x12 + c1c: 00 97 sbiw r24, 0x00 ; 0 + c1e: a1 05 cpc r26, r1 + c20: b1 05 cpc r27, r1 + c22: 99 f0 breq .+38 ; 0xc4a + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber); + c24: 81 81 ldd r24, Z+1 ; 0x01 + */ + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) + { + #if !defined(CONTROL_ONLY_DEVICE) + UENUM = EndpointNumber; + c26: 80 93 e9 00 sts 0x00E9, r24 + * \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction. + */ + static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsReadWriteAllowed(void) + { + return ((UEINTX & (1 << RWAL)) ? true : false); + c2a: 80 91 e8 00 lds r24, 0x00E8 + + if (!(Endpoint_IsReadWriteAllowed())) + c2e: 85 fd sbrc r24, 5 + c30: 08 c0 rjmp .+16 ; 0xc42 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + c32: 80 91 e8 00 lds r24, 0x00E8 + c36: 8e 77 andi r24, 0x7E ; 126 + c38: 80 93 e8 00 sts 0x00E8, r24 + { + Endpoint_ClearIN(); + + uint8_t ErrorCode; + + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + c3c: fe db rcall .-2052 ; 0x43a + c3e: 88 23 and r24, r24 + c40: 29 f4 brne .+10 ; 0xc4c + * \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_Byte(const uint8_t Byte) + { + UEDATX = Byte; + c42: 10 93 f1 00 sts 0x00F1, r17 + c46: 80 e0 ldi r24, 0x00 ; 0 + c48: 01 c0 rjmp .+2 ; 0xc4c + return ErrorCode; + } + + Endpoint_Write_Byte(Data); + return ENDPOINT_READYWAIT_NoError; + c4a: 82 e0 ldi r24, 0x02 ; 2 +} + c4c: 1f 91 pop r17 + c4e: 08 95 ret + +00000c50 : + fdev_set_udata(Stream, CDCInterfaceInfo); +} + +static int CDC_Device_putchar(char c, + FILE* Stream) +{ + c50: 28 2f mov r18, r24 + c52: fb 01 movw r30, r22 + return CDC_Device_SendByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; + c54: 84 85 ldd r24, Z+12 ; 0x0c + c56: 95 85 ldd r25, Z+13 ; 0x0d + c58: 62 2f mov r22, r18 + c5a: d5 df rcall .-86 ; 0xc06 + c5c: 88 23 and r24, r24 + c5e: 19 f4 brne .+6 ; 0xc66 + c60: 20 e0 ldi r18, 0x00 ; 0 + c62: 30 e0 ldi r19, 0x00 ; 0 + c64: 02 c0 rjmp .+4 ; 0xc6a + c66: 2f ef ldi r18, 0xFF ; 255 + c68: 3f ef ldi r19, 0xFF ; 255 +} + c6a: c9 01 movw r24, r18 + c6c: 08 95 ret + +00000c6e : + break; + } +} + +bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + c6e: 1f 93 push r17 + c70: cf 93 push r28 + c72: df 93 push r29 + c74: ec 01 movw r28, r24 + memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State)); + c76: 0d 96 adiw r24, 0x0d ; 13 + c78: fc 01 movw r30, r24 + c7a: 89 e0 ldi r24, 0x09 ; 9 + c7c: df 01 movw r26, r30 + c7e: 1d 92 st X+, r1 + c80: 8a 95 dec r24 + c82: e9 f7 brne .-6 ; 0xc7e + c84: 11 e0 ldi r17, 0x01 ; 1 + uint16_t Size; + uint8_t Type; + uint8_t Direction; + bool DoubleBanked; + + if (EndpointNum == CDCInterfaceInfo->Config.DataINEndpointNumber) + c86: 89 81 ldd r24, Y+1 ; 0x01 + c88: 18 17 cp r17, r24 + c8a: 29 f4 brne .+10 ; 0xc96 + { + Size = CDCInterfaceInfo->Config.DataINEndpointSize; + c8c: ea 81 ldd r30, Y+2 ; 0x02 + c8e: fb 81 ldd r31, Y+3 ; 0x03 + Direction = ENDPOINT_DIR_IN; + Type = EP_TYPE_BULK; + DoubleBanked = CDCInterfaceInfo->Config.DataINEndpointDoubleBank; + c90: 8c 81 ldd r24, Y+4 ; 0x04 + c92: 62 e0 ldi r22, 0x02 ; 2 + c94: 10 c0 rjmp .+32 ; 0xcb6 + } + else if (EndpointNum == CDCInterfaceInfo->Config.DataOUTEndpointNumber) + c96: 8d 81 ldd r24, Y+5 ; 0x05 + c98: 18 17 cp r17, r24 + c9a: 31 f4 brne .+12 ; 0xca8 + { + Size = CDCInterfaceInfo->Config.DataOUTEndpointSize; + c9c: ee 81 ldd r30, Y+6 ; 0x06 + c9e: ff 81 ldd r31, Y+7 ; 0x07 + Direction = ENDPOINT_DIR_OUT; + Type = EP_TYPE_BULK; + DoubleBanked = CDCInterfaceInfo->Config.DataOUTEndpointDoubleBank; + ca0: 88 85 ldd r24, Y+8 ; 0x08 + ca2: 62 e0 ldi r22, 0x02 ; 2 + ca4: 30 e0 ldi r19, 0x00 ; 0 + ca6: 08 c0 rjmp .+16 ; 0xcb8 + } + else if (EndpointNum == CDCInterfaceInfo->Config.NotificationEndpointNumber) + ca8: 89 85 ldd r24, Y+9 ; 0x09 + caa: 18 17 cp r17, r24 + cac: 09 f5 brne .+66 ; 0xcf0 + { + Size = CDCInterfaceInfo->Config.NotificationEndpointSize; + cae: ea 85 ldd r30, Y+10 ; 0x0a + cb0: fb 85 ldd r31, Y+11 ; 0x0b + Direction = ENDPOINT_DIR_IN; + Type = EP_TYPE_INTERRUPT; + DoubleBanked = CDCInterfaceInfo->Config.NotificationEndpointDoubleBank; + cb2: 8c 85 ldd r24, Y+12 ; 0x0c + cb4: 63 e0 ldi r22, 0x03 ; 3 + cb6: 31 e0 ldi r19, 0x01 ; 1 + else + { + continue; + } + + if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size, + cb8: 88 23 and r24, r24 + cba: 11 f4 brne .+4 ; 0xcc0 + cbc: 40 e0 ldi r20, 0x00 ; 0 + cbe: 01 c0 rjmp .+2 ; 0xcc2 + cc0: 44 e0 ldi r20, 0x04 ; 4 + cc2: 20 e0 ldi r18, 0x00 ; 0 + cc4: 88 e0 ldi r24, 0x08 ; 8 + cc6: 90 e0 ldi r25, 0x00 ; 0 + cc8: 03 c0 rjmp .+6 ; 0xcd0 + uint8_t MaskVal = 0; + uint16_t CheckBytes = 8; + + while (CheckBytes < Bytes) + { + MaskVal++; + cca: 2f 5f subi r18, 0xFF ; 255 + CheckBytes <<= 1; + ccc: 88 0f add r24, r24 + cce: 99 1f adc r25, r25 + static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) + { + uint8_t MaskVal = 0; + uint16_t CheckBytes = 8; + + while (CheckBytes < Bytes) + cd0: 8e 17 cp r24, r30 + cd2: 9f 07 cpc r25, r31 + cd4: d0 f3 brcs .-12 ; 0xcca + const uint8_t Type, + const uint8_t Direction, + const uint16_t Size, + const uint8_t Banks) + { + return Endpoint_ConfigureEndpoint_Prv(Number, (((Type) << EPTYPE0) | (Direction)), + cd6: 62 95 swap r22 + cd8: 66 0f add r22, r22 + cda: 66 0f add r22, r22 + cdc: 60 7c andi r22, 0xC0 ; 192 + cde: 63 2b or r22, r19 + ce0: 42 60 ori r20, 0x02 ; 2 + ce2: 22 95 swap r18 + ce4: 20 7f andi r18, 0xF0 ; 240 + ce6: 42 2b or r20, r18 + ce8: 81 2f mov r24, r17 + cea: 73 db rcall .-2330 ; 0x3d2 + cec: 88 23 and r24, r24 + cee: 21 f0 breq .+8 ; 0xcf8 + +bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State)); + + for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++) + cf0: 1f 5f subi r17, 0xFF ; 255 + cf2: 15 30 cpi r17, 0x05 ; 5 + cf4: 41 f6 brne .-112 ; 0xc86 + cf6: 81 e0 ldi r24, 0x01 ; 1 + return false; + } + } + + return true; +} + cf8: df 91 pop r29 + cfa: cf 91 pop r28 + cfc: 1f 91 pop r17 + cfe: 08 95 ret + +00000d00 : +{ + +} + +void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + d00: cf 93 push r28 + d02: df 93 push r29 + d04: ec 01 movw r28, r24 + * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise. + */ + static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsSETUPReceived(void) + { + return ((UEINTX & (1 << RXSTPI)) ? true : false); + d06: 80 91 e8 00 lds r24, 0x00E8 + if (!(Endpoint_IsSETUPReceived())) + d0a: 83 ff sbrs r24, 3 + d0c: 63 c0 rjmp .+198 ; 0xdd4 + return; + + if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber) + d0e: 88 81 ld r24, Y + d10: 90 e0 ldi r25, 0x00 ; 0 + d12: 20 91 12 02 lds r18, 0x0212 + d16: 30 91 13 02 lds r19, 0x0213 + d1a: 28 17 cp r18, r24 + d1c: 39 07 cpc r19, r25 + d1e: 09 f0 breq .+2 ; 0xd22 + d20: 59 c0 rjmp .+178 ; 0xdd4 + return; + + switch (USB_ControlRequest.bRequest) + d22: 80 91 0f 02 lds r24, 0x020F + d26: 81 32 cpi r24, 0x21 ; 33 + d28: 61 f0 breq .+24 ; 0xd42 + d2a: 82 32 cpi r24, 0x22 ; 34 + d2c: 20 f4 brcc .+8 ; 0xd36 + d2e: 80 32 cpi r24, 0x20 ; 32 + d30: 09 f0 breq .+2 ; 0xd34 + d32: 50 c0 rjmp .+160 ; 0xdd4 + d34: 1b c0 rjmp .+54 ; 0xd6c + d36: 82 32 cpi r24, 0x22 ; 34 + d38: 79 f1 breq .+94 ; 0xd98 + d3a: 83 32 cpi r24, 0x23 ; 35 + d3c: 09 f0 breq .+2 ; 0xd40 + d3e: 4a c0 rjmp .+148 ; 0xdd4 + d40: 3b c0 rjmp .+118 ; 0xdb8 + { + case CDC_REQ_GetLineEncoding: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + d42: 80 91 0e 02 lds r24, 0x020E + d46: 81 3a cpi r24, 0xA1 ; 161 + d48: 09 f0 breq .+2 ; 0xd4c + d4a: 44 c0 rjmp .+136 ; 0xdd4 + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + d4c: 80 91 e8 00 lds r24, 0x00E8 + d50: 87 7f andi r24, 0xF7 ; 247 + d52: 80 93 e8 00 sts 0x00E8, r24 + { + Endpoint_ClearSETUP(); + Endpoint_Write_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding)); + d56: ce 01 movw r24, r28 + d58: 0f 96 adiw r24, 0x0f ; 15 + d5a: 67 e0 ldi r22, 0x07 ; 7 + d5c: 70 e0 ldi r23, 0x00 ; 0 + d5e: bc dd rcall .-1160 ; 0x8d8 + */ + static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearOUT(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); + d60: 80 91 e8 00 lds r24, 0x00E8 + d64: 8b 77 andi r24, 0x7B ; 123 + d66: 80 93 e8 00 sts 0x00E8, r24 + d6a: 34 c0 rjmp .+104 ; 0xdd4 + Endpoint_ClearOUT(); + } + + break; + case CDC_REQ_SetLineEncoding: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + d6c: 80 91 0e 02 lds r24, 0x020E + d70: 81 32 cpi r24, 0x21 ; 33 + d72: 81 f5 brne .+96 ; 0xdd4 + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + d74: 80 91 e8 00 lds r24, 0x00E8 + d78: 87 7f andi r24, 0xF7 ; 247 + d7a: 80 93 e8 00 sts 0x00E8, r24 + { + Endpoint_ClearSETUP(); + Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding)); + d7e: ce 01 movw r24, r28 + d80: 0f 96 adiw r24, 0x0f ; 15 + d82: 67 e0 ldi r22, 0x07 ; 7 + d84: 70 e0 ldi r23, 0x00 ; 0 + d86: 65 de rcall .-822 ; 0xa52 + */ + static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearIN(void) + { + #if !defined(CONTROL_ONLY_DEVICE) + UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); + d88: 80 91 e8 00 lds r24, 0x00E8 + d8c: 8e 77 andi r24, 0x7E ; 126 + d8e: 80 93 e8 00 sts 0x00E8, r24 + Endpoint_ClearIN(); + + EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo); + d92: ce 01 movw r24, r28 + d94: b0 de rcall .-672 ; 0xaf6 + d96: 1e c0 rjmp .+60 ; 0xdd4 + } + + break; + case CDC_REQ_SetControlLineState: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + d98: 80 91 0e 02 lds r24, 0x020E + d9c: 81 32 cpi r24, 0x21 ; 33 + d9e: d1 f4 brne .+52 ; 0xdd4 + * \note This is not applicable for non CONTROL type endpoints. + */ + static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearSETUP(void) + { + UEINTX &= ~(1 << RXSTPI); + da0: 80 91 e8 00 lds r24, 0x00E8 + da4: 87 7f andi r24, 0xF7 ; 247 + da6: 80 93 e8 00 sts 0x00E8, r24 + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + daa: 26 db rcall .-2484 ; 0x3f8 + + CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue; + dac: 80 91 10 02 lds r24, 0x0210 + db0: 8d 87 std Y+13, r24 ; 0x0d + + EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo); + db2: ce 01 movw r24, r28 + db4: a0 de rcall .-704 ; 0xaf6 + db6: 0e c0 rjmp .+28 ; 0xdd4 + } + + break; + case CDC_REQ_SendBreak: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + db8: 80 91 0e 02 lds r24, 0x020E + dbc: 81 32 cpi r24, 0x21 ; 33 + dbe: 51 f4 brne .+20 ; 0xdd4 + dc0: 80 91 e8 00 lds r24, 0x00E8 + dc4: 87 7f andi r24, 0xF7 ; 247 + dc6: 80 93 e8 00 sts 0x00E8, r24 + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + dca: 16 db rcall .-2516 ; 0x3f8 + + EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue); + dcc: ce 01 movw r24, r28 + dce: 60 91 10 02 lds r22, 0x0210 + dd2: 91 de rcall .-734 ; 0xaf6 + } + + break; + } +} + dd4: df 91 pop r29 + dd6: cf 91 pop r28 + dd8: 08 95 ret + +00000dda : + dda: fb 01 movw r30, r22 + ddc: dc 01 movw r26, r24 + dde: 8d 91 ld r24, X+ + de0: 01 90 ld r0, Z+ + de2: 80 19 sub r24, r0 + de4: 01 10 cpse r0, r1 + de6: d9 f3 breq .-10 ; 0xdde + de8: 99 0b sbc r25, r25 + dea: 08 95 ret + +00000dec : + dec: 0f 93 push r16 + dee: 1f 93 push r17 + df0: cf 93 push r28 + df2: df 93 push r29 + df4: 8c 01 movw r16, r24 + df6: eb 01 movw r28, r22 + df8: 8b 81 ldd r24, Y+3 ; 0x03 + dfa: 81 ff sbrs r24, 1 + dfc: 1b c0 rjmp .+54 ; 0xe34 + dfe: 82 ff sbrs r24, 2 + e00: 0d c0 rjmp .+26 ; 0xe1c + e02: 2e 81 ldd r18, Y+6 ; 0x06 + e04: 3f 81 ldd r19, Y+7 ; 0x07 + e06: 8c 81 ldd r24, Y+4 ; 0x04 + e08: 9d 81 ldd r25, Y+5 ; 0x05 + e0a: 28 17 cp r18, r24 + e0c: 39 07 cpc r19, r25 + e0e: 64 f4 brge .+24 ; 0xe28 + e10: e8 81 ld r30, Y + e12: f9 81 ldd r31, Y+1 ; 0x01 + e14: 01 93 st Z+, r16 + e16: f9 83 std Y+1, r31 ; 0x01 + e18: e8 83 st Y, r30 + e1a: 06 c0 rjmp .+12 ; 0xe28 + e1c: e8 85 ldd r30, Y+8 ; 0x08 + e1e: f9 85 ldd r31, Y+9 ; 0x09 + e20: 80 2f mov r24, r16 + e22: 09 95 icall + e24: 89 2b or r24, r25 + e26: 31 f4 brne .+12 ; 0xe34 + e28: 8e 81 ldd r24, Y+6 ; 0x06 + e2a: 9f 81 ldd r25, Y+7 ; 0x07 + e2c: 01 96 adiw r24, 0x01 ; 1 + e2e: 9f 83 std Y+7, r25 ; 0x07 + e30: 8e 83 std Y+6, r24 ; 0x06 + e32: 02 c0 rjmp .+4 ; 0xe38 + e34: 0f ef ldi r16, 0xFF ; 255 + e36: 1f ef ldi r17, 0xFF ; 255 + e38: c8 01 movw r24, r16 + e3a: df 91 pop r29 + e3c: cf 91 pop r28 + e3e: 1f 91 pop r17 + e40: 0f 91 pop r16 + e42: 08 95 ret + +00000e44 : + e44: ef 92 push r14 + e46: ff 92 push r15 + e48: 0f 93 push r16 + e4a: 1f 93 push r17 + e4c: cf 93 push r28 + e4e: df 93 push r29 + e50: 7c 01 movw r14, r24 + e52: 8b 01 movw r16, r22 + e54: db 01 movw r26, r22 + e56: 13 96 adiw r26, 0x03 ; 3 + e58: 8c 91 ld r24, X + e5a: 81 fd sbrc r24, 1 + e5c: 03 c0 rjmp .+6 ; 0xe64 + e5e: cf ef ldi r28, 0xFF ; 255 + e60: df ef ldi r29, 0xFF ; 255 + e62: 13 c0 rjmp .+38 ; 0xe8a + e64: c0 e0 ldi r28, 0x00 ; 0 + e66: d0 e0 ldi r29, 0x00 ; 0 + e68: 0b c0 rjmp .+22 ; 0xe80 + e6a: d8 01 movw r26, r16 + e6c: 18 96 adiw r26, 0x08 ; 8 + e6e: ed 91 ld r30, X+ + e70: fc 91 ld r31, X + e72: 19 97 sbiw r26, 0x09 ; 9 + e74: b8 01 movw r22, r16 + e76: 09 95 icall + e78: 89 2b or r24, r25 + e7a: 11 f0 breq .+4 ; 0xe80 + e7c: cf ef ldi r28, 0xFF ; 255 + e7e: df ef ldi r29, 0xFF ; 255 + e80: f7 01 movw r30, r14 + e82: 81 91 ld r24, Z+ + e84: 7f 01 movw r14, r30 + e86: 88 23 and r24, r24 + e88: 81 f7 brne .-32 ; 0xe6a + e8a: ce 01 movw r24, r28 + e8c: cd b7 in r28, 0x3d ; 61 + e8e: de b7 in r29, 0x3e ; 62 + e90: e6 e0 ldi r30, 0x06 ; 6 + e92: 0c c0 rjmp .+24 ; 0xeac <__epilogue_restores__+0x18> + +00000e94 <__epilogue_restores__>: + e94: 2a 88 ldd r2, Y+18 ; 0x12 + e96: 39 88 ldd r3, Y+17 ; 0x11 + e98: 48 88 ldd r4, Y+16 ; 0x10 + e9a: 5f 84 ldd r5, Y+15 ; 0x0f + e9c: 6e 84 ldd r6, Y+14 ; 0x0e + e9e: 7d 84 ldd r7, Y+13 ; 0x0d + ea0: 8c 84 ldd r8, Y+12 ; 0x0c + ea2: 9b 84 ldd r9, Y+11 ; 0x0b + ea4: aa 84 ldd r10, Y+10 ; 0x0a + ea6: b9 84 ldd r11, Y+9 ; 0x09 + ea8: c8 84 ldd r12, Y+8 ; 0x08 + eaa: df 80 ldd r13, Y+7 ; 0x07 + eac: ee 80 ldd r14, Y+6 ; 0x06 + eae: fd 80 ldd r15, Y+5 ; 0x05 + eb0: 0c 81 ldd r16, Y+4 ; 0x04 + eb2: 1b 81 ldd r17, Y+3 ; 0x03 + eb4: aa 81 ldd r26, Y+2 ; 0x02 + eb6: b9 81 ldd r27, Y+1 ; 0x01 + eb8: ce 0f add r28, r30 + eba: d1 1d adc r29, r1 + ebc: 0f b6 in r0, 0x3f ; 63 + ebe: f8 94 cli + ec0: de bf out 0x3e, r29 ; 62 + ec2: 0f be out 0x3f, r0 ; 63 + ec4: cd bf out 0x3d, r28 ; 61 + ec6: ed 01 movw r28, r26 + ec8: 08 95 ret + +00000eca <_exit>: + eca: f8 94 cli + +00000ecc <__stop_program>: + ecc: ff cf rjmp .-2 ; 0xecc <__stop_program> -- cgit v1.2.3