From dee515c2d04c52e9bc18b4d3007af1fbe821d0b4 Mon Sep 17 00:00:00 2001 From: Kevin Rosenberg Date: Sun, 13 Jun 2010 13:30:23 -0600 Subject: [PATCH] Add lss file for cpp_obj program --- gcc_cpp_obj/serial_lcd_obj.lss | 1343 ++++++++++++++++++++++++++++++++ 1 file changed, 1343 insertions(+) create mode 100644 gcc_cpp_obj/serial_lcd_obj.lss diff --git a/gcc_cpp_obj/serial_lcd_obj.lss b/gcc_cpp_obj/serial_lcd_obj.lss new file mode 100644 index 0000000..219b771 --- /dev/null +++ b/gcc_cpp_obj/serial_lcd_obj.lss @@ -0,0 +1,1343 @@ + +serial_lcd_obj.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 00000636 00000000 00000000 00000094 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .data 0000000c 00800060 00000636 000006ca 2**0 + CONTENTS, ALLOC, LOAD, DATA + 2 .bss 00000048 0080006c 0080006c 000006d6 2**0 + ALLOC + 3 .stab 0000069c 00000000 00000000 000006d8 2**2 + CONTENTS, READONLY, DEBUGGING + 4 .stabstr 00000082 00000000 00000000 00000d74 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_aranges 00000020 00000000 00000000 00000df6 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_pubnames 000000bb 00000000 00000000 00000e16 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_info 00001272 00000000 00000000 00000ed1 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_abbrev 000003db 00000000 00000000 00002143 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_line 00000767 00000000 00000000 0000251e 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_frame 00000080 00000000 00000000 00002c88 2**2 + CONTENTS, READONLY, DEBUGGING + 11 .debug_str 00000940 00000000 00000000 00002d08 2**0 + CONTENTS, READONLY, DEBUGGING + 12 .debug_loc 000001fd 00000000 00000000 00003648 2**0 + CONTENTS, READONLY, DEBUGGING + 13 .debug_ranges 00000078 00000000 00000000 00003845 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 12 c0 rjmp .+36 ; 0x26 <__ctors_end> + 2: 2a c0 rjmp .+84 ; 0x58 <__bad_interrupt> + 4: 29 c0 rjmp .+82 ; 0x58 <__bad_interrupt> + 6: 28 c0 rjmp .+80 ; 0x58 <__bad_interrupt> + 8: 27 c0 rjmp .+78 ; 0x58 <__bad_interrupt> + a: 26 c0 rjmp .+76 ; 0x58 <__bad_interrupt> + c: 25 c0 rjmp .+74 ; 0x58 <__bad_interrupt> + e: 8b c2 rjmp .+1302 ; 0x526 <__vector_7> + 10: 23 c0 rjmp .+70 ; 0x58 <__bad_interrupt> + 12: 22 c0 rjmp .+68 ; 0x58 <__bad_interrupt> + 14: 21 c0 rjmp .+66 ; 0x58 <__bad_interrupt> + 16: 20 c0 rjmp .+64 ; 0x58 <__bad_interrupt> + 18: 1f c0 rjmp .+62 ; 0x58 <__bad_interrupt> + 1a: a9 c2 rjmp .+1362 ; 0x56e <__vector_13> + 1c: 1d c0 rjmp .+58 ; 0x58 <__bad_interrupt> + 1e: 1c c0 rjmp .+56 ; 0x58 <__bad_interrupt> + 20: 1b c0 rjmp .+54 ; 0x58 <__bad_interrupt> + 22: 1a c0 rjmp .+52 ; 0x58 <__bad_interrupt> + 24: 19 c0 rjmp .+50 ; 0x58 <__bad_interrupt> + +00000026 <__ctors_end>: + 26: 11 24 eor r1, r1 + 28: 1f be out 0x3f, r1 ; 63 + 2a: cf ed ldi r28, 0xDF ; 223 + 2c: cd bf out 0x3d, r28 ; 61 + +0000002e <__do_copy_data>: + 2e: 10 e0 ldi r17, 0x00 ; 0 + 30: a0 e6 ldi r26, 0x60 ; 96 + 32: b0 e0 ldi r27, 0x00 ; 0 + 34: e6 e3 ldi r30, 0x36 ; 54 + 36: f6 e0 ldi r31, 0x06 ; 6 + 38: 02 c0 rjmp .+4 ; 0x3e <.do_copy_data_start> + +0000003a <.do_copy_data_loop>: + 3a: 05 90 lpm r0, Z+ + 3c: 0d 92 st X+, r0 + +0000003e <.do_copy_data_start>: + 3e: ac 36 cpi r26, 0x6C ; 108 + 40: b1 07 cpc r27, r17 + 42: d9 f7 brne .-10 ; 0x3a <.do_copy_data_loop> + +00000044 <__do_clear_bss>: + 44: 10 e0 ldi r17, 0x00 ; 0 + 46: ac e6 ldi r26, 0x6C ; 108 + 48: b0 e0 ldi r27, 0x00 ; 0 + 4a: 01 c0 rjmp .+2 ; 0x4e <.do_clear_bss_start> + +0000004c <.do_clear_bss_loop>: + 4c: 1d 92 st X+, r1 + +0000004e <.do_clear_bss_start>: + 4e: a4 3b cpi r26, 0xB4 ; 180 + 50: b1 07 cpc r27, r17 + 52: e1 f7 brne .-8 ; 0x4c <.do_clear_bss_loop> + 54: 1e d1 rcall .+572 ; 0x292
+ 56: ed c2 rjmp .+1498 ; 0x632 <_exit> + +00000058 <__bad_interrupt>: + 58: d3 cf rjmp .-90 ; 0x0 <__vectors> + +0000005a <_ZN3Lcd8busyWaitEv>: + *m_ctrlPort |= (1< + 7a: 88 0f add r24, r24 + 7c: 99 1f adc r25, r25 + 7e: 0a 94 dec r0 + 80: e2 f7 brpl .-8 ; 0x7a <_ZN3Lcd8busyWaitEv+0x20> + 82: 28 2b or r18, r24 + 84: 20 83 st Z, r18 + NOP(); + 86: 00 00 nop + do { + Watchdog::reset(); + *m_ctrlPort |= (1< + a4: 88 0f add r24, r24 + a6: 99 1f adc r25, r25 + a8: 0a 94 dec r0 + aa: e2 f7 brpl .-8 ; 0xa4 <_ZN3Lcd8busyWaitEv+0x4a> + ac: 28 2b or r18, r24 + ae: 20 83 st Z, r18 + #else + #define ENABLE_WAIT() __delay_cycles(4); + #endif +#elif defined(__GNUC__) + static __inline__ void _NOP1 (void) { __asm__ volatile ( "nop " "\n\t" ); } + static __inline__ void _NOP2 (void) { __asm__ volatile ( "rjmp 1f" "\n\t" "1:" "\n\t" ); } + b0: 00 c0 rjmp .+0 ; 0xb2 <_ZN3Lcd8busyWaitEv+0x58> + ENABLE_WAIT(); + LCDStatus = *m_dataPinReg; + b2: 00 c0 rjmp .+0 ; 0xb4 <_ZN3Lcd8busyWaitEv+0x5a> + b4: 18 96 adiw r26, 0x08 ; 8 + b6: ed 91 ld r30, X+ + b8: fc 91 ld r31, X + ba: 19 97 sbiw r26, 0x09 ; 9 + bc: 30 81 ld r19, Z + *m_ctrlPort &= ~(1< + d0: 88 0f add r24, r24 + d2: 99 1f adc r25, r25 + d4: 0a 94 dec r0 + d6: e2 f7 brpl .-8 ; 0xd0 <_ZN3Lcd8busyWaitEv+0x76> + d8: 80 95 com r24 + da: 82 23 and r24, r18 + dc: 80 83 st Z, r24 +unsigned char Lcd::busyWait (void) { + unsigned char LCDStatus; + *m_dataDir = 0x00; // Set LCD data port to inputs + *m_ctrlPort |= (1< + *m_ctrlPort |= (1< + f2: 44 0f add r20, r20 + f4: 55 1f adc r21, r21 + f6: 0a 94 dec r0 + f8: e2 f7 brpl .-8 ; 0xf2 <__stack+0x13> + fa: 84 2f mov r24, r20 + fc: 80 95 com r24 + fe: 89 23 and r24, r25 + 100: 80 83 st Z, r24 + *m_dataDir = 0xFF; // Set LCD data port to default output state + 102: 16 96 adiw r26, 0x06 ; 6 + 104: ed 91 ld r30, X+ + 106: fc 91 ld r31, X + 108: 17 97 sbiw r26, 0x07 ; 7 + 10a: 8f ef ldi r24, 0xFF ; 255 + 10c: 80 83 st Z, r24 + return (LCDStatus); +} + 10e: 83 2f mov r24, r19 + 110: 08 95 ret + +00000112 <_ZN3Lcd7putCharEh>: + *m_ctrlPort &= ~(1< + 136: 88 0f add r24, r24 + 138: 99 1f adc r25, r25 + 13a: 0a 94 dec r0 + 13c: e2 f7 brpl .-8 ; 0x136 <_ZN3Lcd7putCharEh+0x24> + 13e: 80 95 com r24 + 140: 82 23 and r24, r18 + 142: 80 83 st Z, r24 + busyWait(); + 144: c7 01 movw r24, r14 + 146: 89 df rcall .-238 ; 0x5a <_ZN3Lcd8busyWaitEv> + *m_ctrlPort |= (1< + 15c: 88 0f add r24, r24 + 15e: 99 1f adc r25, r25 + 160: 0a 94 dec r0 + 162: e2 f7 brpl .-8 ; 0x15c <_ZN3Lcd7putCharEh+0x4a> + 164: 28 2b or r18, r24 + 166: 20 83 st Z, r18 + *m_dataPort = c; + 168: 14 96 adiw r26, 0x04 ; 4 + 16a: ed 91 ld r30, X+ + 16c: fc 91 ld r31, X + 16e: 15 97 sbiw r26, 0x05 ; 5 + 170: d0 82 st Z, r13 + NOP(); + 172: 00 00 nop + *m_ctrlPort |= (1< + 186: 88 0f add r24, r24 + 188: 99 1f adc r25, r25 + 18a: 0a 94 dec r0 + 18c: e2 f7 brpl .-8 ; 0x186 <_ZN3Lcd7putCharEh+0x74> + 18e: 28 2b or r18, r24 + 190: 20 83 st Z, r18 + 192: 00 c0 rjmp .+0 ; 0x194 <_ZN3Lcd7putCharEh+0x82> + ENABLE_WAIT(); + *m_ctrlPort &= ~(1< + 196: ed 91 ld r30, X+ + 198: fc 91 ld r31, X + 19a: 11 97 sbiw r26, 0x01 ; 1 + 19c: 80 81 ld r24, Z + 19e: 1c 96 adiw r26, 0x0c ; 12 + 1a0: 0c 90 ld r0, X + 1a2: 02 c0 rjmp .+4 ; 0x1a8 <_ZN3Lcd7putCharEh+0x96> + 1a4: 00 0f add r16, r16 + 1a6: 11 1f adc r17, r17 + 1a8: 0a 94 dec r0 + 1aa: e2 f7 brpl .-8 ; 0x1a4 <_ZN3Lcd7putCharEh+0x92> + 1ac: 00 95 com r16 + 1ae: 08 23 and r16, r24 + 1b0: 00 83 st Z, r16 +} + 1b2: 1f 91 pop r17 + 1b4: 0f 91 pop r16 + 1b6: ff 90 pop r15 + 1b8: ef 90 pop r14 + 1ba: df 90 pop r13 + 1bc: 08 95 ret + +000001be <_ZN3Lcd6putCmdEh>: + void putChar(unsigned char ch); + void putCmd(unsigned char ch); + +}; + +void Lcd::putCmd (unsigned char Cmd) { + 1be: df 92 push r13 + 1c0: ef 92 push r14 + 1c2: ff 92 push r15 + 1c4: 0f 93 push r16 + 1c6: 1f 93 push r17 + 1c8: 8c 01 movw r16, r24 + 1ca: d6 2e mov r13, r22 + *m_ctrlPort &= ~(1< + 1e4: 88 0f add r24, r24 + 1e6: 99 1f adc r25, r25 + 1e8: 0a 94 dec r0 + 1ea: e2 f7 brpl .-8 ; 0x1e4 <_ZN3Lcd6putCmdEh+0x26> + 1ec: 80 95 com r24 + 1ee: 82 23 and r24, r18 + 1f0: 80 83 st Z, r24 + busyWait(); + 1f2: c8 01 movw r24, r16 + 1f4: 32 df rcall .-412 ; 0x5a <_ZN3Lcd8busyWaitEv> + *m_dataPort = Cmd; + 1f6: d8 01 movw r26, r16 + 1f8: 14 96 adiw r26, 0x04 ; 4 + 1fa: ed 91 ld r30, X+ + 1fc: fc 91 ld r31, X + 1fe: 15 97 sbiw r26, 0x05 ; 5 + 200: d0 82 st Z, r13 + NOP(); + 202: 00 00 nop + *m_ctrlPort |= (1< + 216: 88 0f add r24, r24 + 218: 99 1f adc r25, r25 + 21a: 0a 94 dec r0 + 21c: e2 f7 brpl .-8 ; 0x216 <_ZN3Lcd6putCmdEh+0x58> + 21e: 28 2b or r18, r24 + 220: 20 83 st Z, r18 + 222: 00 c0 rjmp .+0 ; 0x224 <_ZN3Lcd6putCmdEh+0x66> + ENABLE_WAIT(); + *m_ctrlPort &= ~(1< + 226: ed 91 ld r30, X+ + 228: fc 91 ld r31, X + 22a: 11 97 sbiw r26, 0x01 ; 1 + 22c: 20 81 ld r18, Z + 22e: c7 01 movw r24, r14 + 230: 1c 96 adiw r26, 0x0c ; 12 + 232: 0c 90 ld r0, X + 234: 1c 97 sbiw r26, 0x0c ; 12 + 236: 02 c0 rjmp .+4 ; 0x23c <_ZN3Lcd6putCmdEh+0x7e> + 238: 88 0f add r24, r24 + 23a: 99 1f adc r25, r25 + 23c: 0a 94 dec r0 + 23e: e2 f7 brpl .-8 ; 0x238 <_ZN3Lcd6putCmdEh+0x7a> + 240: 80 95 com r24 + 242: 82 23 and r24, r18 + 244: 80 83 st Z, r24 + NOP(); + 246: 00 00 nop + *m_ctrlPort |= (1< + 256: ee 0c add r14, r14 + 258: ff 1c adc r15, r15 + 25a: 0a 94 dec r0 + 25c: e2 f7 brpl .-8 ; 0x256 <_ZN3Lcd6putCmdEh+0x98> + 25e: 8e 29 or r24, r14 + 260: 80 83 st Z, r24 +} + 262: 1f 91 pop r17 + 264: 0f 91 pop r16 + 266: ff 90 pop r15 + 268: ef 90 pop r14 + 26a: df 90 pop r13 + 26c: 08 95 ret + +0000026e <_ZN4Uart10waitRxCharEv>: + } + + unsigned char waitRxChar (void); +}; + +unsigned char Uart::waitRxChar (void) { + 26e: fc 01 movw r30, r24 + // waits for next RX character, then return it + unsigned char tail; + do { + tail = m_UartRxTail; // explicitly set order of volatile variable access + 270: 91 a9 ldd r25, Z+49 ; 0x31 + WDTCSR &= ~(1< + // CTS inactive if byte fills buffer after we remove current byte + cli(); +#endif + + // increment tail position + if (tail == UART_RX_BUFFER_SIZE-1) + 27a: 9f 32 cpi r25, 0x2F ; 47 + 27c: 11 f4 brne .+4 ; 0x282 <_ZN4Uart10waitRxCharEv+0x14> + m_UartRxTail = 0; + 27e: 11 aa std Z+49, r1 ; 0x31 + 280: 03 c0 rjmp .+6 ; 0x288 <_ZN4Uart10waitRxCharEv+0x1a> + else + m_UartRxTail++; + 282: 81 a9 ldd r24, Z+49 ; 0x31 + 284: 8f 5f subi r24, 0xFF ; 255 + 286: 81 ab std Z+49, r24 ; 0x31 +#if USE_CTS + CTS_PORT |= (1<: + } +}; + + +MAIN_FUNC() { + MCUSR = 0; // clear all reset flags + 292: 14 be out 0x34, r1 ; 52 + WDTCSR &= ~(1<> BAUD_J1); + 2c8: ec 70 andi r30, 0x0C ; 12 + + return PGM_READ_BYTE (&BaudLookupTable[BaudSelectJumpersValue]); + 2ca: e6 95 lsr r30 + 2cc: e6 95 lsr r30 + 2ce: f0 e0 ldi r31, 0x00 ; 0 + 2d0: e8 59 subi r30, 0x98 ; 152 + 2d2: ff 4f sbci r31, 0xFF ; 255 + 2d4: e4 91 lpm r30, Z+ + CTS_DIR |= (1<> 8; + 2d8: 12 b8 out 0x02, r1 ; 2 + } + + INLINE_FUNC_DECLARE(void rxEnable(void)) { + UCSRB |= (1< + + Delay::millisec(15); + + *m_ctrlPort |= (1< + 37a: 8a e0 ldi r24, 0x0A ; 10 + 37c: 9b e3 ldi r25, 0x3B ; 59 + 37e: 01 97 sbiw r24, 0x01 ; 1 + 380: f1 f7 brne .-4 ; 0x37e + Delay::millisec(4.1); + + putChar (m_DATA_8); + 382: 8c e6 ldi r24, 0x6C ; 108 + 384: 90 e0 ldi r25, 0x00 ; 0 + 386: 60 e3 ldi r22, 0x30 ; 48 + 388: c4 de rcall .-632 ; 0x112 <_ZN3Lcd7putCharEh> + 38a: 80 e7 ldi r24, 0x70 ; 112 + 38c: 91 e0 ldi r25, 0x01 ; 1 + 38e: 01 97 sbiw r24, 0x01 ; 1 + 390: f1 f7 brne .-4 ; 0x38e + Delay::microsec(100); + + putChar (m_DATA_8); + 392: 8c e6 ldi r24, 0x6C ; 108 + 394: 90 e0 ldi r25, 0x00 ; 0 + 396: 60 e3 ldi r22, 0x30 ; 48 + 398: bc de rcall .-648 ; 0x112 <_ZN3Lcd7putCharEh> + *m_ctrlPort |= (1< + putCmd (m_PWR_ON); // Power up the display + 3b0: 8c e6 ldi r24, 0x6C ; 108 + 3b2: 90 e0 ldi r25, 0x00 ; 0 + 3b4: 6c e0 ldi r22, 0x0C ; 12 + 3b6: 03 df rcall .-506 ; 0x1be <_ZN3Lcd6putCmdEh> + putCmd (m_CLR_DSP); // Power up the display + 3b8: 8c e6 ldi r24, 0x6C ; 108 + 3ba: 90 e0 ldi r25, 0x00 ; 0 + 3bc: 61 e0 ldi r22, 0x01 ; 1 + 3be: ff de rcall .-514 ; 0x1be <_ZN3Lcd6putCmdEh> + gUart.rxInterruptEnable(); + gLed.init(&LED_PORT, &LED_DIR, LED_PIN); + gLcd.init(&LCD_CONTROL_PORT, &LCD_CONTROL_DIR, &LCD_DATA_PORT, + &LCD_DATA_DIR, &LCD_DATA_PIN_REG, LCD_RS, LCD_RW, LCD_E); + + sei(); + 3c0: 78 94 sei + + INLINE_FUNC_DECLARE(void stop(void)) { + TCCR0B = 0; + } + INLINE_FUNC_DECLARE(void start(void)) { + TCCR0B = (1<>= 1; + } + } + + INLINE_FUNC_DECLARE(void lampOn(void)) { + *m_LedPort |= (1< + 3d6: 8a c0 rjmp .+276 ; 0x4ec + &LCD_DATA_DIR, &LCD_DATA_PIN_REG, LCD_RS, LCD_RW, LCD_E); + + sei(); + while (1) { + if (gUart.charAvail()) { + SerialCommandProcessor::processChar (gUart.waitRxChar()); + 3d8: 82 e8 ldi r24, 0x82 ; 130 + 3da: 90 e0 ldi r25, 0x00 ; 0 + 3dc: 48 df rcall .-368 ; 0x26e <_ZN4Uart10waitRxCharEv> + 3de: 68 2f mov r22, r24 + +public: + INLINE_FUNC_DECLARE(static void processChar(unsigned char ch)) { + // avoid use of switch statement as ImageCraft and GCC produce signifcantly + // more code for a switch statement than a sequence of if/else if + if (ch == m_LED_SW_OFF) { + 3e0: 8d 3f cpi r24, 0xFD ; 253 + 3e2: a1 f4 brne .+40 ; 0x40c + INLINE_FUNC_DECLARE(void lampOn(void)) { + *m_LedPort |= (1< + 3f6: 88 0f add r24, r24 + 3f8: 99 1f adc r25, r25 + 3fa: 0a 94 dec r0 + 3fc: e2 f7 brpl .-8 ; 0x3f6 + 3fe: 80 95 com r24 + 400: 82 23 and r24, r18 + 402: 80 83 st Z, r24 + TCCR0B = (1< + INLINE_FUNC_DECLARE(static void processChar(unsigned char ch)) { + // avoid use of switch statement as ImageCraft and GCC produce signifcantly + // more code for a switch statement than a sequence of if/else if + if (ch == m_LED_SW_OFF) { + gLed.switchOff(); + } else if (ch == m_LED_SW_ON) { + 40c: 8c 3f cpi r24, 0xFC ; 252 + 40e: 41 f4 brne .+16 ; 0x420 + m_BIT_led_on = 0; + stop(); + } + + INLINE_FUNC_DECLARE(void switchOn(void)) { + m_BIT_led_on = 1; + 410: 00 93 7c 00 sts 0x007C, r16 + if (m_ledPwmPattern == 0xFF) { // maximum brightness, no need for PWM + 414: 80 91 7b 00 lds r24, 0x007B + 418: 8f 3f cpi r24, 0xFF ; 255 + 41a: 09 f0 breq .+2 ; 0x41e + 41c: 57 c0 rjmp .+174 ; 0x4cc + 41e: 40 c0 rjmp .+128 ; 0x4a0 + // more code for a switch statement than a sequence of if/else if + if (ch == m_LED_SW_OFF) { + gLed.switchOff(); + } else if (ch == m_LED_SW_ON) { + gLed.switchOn(); + } else if (ch == m_LED_SET_BRIGHTNESS) { + 420: 8b 3f cpi r24, 0xFB ; 251 + 422: 09 f0 breq .+2 ; 0x426 + 424: 55 c0 rjmp .+170 ; 0x4d0 + // read next byte which will be brightness + gLed.setBrightness(gUart.waitRxChar()); + 426: 82 e8 ldi r24, 0x82 ; 130 + 428: 90 e0 ldi r25, 0x00 ; 0 + 42a: 21 df rcall .-446 ; 0x26e <_ZN4Uart10waitRxCharEv> + start(); + } + } + + INLINE_FUNC_DECLARE(void setBrightness(unsigned char brightness)) { + if (brightness == 0) { // turn backlight off for 0 brightness + 42c: 88 23 and r24, r24 + 42e: d1 f4 brne .+52 ; 0x464 + if (m_BIT_led_on) { + 430: 80 91 7c 00 lds r24, 0x007C + 434: 88 23 and r24, r24 + 436: 49 f2 breq .-110 ; 0x3ca + m_BIT_led_on = 0; // note that LED is off + m_ledPwmPattern = 0xFF; // maximum brightness + } + + INLINE_FUNC_DECLARE(void stop(void)) { + TCCR0B = 0; + 438: 13 be out 0x33, r1 ; 51 + + INLINE_FUNC_DECLARE(void setBrightness(unsigned char brightness)) { + if (brightness == 0) { // turn backlight off for 0 brightness + if (m_BIT_led_on) { + stop(); + m_ledPwmPattern = 0; + 43a: 10 92 7b 00 sts 0x007B, r1 + m_ledPwmCycling = 0; + 43e: 10 92 7a 00 sts 0x007A, r1 + INLINE_FUNC_DECLARE(void lampOn(void)) { + *m_LedPort |= (1< + 454: 88 0f add r24, r24 + 456: 99 1f adc r25, r25 + 458: 0a 94 dec r0 + 45a: e2 f7 brpl .-8 ; 0x454 + 45c: 80 95 com r24 + 45e: 82 23 and r24, r18 + 460: 80 83 st Z, r24 + 462: b3 cf rjmp .-154 ; 0x3ca + lampOff(); + } + return; + } + + unsigned char ledPwmPos = (brightness * (m_LED_BRIGHTNESS_LEVELS-1) + 127) >> 8; + 464: 90 e0 ldi r25, 0x00 ; 0 + 466: 67 e0 ldi r22, 0x07 ; 7 + 468: 70 e0 ldi r23, 0x00 ; 0 + 46a: d1 d0 rcall .+418 ; 0x60e <__mulhi3> + 46c: 81 58 subi r24, 0x81 ; 129 + 46e: 9f 4f sbci r25, 0xFF ; 255 + 470: 89 2f mov r24, r25 + 472: 99 0f add r25, r25 + 474: 99 0b sbc r25, r25 + 476: 88 30 cpi r24, 0x08 ; 8 + 478: 08 f0 brcs .+2 ; 0x47c + 47a: 87 e0 ldi r24, 0x07 ; 7 + INLINE_FUNC_DECLARE(void lampOff(void)) { + *m_LedPort &= ~(1<> 8; + // Below is probably not required, but ensures we don't exceed array + if (ledPwmPos > m_LED_BRIGHTNESS_LEVELS - 1) + ledPwmPos = m_LED_BRIGHTNESS_LEVELS - 1; + m_ledPwmPattern = pwmPattern(ledPwmPos); + 486: e0 93 7b 00 sts 0x007B, r30 + m_ledPwmCount = 0; + 48a: 10 92 79 00 sts 0x0079, r1 + m_ledPwmCycling = m_ledPwmPattern; + 48e: e0 93 7a 00 sts 0x007A, r30 + if (ledPwmPos >= m_LED_BRIGHTNESS_LEVELS-1) { // maximum brightness + 492: 87 30 cpi r24, 0x07 ; 7 + 494: b1 f4 brne .+44 ; 0x4c2 + // don't need PWM to continuously on + if (m_BIT_led_on) { + 496: 80 91 7c 00 lds r24, 0x007C + 49a: 88 23 and r24, r24 + 49c: 09 f4 brne .+2 ; 0x4a0 + 49e: 95 cf rjmp .-214 ; 0x3ca + m_BIT_led_on = 0; // note that LED is off + m_ledPwmPattern = 0xFF; // maximum brightness + } + + INLINE_FUNC_DECLARE(void stop(void)) { + TCCR0B = 0; + 4a0: 13 be out 0x33, r1 ; 51 + m_ledPwmCycling >>= 1; + } + } + + INLINE_FUNC_DECLARE(void lampOn(void)) { + *m_LedPort |= (1< + 4b4: 88 0f add r24, r24 + 4b6: 99 1f adc r25, r25 + 4b8: 0a 94 dec r0 + 4ba: e2 f7 brpl .-8 ; 0x4b4 + 4bc: 28 2b or r18, r24 + 4be: 20 83 st Z, r18 + 4c0: 84 cf rjmp .-248 ; 0x3ca + if (m_BIT_led_on) { + stop(); + lampOn(); + } + } else { + if (m_BIT_led_on) { + 4c2: 80 91 7c 00 lds r24, 0x007C + 4c6: 88 23 and r24, r24 + 4c8: 09 f4 brne .+2 ; 0x4cc + 4ca: 7f cf rjmp .-258 ; 0x3ca + + INLINE_FUNC_DECLARE(void stop(void)) { + TCCR0B = 0; + } + INLINE_FUNC_DECLARE(void start(void)) { + TCCR0B = (1< + } else if (ch == m_LED_SW_ON) { + gLed.switchOn(); + } else if (ch == m_LED_SET_BRIGHTNESS) { + // read next byte which will be brightness + gLed.setBrightness(gUart.waitRxChar()); + } else if (ch == m_REG_MODE) { + 4d0: 8e 3f cpi r24, 0xFE ; 254 + 4d2: 41 f4 brne .+16 ; 0x4e4 + gLcd.putCmd (gUart.waitRxChar()); // Send LCD command character + 4d4: 82 e8 ldi r24, 0x82 ; 130 + 4d6: 90 e0 ldi r25, 0x00 ; 0 + 4d8: ca de rcall .-620 ; 0x26e <_ZN4Uart10waitRxCharEv> + 4da: 68 2f mov r22, r24 + 4dc: 8c e6 ldi r24, 0x6C ; 108 + 4de: 90 e0 ldi r25, 0x00 ; 0 + 4e0: 6e de rcall .-804 ; 0x1be <_ZN3Lcd6putCmdEh> + 4e2: 73 cf rjmp .-282 ; 0x3ca + } else { + gLcd.putChar (ch); // Send LCD data character + 4e4: 8c e6 ldi r24, 0x6C ; 108 + 4e6: 90 e0 ldi r25, 0x00 ; 0 + 4e8: 14 de rcall .-984 ; 0x112 <_ZN3Lcd7putCharEh> + 4ea: 6f cf rjmp .-290 ; 0x3ca + reset(); + WDTCSR |= (1< + +00000526 <__vector_7>: + } + MAIN_FUNC_LAST(); +} + + +ISR(USART_RX_vect) { + 526: 1f 92 push r1 + 528: 0f 92 push r0 + 52a: 0f b6 in r0, 0x3f ; 63 + 52c: 0f 92 push r0 + 52e: 11 24 eor r1, r1 + 530: 8f 93 push r24 + 532: 9f 93 push r25 + 534: ef 93 push r30 + 536: ff 93 push r31 + gUart.storeChar(UDR); + 538: 9c b1 in r25, 0x0c ; 12 + UCSRC = reg; + } + + INLINE_FUNC_DECLARE(unsigned char storeChar(unsigned char rx)) { + // Calculate next buffer position. + unsigned char tmphead = m_UartRxHead; + 53a: e0 91 b2 00 lds r30, 0x00B2 + if (tmphead == UART_RX_BUFFER_SIZE-1) + 53e: ef 32 cpi r30, 0x2F ; 47 + 540: 11 f4 brne .+4 ; 0x546 <__vector_7+0x20> + 542: e0 e0 ldi r30, 0x00 ; 0 + 544: 01 c0 rjmp .+2 ; 0x548 <__vector_7+0x22> + tmphead = 0; + else + tmphead++; + 546: ef 5f subi r30, 0xFF ; 255 + + // store in buffer if there is room + if (tmphead != m_UartRxTail) { + 548: 80 91 b3 00 lds r24, 0x00B3 + 54c: e8 17 cp r30, r24 + 54e: 31 f0 breq .+12 ; 0x55c <__vector_7+0x36> + m_UartRxHead = tmphead; // Store new index. + 550: e0 93 b2 00 sts 0x00B2, r30 + m_UartRxBuf[tmphead] = rx; + 554: f0 e0 ldi r31, 0x00 ; 0 + 556: ee 57 subi r30, 0x7E ; 126 + 558: ff 4f sbci r31, 0xFF ; 255 + 55a: 90 83 st Z, r25 +} + + +ISR(USART_RX_vect) { + gUart.storeChar(UDR); +} + 55c: ff 91 pop r31 + 55e: ef 91 pop r30 + 560: 9f 91 pop r25 + 562: 8f 91 pop r24 + 564: 0f 90 pop r0 + 566: 0f be out 0x3f, r0 ; 63 + 568: 0f 90 pop r0 + 56a: 1f 90 pop r1 + 56c: 18 95 reti + +0000056e <__vector_13>: + +ISR(TIMER0_COMPA_vect) { + 56e: 1f 92 push r1 + 570: 0f 92 push r0 + 572: 0f b6 in r0, 0x3f ; 63 + 574: 0f 92 push r0 + 576: 11 24 eor r1, r1 + 578: 2f 93 push r18 + 57a: 8f 93 push r24 + 57c: 9f 93 push r25 + 57e: ef 93 push r30 + 580: ff 93 push r31 + sei(); // Okay to allow USART interrupts while controlling LED PWM + 582: 78 94 sei + } + } + } + + INLINE_FUNC_DECLARE(void cyclePwm(void)) { + if (m_ledPwmCycling & 0x01) { // Set current LED state based on cycling variable + 584: 80 91 7a 00 lds r24, 0x007A + 588: 80 ff sbrs r24, 0 + 58a: 11 c0 rjmp .+34 ; 0x5ae <__vector_13+0x40> + m_ledPwmCycling >>= 1; + } + } + + INLINE_FUNC_DECLARE(void lampOn(void)) { + *m_LedPort |= (1< + 5a0: 88 0f add r24, r24 + 5a2: 99 1f adc r25, r25 + 5a4: 0a 94 dec r0 + 5a6: e2 f7 brpl .-8 ; 0x5a0 <__vector_13+0x32> + 5a8: 28 2b or r18, r24 + 5aa: 20 83 st Z, r18 + 5ac: 11 c0 rjmp .+34 ; 0x5d0 <__vector_13+0x62> + }; + + INLINE_FUNC_DECLARE(void lampOff(void)) { + *m_LedPort &= ~(1< + 5c2: 88 0f add r24, r24 + 5c4: 99 1f adc r25, r25 + 5c6: 0a 94 dec r0 + 5c8: e2 f7 brpl .-8 ; 0x5c2 <__vector_13+0x54> + 5ca: 80 95 com r24 + 5cc: 82 23 and r24, r18 + 5ce: 80 83 st Z, r24 + } else { + lampOff(); + } + + // Update cycling variable for next interrupt + if (m_ledPwmCount >= m_LED_BRIGHTNESS_LEVELS-1) { + 5d0: 80 91 79 00 lds r24, 0x0079 + 5d4: 87 30 cpi r24, 0x07 ; 7 + 5d6: 28 f0 brcs .+10 ; 0x5e2 <__vector_13+0x74> + m_ledPwmCount = 0; + 5d8: 10 92 79 00 sts 0x0079, r1 + m_ledPwmCycling = m_ledPwmPattern; + 5dc: 80 91 7b 00 lds r24, 0x007B + 5e0: 0a c0 rjmp .+20 ; 0x5f6 <__vector_13+0x88> + } else { + m_ledPwmCount++; + 5e2: 80 91 79 00 lds r24, 0x0079 + 5e6: 8f 5f subi r24, 0xFF ; 255 + 5e8: 80 93 79 00 sts 0x0079, r24 + m_ledPwmCycling >>= 1; + 5ec: 80 91 7a 00 lds r24, 0x007A + 5f0: 90 e0 ldi r25, 0x00 ; 0 + 5f2: 95 95 asr r25 + 5f4: 87 95 ror r24 + 5f6: 80 93 7a 00 sts 0x007A, r24 +} + +ISR(TIMER0_COMPA_vect) { + sei(); // Okay to allow USART interrupts while controlling LED PWM + gLed.cyclePwm(); +} + 5fa: ff 91 pop r31 + 5fc: ef 91 pop r30 + 5fe: 9f 91 pop r25 + 600: 8f 91 pop r24 + 602: 2f 91 pop r18 + 604: 0f 90 pop r0 + 606: 0f be out 0x3f, r0 ; 63 + 608: 0f 90 pop r0 + 60a: 1f 90 pop r1 + 60c: 18 95 reti + +0000060e <__mulhi3>: + 60e: 55 27 eor r21, r21 + 610: 00 24 eor r0, r0 + +00000612 <__mulhi3_loop>: + 612: 80 ff sbrs r24, 0 + 614: 02 c0 rjmp .+4 ; 0x61a <__mulhi3_skip1> + 616: 06 0e add r0, r22 + 618: 57 1f adc r21, r23 + +0000061a <__mulhi3_skip1>: + 61a: 66 0f add r22, r22 + 61c: 77 1f adc r23, r23 + 61e: 61 15 cp r22, r1 + 620: 71 05 cpc r23, r1 + 622: 21 f0 breq .+8 ; 0x62c <__mulhi3_exit> + 624: 96 95 lsr r25 + 626: 87 95 ror r24 + 628: 00 97 sbiw r24, 0x00 ; 0 + 62a: 99 f7 brne .-26 ; 0x612 <__mulhi3_loop> + +0000062c <__mulhi3_exit>: + 62c: 95 2f mov r25, r21 + 62e: 80 2d mov r24, r0 + 630: 08 95 ret + +00000632 <_exit>: + 632: f8 94 cli + +00000634 <__stop_program>: + 634: ff cf rjmp .-2 ; 0x634 <__stop_program> -- 2.34.1