| 1 | /* |
|---|
| 2 | ********************* |
|---|
| 3 | SX20 |
|---|
| 4 | ********************** |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | /* |
|---|
| 8 | SX130 |
|---|
| 9 | LED address: |
|---|
| 10 | same as sx210 |
|---|
| 11 | orange 0xC0220010 |
|---|
| 12 | green 0xC0220014 |
|---|
| 13 | AF 0xC022000C |
|---|
| 14 | */ |
|---|
| 15 | #define LED_AF 0xC022000C |
|---|
| 16 | #define LED_ORANGE 0xC0220010 |
|---|
| 17 | #define LED_GREEN 0xC0220014 |
|---|
| 18 | |
|---|
| 19 | #define DELAY 300000 |
|---|
| 20 | |
|---|
| 21 | #define LED_ON *((long*) LED_GREEN) = 0x46 |
|---|
| 22 | #define LED_OFF *((long*) LED_GREEN) = 0x44 |
|---|
| 23 | |
|---|
| 24 | #define LED_ON_RED *((long*) LED_ORANGE) = 0x46 |
|---|
| 25 | #define LED_OFF_RED *((long*) LED_ORANGE) = 0x44 |
|---|
| 26 | |
|---|
| 27 | #define LED_ON_AF *((long*) LED_AF) = 0x46 |
|---|
| 28 | #define LED_OFF_AF *((long*) LED_AF) = 0x44 |
|---|
| 29 | |
|---|
| 30 | void debug_led(int state) |
|---|
| 31 | { |
|---|
| 32 | if (state) |
|---|
| 33 | LED_ON; |
|---|
| 34 | else |
|---|
| 35 | LED_OFF; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | void debug_wait() |
|---|
| 39 | { |
|---|
| 40 | int counter; |
|---|
| 41 | |
|---|
| 42 | counter = DELAY; |
|---|
| 43 | while (counter--) { asm("nop\n nop\n"); }; |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | void debug_blink() |
|---|
| 48 | { |
|---|
| 49 | //led on |
|---|
| 50 | LED_ON; |
|---|
| 51 | debug_wait(); |
|---|
| 52 | |
|---|
| 53 | //led off |
|---|
| 54 | LED_OFF; |
|---|
| 55 | debug_wait(); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | void debug_blink_red() |
|---|
| 59 | { |
|---|
| 60 | //led on |
|---|
| 61 | LED_ON_RED; |
|---|
| 62 | debug_wait(); |
|---|
| 63 | |
|---|
| 64 | //led off |
|---|
| 65 | LED_OFF_RED; |
|---|
| 66 | debug_wait(); |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | /* |
|---|
| 71 | void debug_my_blink() |
|---|
| 72 | { |
|---|
| 73 | volatile long *p = (void*)LED_GREEN; // turned off later, so assumed to be power |
|---|
| 74 | volatile long *p2 = (void*)LED_AF; // turned off later, so assumed to be power |
|---|
| 75 | int counter; |
|---|
| 76 | |
|---|
| 77 | // DEBUG: blink led |
|---|
| 78 | //led on |
|---|
| 79 | counter = DELAY; |
|---|
| 80 | *p = 0x46; |
|---|
| 81 | while (counter--) { asm("nop\n nop\n"); }; |
|---|
| 82 | *p2 = 0x46; |
|---|
| 83 | //led off |
|---|
| 84 | counter = DELAY; |
|---|
| 85 | *p = 0x44; |
|---|
| 86 | while (counter--) { asm("nop\n nop\n"); }; |
|---|
| 87 | *p2= 0x44; |
|---|
| 88 | |
|---|
| 89 | } |
|---|
| 90 | */ |
|---|
| 91 | |
|---|
| 92 | #include "platform.h" |
|---|
| 93 | #include "lolevel.h" |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | /* |
|---|
| 97 | void vid_bitmap_refresh() |
|---|
| 98 | { |
|---|
| 99 | extern int enabled_refresh_physical_screen; // screen lock counter |
|---|
| 100 | extern void _ScreenUnlock(); |
|---|
| 101 | |
|---|
| 102 | // _LockAndRefresh(); |
|---|
| 103 | _ScreenLock(); |
|---|
| 104 | enabled_refresh_physical_screen=1; |
|---|
| 105 | // full_screen_refresh=3; //found in ScreenUnlock underneath a CameraLog.c call sub_FFA02598 //sx210 |
|---|
| 106 | _ScreenUnlock(); |
|---|
| 107 | // _UnlockAndRefresh(); |
|---|
| 108 | } |
|---|
| 109 | */ |
|---|
| 110 | |
|---|
| 111 | // Testing another refresh method |
|---|
| 112 | void vid_bitmap_refresh() |
|---|
| 113 | { |
|---|
| 114 | extern int enabled_refresh_physical_screen; |
|---|
| 115 | extern int full_screen_refresh; |
|---|
| 116 | |
|---|
| 117 | // i've tried refreshphysical screen (screen unlock) and that caused the canon and |
|---|
| 118 | // function menu to not display at all. This seems to work and is called in a similar |
|---|
| 119 | // way in other places where original OSD should be refreshed. |
|---|
| 120 | extern void _LockAndRefresh(); // wrapper function for screen lock |
|---|
| 121 | extern void _UnlockAndRefresh(); // wrapper function for screen unlock |
|---|
| 122 | |
|---|
| 123 | _LockAndRefresh(); |
|---|
| 124 | |
|---|
| 125 | enabled_refresh_physical_screen=1; |
|---|
| 126 | full_screen_refresh |= 3; |
|---|
| 127 | |
|---|
| 128 | _UnlockAndRefresh(); |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | void shutdown() |
|---|
| 132 | { |
|---|
| 133 | volatile long *p = (void*)0xC022001C; |
|---|
| 134 | |
|---|
| 135 | asm( |
|---|
| 136 | "MRS R1, CPSR\n" |
|---|
| 137 | "AND R0, R1, #0x80\n" |
|---|
| 138 | "ORR R1, R1, #0x80\n" |
|---|
| 139 | "MSR CPSR_cf, R1\n" |
|---|
| 140 | :::"r1","r0"); |
|---|
| 141 | |
|---|
| 142 | *p = 0x44; // power off. |
|---|
| 143 | |
|---|
| 144 | while(1); |
|---|
| 145 | } |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | void camera_set_led(int led, int state, int bright) { |
|---|
| 149 | static char led_table[3]={0,1,9}; |
|---|
| 150 | _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state); |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | int get_flash_params_count(void){ |
|---|
| 154 | return 132; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | void JogDial_CW(void){ |
|---|
| 158 | _PostLogicalEventForNotPowerType(0x874, 2); // RotateJogDialRight |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | void JogDial_CCW(void){ |
|---|
| 162 | _PostLogicalEventForNotPowerType(0x875, 2); // RotateJogDialLeft |
|---|
| 163 | } |
|---|
| 164 | |
|---|