[400plus] r1836 committed - started working on PTP stuff (WIP)

4 views
Skip to first unread message

400...@googlecode.com

unread,
May 4, 2013, 9:19:33 PM5/4/13
to 400...@googlegroups.com
Revision: 1836
Author: fire...@gmail.com
Date: Sat May 4 18:18:09 2013
Log: started working on PTP stuff (WIP)
http://code.google.com/p/400plus/source/detail?r=1836

Added:
/trunk/ptp.c
/trunk/ptp.h
/trunk/state_object.h
Modified:
/trunk/firmware/camera.S

=======================================
--- /dev/null
+++ /trunk/ptp.c Sat May 4 18:18:09 2013
@@ -0,0 +1,36 @@
+/**
+ * $Revision: $
+ * $Date: $
+ * $Author: $
+ */
+
+#include <stdint.h>
+
+#include "ptp.h"
+#include "state_object.h"
+
+#include "bmp.h"
+
+extern _PtpMgr_t *hPtpMgr; // defined in camera.S
+
+void ptp_dump_info() {
+
+ state_object_t *ptp_state_object = hPtpMgr->state_object;
+
+ lcd_printf(0,0, "matrix @ 0x%08X, %d inputs, %d states ",
ptp_state_object->state_matrix, ptp_state_object->max_inputs,
ptp_state_object->max_states);
+ int i;
+ int s;
+ int x, y;
+ for (i=0; i<ptp_state_object->max_inputs; i++) {
+ for (s=0; s<ptp_state_object->max_states; s++) {
+ int idx = s+i*ptp_state_object->max_states;
+ y = ((idx) % 19)+1;
+ x = ((float)((idx) / 19)<1) ? 0 : 22;
+ lcd_printf(x,y, "%02d:%02d/%d:0x%08X[%d]", idx, i, s,
STATE_FUNC(ptp_state_object, i, s), STATE_NEXT(ptp_state_object, i, s));
+ if (idx>=37) goto out;
+ }
+ }
+out:
+ return;
+}
+
=======================================
--- /dev/null
+++ /trunk/ptp.h Sat May 4 18:18:09 2013
@@ -0,0 +1,32 @@
+/**
+ * $Revision: $
+ * $Date: $
+ * $Author: $
+ */
+
+#ifndef _PTP_H_
+#define _PTP_H_
+
+#include "state_object.h"
+
+typedef struct {
+ char *name;
+ void *stage_class;
+ state_object_t *state_object;
+ void *debug_class;
+ void *unk_0x10;
+ void *pmgr_sync_event;
+ void *unk_0x18;
+ void *unk_0x1C;
+ void *unk_0x20;
+ void *ptp_sync_data_event_flag_struct;
+ void *unk_0x28;
+ void *unk_0x2C;
+ void *block_64kb;
+ void *unk_0x34;
+ void *unk_0x38;
+} _PtpMgr_t;
+
+void ptp_dump_info();
+
+#endif // _PTP_H_
=======================================
--- /dev/null
+++ /trunk/state_object.h Sat May 4 18:18:09 2013
@@ -0,0 +1,62 @@
+/**
+ * $Revision: $
+ * $Date: $
+ * $Author: $
+ */
+
+#ifndef _STATE_OBJECT_H_
+#define _STATE_OBJECT_H_
+
+// with some help from ML here we have state objects
+// they look the same in 400d
+
+typedef struct state_object_struct * (*state_transition_function_t)(
+ void * x,
+ void * y,
+ void * z,
+ void * w
+);
+
+struct state_transition_struct {
+ uint32_t next_state;
+ state_transition_function_t state_transition_function;
+};
+typedef struct state_transition_struct state_transition_t;
+
+
+struct state_object_struct {
+ const char * type; // off 0x00, "StateObject"
+ const char * name; // off 0x04, arg 0
+ uint32_t auto_sequence; // off 0x08, arg 1
+
+ // off 0x0c, always DefaultStateHandler ?
+ void (*state_object_handler)(
+ struct state_object_struct * self,
+ void * x,
+ uint32_t input,
+ void * z,
+ void * t
+ );
+
+ // Points to an array of size [max_inputs][max_states]
+ state_transition_t * state_matrix; // off 0x10
+ uint32_t max_inputs; // off 0x14, arg 2
+ uint32_t max_states; // off 0x18, arg 3
+ uint32_t current_state; // off 0x1c, initially 0
+};
+typedef struct state_object_struct state_object_t;
+
+extern state_object_t * CreateStateObject(
+ const char * name,
+ int auto_sequence,
+ state_transition_t * state_matrix,
+ int max_inputs,
+ int max_states
+);
+
+// the matrix is all states for one input, then all states for next input,
etc...
+#define STATE_FUNC(stateobj,input,state) stateobj->state_matrix[(state) +
(input) * stateobj->max_states].state_transition_function
+#define STATE_NEXT(stateobj,input,state) stateobj->state_matrix[(state) +
(input) * stateobj->max_states].next_state
+
+#endif // _PTP_H_
+
=======================================
--- /trunk/firmware/camera.S Fri Apr 12 14:45:36 2013
+++ /trunk/firmware/camera.S Sat May 4 18:18:09 2013
@@ -6,6 +6,7 @@

#include "../stub.h"

+DEF(hPtpMgr, 0x00006538)
DEF(DPData, 0x00016B60)
DEF(LensID, 0x00005884)
DEF(is_release_permitted, 0x00001CD4)
Reply all
Reply to author
Forward
0 new messages