1 #ifndef LEVENT_H 2 #define LEVENT_H 3 4 // CHDK interface to firmware 'logical events' 5 6 // Note: used in modules and platform independent code. 7 // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values) 8 9 #define LEVENT_INVALID_INDEX 0xFFFFFFFF 10 11 /* logical event definition*/ 12 typedef struct { 13 char *name; /* name of event, may point to empty string */ 14 unsigned id; /* event id number used with canon event fuctions (post etc) */ 15 unsigned param; /* unknown 0-3 */ 16 } levent_def; 17 /* 18 table of event definitions in ROM, 19 address can be found with tools/find_levent 20 terminated by an event with a NULL (not empty string) name pointer. 21 */ 22 extern levent_def levent_table[]; 23 24 /* return index of named event, or LEVENT_INVALID_INDEX */ 25 unsigned levent_index_for_name(const char *name); 26 27 /* return index of event with given id, or LEVENT_INVALID_INDEX */ 28 unsigned levent_index_for_id(unsigned id); 29 30 /* number of events in table, including final id 0 and id -1*/ 31 unsigned levent_count(void); 32 33 /* return id of named event, or 0 */ 34 unsigned levent_id_for_name(const char *name); 35 36 /* return name of event with given id, or NULL */ 37 const char * levent_name_for_id(unsigned id); 38 39 /* post the named event with PostLogicalEventToUI */ 40 int levent_post_to_ui_by_name(const char *name); 41 42 /* post press/unpress events for RecButton and PBButton */ 43 void levent_set_record(void); 44 void levent_set_play(void); 45 46 extern void SetLogicalEventActive(unsigned event, unsigned state); 47 extern void PostLogicalEventForNotPowerType(unsigned event, unsigned unk); 48 extern void PostLogicalEventToUI(unsigned event, unsigned unk); 49 extern void SetScriptMode(unsigned mode); 50 51 extern int switch_mode_usb(int mode); // 0 = playback, 1 = record; return indicates success 52 // N.B.: switch_mode only supported when USB is connected 53 #endif