source: trunk/platform/a3000/lib.c @ 1372

Revision 1372, 2.6 KB checked in by philmoz, 19 months ago (diff)

A3000 port from ERR99 - http://chdk.setepontos.com/index.php?topic=650.msg74533#msg74533
Firmware versions 1.00b, 1.00c and 1.00d.

  • Property svn:eol-style set to native
Line 
1#include "platform.h"
2#include "lolevel.h"
3
4void shutdown()
5{
6    volatile long *p = (void*)0xC0220010;
7   
8    asm(
9         "MRS     R1, CPSR\n"
10         "AND     R0, R1, #0x80\n"
11         "ORR     R1, R1, #0x80\n"
12         "MSR     CPSR_cf, R1\n"
13         :::"r1","r0");
14       
15    *p = 0x44;
16
17    while(1);
18}
19
20
21#define LED_PR 0xC0220010
22
23void debug_led(int state)
24{
25    volatile long *p=(void*)LED_PR;
26    if (state)
27        p[0]=0x46;
28    else
29        p[0]=0x44;
30}
31
32/*
33M:FFC24CDC sub_FFC24CDC                            ; CODE XREF: sub_FFC24E54+48p
34ROM:FFC24CDC                                         ; DATA XREF: sub_FFC24E54+34o
35ROM:FFC24CDC                 STMFD   SP!, {R4,LR}
36ROM:FFC24CE0                 MOV     R1, #0
37ROM:FFC24CE4                 MOV     R0, #4
38ROM:FFC24CE8                 BL      LEDDrive
39ROM:FFC24CEC                 MOV     R1, #0
40ROM:FFC24CF0                 MOV     R0, #2
41ROM:FFC24CF4                 BL      LEDDrive
42ROM:FFC24CF8                 MOV     R1, #0
43ROM:FFC24CFC                 MOV     R0, #0
44ROM:FFC24D00                 BL      LEDDrive
45ROM:FFC24D04                 MOV     R1, #0
46ROM:FFC24D08                 MOV     R0, #7
47ROM:FFC24D0C                 BL      LEDDrive
48ROM:FFC24D10                 LDMFD   SP!, {R4,LR}
49ROM:FFC24D14                 MOV     R1, #0
50ROM:FFC24D18                 MOV     R0, #8
51ROM:FFC24D1C                 B       LEDDrive
52ROM:FFC24D1C ; End of function sub_FFC24CDC
53
54*/
55
56
57void camera_set_led(int led, int state, int bright) {
58if (led == 4 || led == 7 ) // Green (power) or orange led
59        _LEDDrive(7, state<=1 ? !state : state);
60else if ( led == 9 ) // Red AF-Light
61        _LEDDrive(9, state<=1 ? !state : state);
62}
63
64int get_flash_params_count(void){
65/*
66ROM:FFD36E08                 BIC     R4, R4, #0x4000
67ROM:FFD36E0C                 CMP     R4, #0x94
68ROM:FFD36E10                 LDRCS   R0, =aPropertytablem ; "PropertyTableManagerCore.c"
69*/
70 return 0x94;
71}
72void vid_bitmap_refresh() {
73    extern int enabled_refresh_physical_screen;
74    extern int full_screen_refresh;
75
76    // asm1989: i've tried refreshphysical screen (screen unlock) and that caused the canon and
77    // function menu to not display at all. This seems to work and is called in a similar
78    // way in other places where original OSD should be refreshed.
79    extern void _LockAndRefresh();   // wrapper function for screen lock
80    extern void _UnlockAndRefresh();   // wrapper function for screen unlock
81
82    _LockAndRefresh();
83
84    enabled_refresh_physical_screen=1;
85    full_screen_refresh=3;   // found in ScreenUnlock underneath a CameraLog.c call
86
87    _UnlockAndRefresh();
88}
89
Note: See TracBrowser for help on using the repository browser.