root/tools/ghidra_scripts/datatypes/fw_types.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2 types for ghidra
   3 pulled from various parts of the CHDK source
   4 
   5 see fw_functions.h for required defines and other details
   6 */
   7 
   8 #ifndef FW_TYPES_H
   9 #define FW_TYPES_H
  10 struct led_control {int led_num; int action; int brightness; int blink_count;};
  11 
  12 #if !CAM_DRYOS_REL
  13 
  14 struct  __stat  // VxWorks
  15 {
  16     unsigned long       st_dev;         /* device ID number */
  17     unsigned long       st_ino;         /* file serial number */
  18     unsigned short      st_mode;        /* file mode (see below) */
  19     short               st_nlink;       /* number of links to file */
  20     short               st_uid;         /* user ID of file's owner */
  21     short               st_gid;         /* group ID of file's group */
  22     unsigned long       st_rdev;        /* device ID, only if special file */
  23     unsigned long       st_size;        /* size of file, in bytes */
  24     unsigned long       st_atime;       /* time of last access */
  25     unsigned long       st_mtime;       /* time of last modification */
  26     unsigned long       st_ctime;       /* time of last change of file status */
  27     long                st_blksize;
  28     long                st_blocks;
  29     unsigned char       st_attrib;      /* file attribute byte (dosFs only) */
  30     int                 reserved1;      /* reserved for future use */
  31     int                 reserved2;      /* reserved for future use */
  32     int                 reserved3;      /* reserved for future use */
  33     int                 reserved4;      /* reserved for future use */
  34     int                 reserved5;      /* reserved for future use */
  35     int                 reserved6;      /* reserved for future use */
  36 };
  37 
  38 #elif CAM_DRYOS_REL < 39
  39 struct  __stat  // DryOS pre R39
  40     {
  41     unsigned long       st_dev;         //?
  42     unsigned long       st_ino;         //?
  43     unsigned short      st_mode;        //?
  44     short               st_nlink;       //?
  45     short               st_uid;         //?
  46     short               st_gid;         //?
  47     unsigned long       st_atime;       //?
  48     unsigned long       st_mtime;       //?
  49     unsigned long       st_ctime;       //?
  50     unsigned long       st_size;
  51     long                st_blksize;     //?
  52     long                st_blocks;      //?
  53     unsigned char       st_attrib;
  54     int                 reserved1;      //
  55     int                 reserved2;      //
  56     int                 reserved3;      //
  57     int                 reserved4;      //
  58     int                 reserved5;      //
  59     int                 reserved6;      //
  60 };
  61 
  62 #elif CAM_DRYOS_REL < 59
  63 
  64 struct __stat   // DryOS R39...R58
  65 {
  66     unsigned long       st_unknown_1;
  67     unsigned long       st_attrib;
  68     unsigned long       st_size;
  69     unsigned long       st_ctime;
  70     unsigned long       st_mtime;
  71     unsigned long       st_unknown_2;
  72 };
  73 
  74 #else
  75 
  76 struct __stat   // DryOS >= R59
  77 {
  78     unsigned long       st_unknown_1;
  79     unsigned long       st_attrib;
  80     unsigned long       st_size;        // fixme: very likely 64bit, upper 32 bit is st_unknown_2
  81     unsigned long       st_unknown_2;
  82     unsigned long       st_ctime;
  83     unsigned long       st_mtime;
  84     unsigned long       st_unknown_3;
  85 };
  86 
  87 #endif//CAM_DRYOS_REL
  88 
  89 // from ptp_chdk.h
  90 typedef struct {
  91     int code;
  92     int sess_id;
  93     int trans_id;
  94     int num_param;
  95     int param1;
  96     int param2;
  97     int param3;
  98     int param4;
  99     int param5;
 100 } PTPContainer;
 101 
 102 typedef struct {
 103     int handle;
 104     int (*send_data)(int handle, const char *buf, int part_size, int total_size, int, int, int); // (0xFF9F525C), total_size should be 0 except for the first call
 105     int (*recv_data)(int handle, char *buf, int size, int, int); // (0xFF9F5500)
 106 #ifdef VX_OLD_PTP
 107     int (*send_resp)(int handle, PTPContainer *resp, int zero); // (0xFF9F5688), ixus30/40 needs a third argument, which is always 0
 108 #else
 109     int (*send_resp)(int handle, PTPContainer *resp); // extra param messes up analysis
 110 #endif
 111     int (*get_data_size)(int handle); // (0xFF9F5830)
 112     int (*send_err_resp)(int handle, PTPContainer *resp); // (0xFF9F5784)
 113     int unknown1; // ???
 114     int (*f2)(); // ??? (0xFF8D5B24)
 115     int (*f3)(); // ??? (0xFF8D5B5C)
 116     int more[1];
 117     // more??
 118 } ptp_data;
 119 
 120 typedef int (*ptp_handler)(int, ptp_data*, int, int, int, int, int, int, int, int);
 121 
 122 // made up, for eventproc table functions
 123 typedef struct {
 124     const char *name;
 125     int (*func)();
 126 } eventproc_table_entry;
 127 
 128 // based on include/std/stdio.h
 129 // reverse engineered file struct. Appears to be valid for both vxworks and dryos
 130 // don't use this directly unless you absolutely need to
 131 // don't EVER try to create one yourself, as this isn't the full structure.
 132 typedef struct FILE_S {
 133     int fd;         // used by Read/Write
 134     unsigned len;   // +4 verfied in Fseek_FileStream
 135     int unk0;       // +8
 136     unsigned pos;   // +0xC verified in Fseek_FileStream
 137     /* below not used in CHDK */
 138     int unk1;        // +0x10
 139     int unk2;        // +0x14
 140     char * io_buf;      // +0x18 32k uncached allocated in Fopen_FileStream
 141     int unk3;        // +0x20 related to StartFileAccess_Sem
 142     char name[127]; // in reality, allocated dynamically but giving length gives better decompilation
 143 } FILE;
 144 
 145 
 146 // first parameter to mzrm_createmsg / mzrm_sendmsg
 147 typedef struct mzrm_context_s mzrm_context;
 148 typedef struct mzrm_context_s {
 149     int unk0;
 150     int sem;
 151     unsigned alloc_avail;
 152     int unk1;
 153     int index1; // probably a circular buffer of some kind?
 154     int index2;
 155     int unk2[3];
 156     void (*maybe_wait_fn)(mzrm_context *ctx);
 157     int unk3[2]; // possibly more
 158 };
 159 
 160 typedef struct mzrm_msg_s {
 161     int msg_type;
 162     int unk;
 163     int payload_size;
 164     int payload[16]; // actual size varies
 165 } mzrm_msg;
 166 #endif
 167 

/* [<][>][^][v][top][bottom][index][help] */