source: trunk/loader/ixus800_sd700/main.c @ 531

Revision 531, 2.1 KB checked in by phyrephox, 5 years ago (diff)
  • increased version number to reflect for latest changes from previous revisions

+ added zoom override. first installment allows you to set a specific zoom value (on s3is for example between 0 and 128, on a620 between 0 and 8) that will be set upon starting the cam in record mode. Extra Photo Operations -> Zoom Override. You can disable and enable it there (default: off), also you can set the startup behaviour (there isnt much working right now :D). In the future: Not only set the zoom steps (in accurate int) but maybe set it using mm & factor (much like the shutter override menu stuff to allow for easing setting using "mnemonics"). Also will implement ZOOM BRACKETING. could be done via script, but then again everything could be done via script ;) Also i am wondering if i should focus after zooming. Also the zoom override should work like this, that no matter what value of zoom you set using the zoom lever, before each pic is taken the zoom will be set to the value you specified in the menu (much like shutter & aperture override). Also maybe implement the feature so that it remembers the actual zoom value you set (via lever/button) before shutting off the cam - and restore it when you power it on again!?
This feature works a) as somehow a "C" (custom mode in which you can save a few settings that will be remembered even when you shut off the cam) mode for cameras that dont have it and b) for studio photogs or other situations where you need the zoom in a fixed value over a long period of time. Noticed a bug: when you use this feature to zet zoom upon startup, you cant zoom out using the zoomlever, unless you zoom out before - i guess it is because the camera thinks you are still in wide (zoom 0). i guess one can fix that, dunno how though (yet).

+ added czech language file

  • fixed russian lang file - pethead updated it in the wiki (there are a lot of outdated lang files in the wiki, come on people!)
  • Property svn:eol-style set to native
Line 
1static void __attribute__((noreturn)) shutdown();
2static void __attribute__((noreturn)) panic(int cnt);
3
4extern long *blob_chdk_core;
5extern long *blob_copy_and_reset;
6extern long blob_chdk_core_size;
7extern long blob_copy_and_reset_size;
8
9/* @brief Makes a copy of CHDK core in instruction memory and restarts FW.
10 *
11 * Starts by copying existing copy_and_restart procedure to 0x50000 and then using
12 * copied start_and_restart procedure to copy CHDK core to 0x9C890.  Absolute HEX
13 * addresses come from makefile.inc definitions.
14 *
15 * @note This is required because camera starts in standard FW (i.e. canon).  To switch between
16 * canon and CHDK FW a reset is required.  If start of CHDK FW was a reset then new FW would
17 * continually restart.  As a result CHDK FW on first pass must copy CHDK core (i.e. removing reset
18 * code) to instruction memory and then restarting FW so CHDK core executes.
19 *
20 * @return Does not return.
21 */
22void __attribute__((noreturn)) my_restart()
23{
24    void __attribute__((noreturn)) (*copy_and_restart)(char *dst, char *src, long length);
25    int i;
26
27    // Make a copy of the procedure copy_and_reset in another memory space.
28        for (i = 0 ; i < (blob_copy_and_reset_size / sizeof(long)) ; i++ )
29        {
30                ((long*)(RESTARTSTART))[i] = blob_copy_and_reset[i];
31    }
32
33        // Execute duplicated code in non-instruction memory space.
34    copy_and_restart = (void*)RESTARTSTART;
35    copy_and_restart((void*)MEMISOSTART, (char*)blob_chdk_core, blob_chdk_core_size);
36}
37
38#define LED_PR 0xc0220084
39
40static void __attribute__((noreturn)) shutdown()
41{
42    volatile long *p = (void*)0xc02200a0;
43       
44    asm(
45         "MRS     R1, CPSR\n"
46         "AND     R0, R1, #0x80\n"
47         "ORR     R1, R1, #0x80\n"
48         "MSR     CPSR_cf, R1\n"
49         :::"r1","r0");
50       
51    *p = 0x44;
52
53    while(1);
54}
55
56
57static void __attribute__((noreturn)) panic(int cnt)
58{
59        volatile long *p=(void*)LED_PR;
60        int i;
61
62        for(;cnt>0;cnt--){
63                p[0]=0x46;
64
65                for(i=0;i<0x200000;i++){
66                        asm ("nop\n");
67                        asm ("nop\n");
68                }
69                p[0]=0x44;
70                for(i=0;i<0x200000;i++){
71                        asm ("nop\n");
72                        asm ("nop\n");
73                }
74        }
75        shutdown();
76}
Note: See TracBrowser for help on using the repository browser.