Skip to content

Commit

Permalink
ixus300_sd4000 enabled CAM_REMOTE (added USB Remote support)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeldoc2000 committed Oct 22, 2010
1 parent ee4db74 commit 992c00a
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 10 deletions.
1 change: 0 additions & 1 deletion include/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -2337,7 +2337,6 @@
#define CAM_UNCACHED_BIT 0x40000000 // ROM:FF88A248 via ExMem.FreeCacheable()

#undef CAM_HAS_ERASE_BUTTON
#undef CAM_REMOTE
#undef CAM_SYNCH
#define CAM_HAS_ND_FILTER 1
#define CAM_HAS_IRIS_DIAPHRAGM 1
Expand Down
119 changes: 114 additions & 5 deletions platform/ixus300_sd4000/kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ static int shoot_counter=0;
#define KEYS_MASK1 (0x00000FF0) // physw_status[1], override 0xF0 (keys) + 0xF00 (feather)
#define KEYS_MASK2 (0x00000000) // physw_status[2]
//static long alt_mode_key_mask = 0x00000000; // we use two Keys, no need to override

#define SD_READONLY_FLAG (0x20000)

#define USB_MASK (0x40000) // ToDo: test value
#define SD_READONLY_FLAG (0x20000) // SD-Card Lock Status (locked / unlocked)
#define USB_MASK (0x80000) // USB-Power (triggered around 3,5V)

volatile int jogdial_stopped=0;

Expand Down Expand Up @@ -91,7 +89,19 @@ void my_kbd_read_keys() {
jogdial_stopped=0;
}

physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG; // override SD-Card READONLY flag for diskboot
remote_key = (physw_status[2] & USB_MASK)==USB_MASK;
if (remote_key)
remote_count += 1;
else if (remote_count) {
usb_power = remote_count;
remote_count = 0;
}

if (conf.remote_enable) {
physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK); // override USB and SD-Card Readonly Bits
}
else
physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG; // override SD-Card Readonly Bit
}

int get_usb_power(int edge) {
Expand Down Expand Up @@ -285,3 +295,102 @@ static KeyMap keymap[] = {
{ 0, KEY_PRINT , 0x0000000C }, // ALT Key workaround: KEY_UP + KEY_LEFT (camera has no print key)
{ 0, 0, 0 }
};

// generic function
// called from capt_seq.c at sub_FF9686A8_my()
void wait_until_remote_button_is_released(void) {
int count1;
int count2;
int tick,tick2,tick3;
int nSW;
int prev_usb_power,cur_usb_power;
static int nMode;

asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack

//debug_led(1);
tick = get_tick_count();
tick2 = tick;
static long usb_physw[3];
if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| (shooting_get_drive_mode()==1) || ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)))
//if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING))) // synch mode enable so wait for USB to disconnect
{
// ------ add by Masuji SUTO (start) --------------
nMode = 0;
usb_physw[2] = 0; // makes sure USB bit is cleared.
_kbd_read_keys_r2(usb_physw);
if((usb_physw[2] & USB_MASK)==USB_MASK) nMode=1;
// ------ add by Masuji SUTO (end) --------------
if(conf.ricoh_ca1_mode && conf.remote_enable) {
if(shooting_get_drive_mode() == 1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) { //continuous-shooting mode
if(conf.bracket_type>2) {
if(shoot_counter<2) shutter_int=3;
shoot_counter--;
} else {
prev_usb_power=0;
nSW = 0;
do {
usb_physw[2] = 0; // makes sure USB bit is cleared.
_kbd_read_keys_r2(usb_physw);
cur_usb_power = (usb_physw[2] & USB_MASK)==USB_MASK;
if(cur_usb_power) {
if(!prev_usb_power) {
tick2 = get_tick_count();
prev_usb_power=cur_usb_power;
} else {
if((int)get_tick_count()-tick2>1000) {debug_led(0);}
}
} else {
if(prev_usb_power) {
tick3 = (int)get_tick_count()-tick2;
if(nSW==10) {
if(tick3>50) shutter_int=1;
nSW=20;
}
if(nSW==0 && tick3>0) {
if(tick3<50) {
nSW=10;
} else {
if(tick3>1000) shutter_int=1;
nSW=20;
}
}
prev_usb_power=cur_usb_power;
}
}
if((int)get_tick_count()-tick >= DELAY_TIMEOUT) { nSW=20;shutter_int=2; }
}
while(nSW<20);
}
} // continuous-shooting mode
else { //nomal mode
shoot_counter=0;
if(conf.bracket_type>2) {
shoot_counter=(conf.bracket_type-2)*2;
}
do {
usb_physw[2] = 0; // makes sure USB bit is cleared.
_kbd_read_keys_r2(usb_physw);
}
//while(((usb_physw[2] & USB_MASK)==USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
while (((((usb_physw[2] & USB_MASK)!=USB_MASK) && (nMode==0)) || (((usb_physw[2] & USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
}
} else {
do {
usb_physw[2] = 0; // makes sure USB bit is cleared.
_kbd_read_keys_r2(usb_physw);
}
while ((usb_physw[2]&USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
}
}

if (conf.synch_delay_enable && conf.synch_delay_value>0) { // if delay is switched on and greater than 0
for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) { // wait delay_value * 0.1ms
for (count2=0;count2<1400;count2++) { // delay approx. 0.1ms
}
}
}

//debug_led(0);
asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack
}
3 changes: 2 additions & 1 deletion platform/ixus300_sd4000/notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ http://www.canon.com.my/p/EN/114-Digital-Cameras/203-IXUS/1556-Digital-IXUS-300-


--- Hardware address
physw_status[2] 0x20000 SD-Card Status (locked / unlocked) ?!?
0xC0220130 Green Led (backside)
0xc0220134 Red Led (backside)
0xC0223030 Red AF Led (front)
Expand All @@ -64,6 +63,8 @@ physw_status[2] 0x20000 SD-Card Status (locked / unlocked) ?!?
physw_status[0] = 0x32E94 // 0xC0220200 ?
physw_status[1] = 0x32E98 // 0xC0220204 ?
physw_status[2] = 0x32E9C // 0xC0220208 ?
physw_status[2] = 0x20000 // SD_READONLY_FLAG = SD-Card Status (locked / unlocked)
physw_status[2] = 0x80000 // USB_MASK = USB-Power (triggered around 3,5V)

--- PropertyCase
Number Name Location String
Expand Down
6 changes: 3 additions & 3 deletions platform/ixus300_sd4000/sub/100d/capt_seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ void __attribute__((naked,noinline)) sub_FF970A8C_my() {
"SUB R3, R3, #8\n"
"BL sub_FF973794\n"

//"BL wait_until_remote_button_is_released\n" // +
"BL capt_seq_hook_set_nr\n" // +
"B sub_FF970B40\n" // + continue in canon firmware
"BL wait_until_remote_button_is_released\n" // +
"BL capt_seq_hook_set_nr\n" // +
"B sub_FF970B40\n" // + continue in canon firmware

/*
"LDR R0, [R4,#0x1C]\n"
Expand Down

0 comments on commit 992c00a

Please sign in to comment.