Changeset 948
- Timestamp:
- 02/09/12 19:51:54 (17 months ago)
- Location:
- trunk
- Files:
-
- 19 edited
-
core/luascript.c (modified) (6 diffs)
-
core/main.c (modified) (1 diff)
-
core/suba.c (modified) (1 diff)
-
include/camera.h (modified) (4 diffs)
-
include/lolevel.h (modified) (1 diff)
-
include/platform.h (modified) (1 diff)
-
platform/a1100/platform_camera.h (modified) (1 diff)
-
platform/a540/platform_camera.h (modified) (1 diff)
-
platform/a590/platform_camera.h (modified) (1 diff)
-
platform/d10/platform_camera.h (modified) (1 diff)
-
platform/g10/platform_camera.h (modified) (1 diff)
-
platform/g12/platform_camera.h (modified) (1 diff)
-
platform/generic/wrappers.c (modified) (3 diffs)
-
platform/ixus310_elph500hs/platform_camera.h (modified) (1 diff)
-
platform/ixus40_sd300/platform_camera.h (modified) (1 diff)
-
platform/s95/platform_camera.h (modified) (1 diff)
-
platform/sx20/platform_camera.h (modified) (1 diff)
-
platform/sx30/platform_camera.h (modified) (1 diff)
-
platform/sx40hs/platform_camera.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/luascript.c
r933 r948 16 16 #include "motion_detector.h" 17 17 #include "ptp.h" 18 #include "core.h" 18 19 #include "gui_fselect.h" 19 20 #include "lang.h" … … 1403 1404 } 1404 1405 1406 static void set_number_field(lua_State* L, const char *key, int val) 1407 { 1408 lua_pushnumber(L, val); 1409 lua_setfield(L, -2, key); 1410 } 1411 1405 1412 static int luaCB_get_buildinfo( lua_State* L ) 1406 1413 { … … 2008 2015 #endif 2009 2016 2017 /* helper for meminfo to set table field only if valid */ 2018 static void set_meminfo_num( lua_State* L,const char *name, int val) { 2019 if(val != -1) { 2020 set_number_field( L, name, val ); 2021 } 2022 } 2023 /* 2024 meminfo=get_meminfo([heapname]) 2025 get camera memory information 2026 heapname="system" or "exmem" if not given, meminfo is returned for heap used by CHDK for malloc 2027 meminfo is false if the requested heapname isn't valid ("exmem" when exmem is not enabled, or unknown) 2028 otherwise, a table of the form 2029 meminfo = { 2030 name -- string "system" or "exmem" 2031 chdk_malloc -- bool, this is the heap used by CHDK for malloc 2032 chdk_start -- number, load address of CHDK 2033 chdk_size -- number, size of CHDK image 2034 -- all the following are numbers, will not be set if not available 2035 start_address 2036 end_address 2037 total_size 2038 allocated_size 2039 allocated_peak 2040 allocated_count 2041 free_size 2042 free_block_max_size 2043 free_block_count 2044 } 2045 NOTES 2046 * under vxworks and cameras without GetMemInfo only the only valid fields 2047 for the system heap will be those defined by chdk and free_block_max_size 2048 * the meaning of fields may not correspond exactly between exmem and system 2049 */ 2050 static int luaCB_get_meminfo( lua_State* L ) { 2051 // for memory info, duplicated from lowlevel 2052 extern const char _start,_end; 2053 2054 #if defined(OPT_EXMEM_MALLOC) && !defined(OPT_EXMEM_TESTING) 2055 const char *default_heapname="exmem"; 2056 #else 2057 const char *default_heapname="system"; 2058 #endif 2059 const char *heapname = luaL_optstring( L, 1, default_heapname ); 2060 cam_meminfo meminfo; 2061 2062 if(strcmp(heapname,"system") == 0) { 2063 #if defined(CAM_FIRMWARE_MEMINFO) 2064 GetMemInfo(&meminfo); 2065 #else 2066 memset(&meminfo,0xFF,sizeof(cam_meminfo)); 2067 meminfo.free_block_max_size = core_get_free_memory(); 2068 #endif 2069 } 2070 #if defined(OPT_EXMEM_MALLOC) && !defined(OPT_EXMEM_TESTING) 2071 else if(strcmp(heapname,"exmem") == 0) { 2072 GetExMemInfo(&meminfo); 2073 meminfo.allocated_count = -1; // not implemented in suba 2074 } 2075 #endif 2076 else { 2077 lua_pushboolean(L,0); 2078 return 1; 2079 } 2080 // adjust start and size, if CHDK is loaded at heap start 2081 if(meminfo.start_address == (int)(&_start)) { 2082 meminfo.start_address += MEMISOSIZE; 2083 meminfo.total_size -= MEMISOSIZE; 2084 } 2085 lua_createtable(L, 0, 13); // might not always use 13, but doesn't hurt 2086 set_string_field( L,"name", heapname ); 2087 lua_pushboolean( L, (strcmp(heapname,default_heapname)==0)); 2088 lua_setfield(L, -2, "chdk_malloc"); 2089 set_number_field( L, "chdk_start", (int)(&_start) ); 2090 set_number_field( L, "chdk_size", MEMISOSIZE ); 2091 set_meminfo_num( L, "start_address", meminfo.start_address ); 2092 set_meminfo_num( L, "end_address", meminfo.end_address); 2093 set_meminfo_num( L, "total_size", meminfo.total_size); 2094 set_meminfo_num( L, "allocated_size", meminfo.allocated_size); 2095 set_meminfo_num( L, "allocated_peak", meminfo.allocated_peak); 2096 set_meminfo_num( L, "allocated_count", meminfo.allocated_count); 2097 set_meminfo_num( L, "free_size", meminfo.free_size); 2098 set_meminfo_num( L, "free_block_max_size", meminfo.free_block_max_size); 2099 set_meminfo_num( L, "free_block_count", meminfo.free_block_count); 2100 return 1; 2101 } 2102 2010 2103 /* 2011 2104 set scheduling parameters … … 2021 2114 } 2022 2115 2116 static void register_func( lua_State* L, const char *name, void *func) { 2117 lua_pushcfunction( L, func ); 2118 lua_setglobal( L, name ); 2119 } 2120 2121 #define FUNC( X ) { #X, luaCB_##X }, 2122 static const luaL_Reg chdk_funcs[] = { 2123 FUNC(shoot) 2124 FUNC(sleep) 2125 FUNC(cls) 2126 FUNC(set_console_layout) 2127 FUNC(set_console_autoredraw) 2128 FUNC(console_redraw) 2129 FUNC(get_av96) 2130 FUNC(get_bv96) 2131 FUNC(get_day_seconds) 2132 FUNC(get_disk_size) 2133 FUNC(get_dofinfo) 2134 FUNC(get_free_disk_space) 2135 FUNC(get_focus) 2136 FUNC(get_iso_market) 2137 FUNC(get_iso_mode) 2138 FUNC(get_iso_real) 2139 FUNC(get_jpg_count) 2140 FUNC(get_prop) 2141 FUNC(get_prop_str) 2142 FUNC(get_raw_count) 2143 FUNC(get_raw_nr) 2144 FUNC(get_raw) 2145 FUNC(get_sv96) 2146 FUNC(get_tick_count) 2147 FUNC(get_tv96) 2148 FUNC(get_user_av_id) 2149 FUNC(get_user_av96) 2150 FUNC(get_user_tv_id) 2151 FUNC(get_user_tv96) 2152 FUNC(get_vbatt) 2153 FUNC(get_zoom) 2154 FUNC(get_exp_count) 2155 FUNC(get_flash_params_count) 2156 FUNC(get_parameter_data) 2157 2158 FUNC(set_av96_direct) 2159 FUNC(set_av96) 2160 FUNC(set_focus) 2161 FUNC(set_iso_mode) 2162 FUNC(set_iso_real) 2163 FUNC(set_led) 2164 FUNC(set_nd_filter) 2165 FUNC(set_prop) 2166 FUNC(set_prop_str) 2167 FUNC(set_raw_nr) 2168 FUNC(set_raw) 2169 FUNC(set_sv96) 2170 FUNC(set_tv96_direct) 2171 FUNC(set_tv96) 2172 FUNC(set_user_av_by_id_rel) 2173 FUNC(set_user_av_by_id) 2174 FUNC(set_user_av96) 2175 FUNC(set_user_tv_by_id_rel) 2176 FUNC(set_user_tv_by_id) 2177 FUNC(set_user_tv96) 2178 FUNC(set_zoom_speed) 2179 FUNC(set_zoom_rel) 2180 FUNC(set_zoom) 2181 2182 FUNC(wait_click) 2183 FUNC(is_pressed) 2184 FUNC(is_key) 2185 #ifdef CAM_HAS_JOGDIAL 2186 FUNC(wheel_right) 2187 FUNC(wheel_left) 2188 #endif 2189 FUNC(md_get_cell_diff) 2190 FUNC(md_detect_motion) 2191 FUNC(autostarted) 2192 FUNC(get_autostart) 2193 FUNC(set_autostart) 2194 FUNC(get_usb_power) 2195 FUNC(enter_alt) 2196 FUNC(exit_alt) 2197 FUNC(shut_down) 2198 FUNC(print_screen) 2199 2200 #ifdef CAM_MULTIPART 2201 FUNC(get_partitionInfo) 2202 FUNC(swap_partitions) 2203 #endif 2204 2205 FUNC(get_focus_mode) 2206 FUNC(get_focus_state) 2207 FUNC(get_focus_ok) 2208 FUNC(get_propset) 2209 FUNC(get_zoom_steps) 2210 FUNC(get_drive_mode) 2211 FUNC(get_flash_mode) 2212 FUNC(get_shooting) 2213 FUNC(get_flash_ready) 2214 FUNC(get_IS_mode) 2215 FUNC(set_ev) 2216 FUNC(get_ev) 2217 FUNC(get_orientation_sensor) 2218 FUNC(get_nd_present) 2219 FUNC(get_movie_status) 2220 FUNC(set_movie_status) 2221 2222 FUNC(get_histo_range) 2223 FUNC(shot_histo_enable) 2224 FUNC(play_sound) 2225 FUNC(get_temperature) 2226 FUNC(peek) 2227 FUNC(poke) 2228 FUNC(bitand) 2229 FUNC(bitor) 2230 FUNC(bitxor) 2231 FUNC(bitshl) 2232 FUNC(bitshri) 2233 FUNC(bitshru) 2234 FUNC(bitnot) 2235 2236 FUNC(get_time) 2237 2238 FUNC(get_buildinfo) 2239 FUNC(get_mode) 2240 2241 FUNC(set_raw_develop) 2242 // NOTE these functions normally run in the spytask. 2243 // called from lua they will run from kbd task instead 2244 FUNC(raw_merge_start) 2245 FUNC(raw_merge_add_file) 2246 FUNC(raw_merge_end) 2247 FUNC(set_backlight) 2248 FUNC(set_aflock) 2249 #ifdef OPT_CURVES 2250 FUNC(set_curve_state) 2251 FUNC(get_curve_state) 2252 FUNC(set_curve_file) 2253 FUNC(get_curve_file) 2254 #endif 2255 // get levent definition by name or id, nil if not found 2256 FUNC(get_levent_def) 2257 // get levent definition by index, nil if out of range 2258 FUNC(get_levent_def_by_index) 2259 // get levent index from name or ID 2260 FUNC(get_levent_index) 2261 FUNC(post_levent_to_ui) 2262 FUNC(post_levent_for_npt) 2263 FUNC(set_levent_active) 2264 FUNC(set_levent_script_mode) 2265 2266 FUNC(set_capture_mode) 2267 FUNC(set_capture_mode_canon) 2268 FUNC(is_capture_mode_valid) 2269 2270 FUNC(set_record) 2271 2272 FUNC(switch_mode_usb) 2273 2274 #ifdef OPT_LUA_CALL_NATIVE 2275 FUNC(call_event_proc) 2276 FUNC(call_func_ptr) 2277 #endif 2278 FUNC(reboot) 2279 FUNC(get_config_value) 2280 FUNC(set_config_value) 2281 FUNC(set_file_attributes) 2282 FUNC(get_meminfo) 2283 FUNC(file_browser) 2284 FUNC(draw_pixel) 2285 FUNC(draw_line) 2286 FUNC(draw_rect) 2287 FUNC(draw_rect_filled) 2288 FUNC(draw_ellipse) 2289 FUNC(draw_ellipse_filled) 2290 FUNC(draw_clear) 2291 FUNC(draw_string) 2292 FUNC(set_yield) 2293 #ifdef CAM_CHDK_PTP 2294 FUNC(read_usb_msg) 2295 FUNC(write_usb_msg) 2296 #endif 2297 {NULL, NULL}, 2298 }; 2299 2023 2300 void register_lua_funcs( lua_State* L ) 2024 2301 { 2025 #define FUNC( X ) \ 2026 lua_pushcfunction( L, luaCB_##X ); \ 2027 lua_setglobal( L, #X ) 2028 2029 FUNC(shoot); 2030 FUNC(sleep); 2031 FUNC(cls); 2032 FUNC(set_console_layout); 2033 FUNC(set_console_autoredraw); 2034 FUNC(console_redraw); 2035 2302 const luaL_reg *r; 2036 2303 lua_pushlightuserdata( L, action_push_click ); 2037 2304 lua_pushcclosure( L, luaCB_keyfunc, 1 ); … … 2046 2313 lua_setglobal( L, "release" ); 2047 2314 2048 FUNC(get_av96); 2049 FUNC(get_av96); 2050 FUNC(get_bv96); 2051 FUNC(get_day_seconds); 2052 FUNC(get_disk_size); 2053 FUNC(get_dofinfo); 2054 FUNC(get_free_disk_space); 2055 FUNC(get_focus); 2056 FUNC(get_iso_market); 2057 FUNC(get_iso_mode); 2058 FUNC(get_iso_real); 2059 FUNC(get_jpg_count); 2060 FUNC(get_prop); 2061 FUNC(get_prop_str); 2062 FUNC(get_raw_count); 2063 FUNC(get_raw_nr); 2064 FUNC(get_raw); 2065 FUNC(get_sv96); 2066 FUNC(get_tick_count); 2067 FUNC(get_tv96); 2068 FUNC(get_user_av_id); 2069 FUNC(get_user_av96); 2070 FUNC(get_user_tv_id); 2071 FUNC(get_user_tv96); 2072 FUNC(get_vbatt); 2073 FUNC(get_zoom); 2074 FUNC(get_exp_count); 2075 FUNC(get_flash_params_count); 2076 FUNC(get_parameter_data); 2077 2078 FUNC(set_av96_direct); 2079 FUNC(set_av96); 2080 FUNC(set_focus); 2081 FUNC(set_iso_mode); 2082 FUNC(set_iso_real); 2083 FUNC(set_led); 2084 FUNC(set_nd_filter); 2085 FUNC(set_prop); 2086 FUNC(set_prop_str); 2087 FUNC(set_raw_nr); 2088 FUNC(set_raw); 2089 FUNC(set_sv96); 2090 FUNC(set_tv96_direct); 2091 FUNC(set_tv96); 2092 FUNC(set_user_av_by_id_rel); 2093 FUNC(set_user_av_by_id); 2094 FUNC(set_user_av96); 2095 FUNC(set_user_tv_by_id_rel); 2096 FUNC(set_user_tv_by_id); 2097 FUNC(set_user_tv96); 2098 FUNC(set_zoom_speed); 2099 FUNC(set_zoom_rel); 2100 FUNC(set_zoom); 2101 2102 FUNC(wait_click); 2103 FUNC(is_pressed); 2104 FUNC(is_key); 2105 #ifdef CAM_HAS_JOGDIAL 2106 FUNC(wheel_right); 2107 FUNC(wheel_left); 2108 #endif 2109 FUNC(md_get_cell_diff); 2110 FUNC(md_detect_motion); 2111 FUNC(autostarted); 2112 FUNC(get_autostart); 2113 FUNC(set_autostart); 2114 FUNC(get_usb_power); 2115 FUNC(enter_alt); 2116 FUNC(exit_alt); 2117 FUNC(shut_down); 2118 FUNC(print_screen); 2119 2120 #ifdef CAM_MULTIPART 2121 FUNC(get_partitionInfo); 2122 FUNC(swap_partitions); 2123 #endif 2124 2125 FUNC(get_focus_mode); 2126 FUNC(get_focus_state); 2127 FUNC(get_focus_ok); 2128 FUNC(get_propset); 2129 FUNC(get_zoom_steps); 2130 FUNC(get_drive_mode); 2131 FUNC(get_flash_mode); 2132 FUNC(get_shooting); 2133 FUNC(get_flash_ready); 2134 FUNC(get_IS_mode); 2135 FUNC(set_ev); 2136 FUNC(get_ev); 2137 FUNC(get_orientation_sensor); 2138 FUNC(get_nd_present); 2139 FUNC(get_movie_status); 2140 FUNC(set_movie_status); 2141 2142 FUNC(get_histo_range); 2143 FUNC(shot_histo_enable); 2144 FUNC(play_sound); 2145 FUNC(get_temperature); 2146 FUNC(peek); 2147 FUNC(poke); 2148 FUNC(bitand); 2149 FUNC(bitor); 2150 FUNC(bitxor); 2151 FUNC(bitshl); 2152 FUNC(bitshri); 2153 FUNC(bitshru); 2154 FUNC(bitnot); 2155 2156 FUNC(get_time); 2157 2158 FUNC(get_buildinfo); 2159 FUNC(get_mode); 2160 2161 FUNC(set_raw_develop); 2162 // NOTE these functions normally run in the spytask. 2163 // called from lua they will run from kbd task instead 2164 FUNC(raw_merge_start); 2165 FUNC(raw_merge_add_file); 2166 FUNC(raw_merge_end); 2167 FUNC(set_backlight); 2168 FUNC(set_aflock); 2169 #ifdef OPT_CURVES 2170 FUNC(set_curve_state); 2171 FUNC(get_curve_state); 2172 FUNC(set_curve_file); 2173 FUNC(get_curve_file); 2174 #endif 2175 // get levent definition by name or id, nil if not found 2176 FUNC(get_levent_def); 2177 // get levent definition by index, nil if out of range 2178 FUNC(get_levent_def_by_index); 2179 // get levent index from name or ID 2180 FUNC(get_levent_index); 2181 FUNC(post_levent_to_ui); 2182 FUNC(post_levent_for_npt); 2183 FUNC(set_levent_active); 2184 FUNC(set_levent_script_mode); 2185 2186 FUNC(set_capture_mode); 2187 FUNC(set_capture_mode_canon); 2188 FUNC(is_capture_mode_valid); 2189 2190 FUNC(set_record); 2191 2192 FUNC(switch_mode_usb); 2193 2194 #ifdef OPT_LUA_CALL_NATIVE 2195 FUNC(call_event_proc); 2196 FUNC(call_func_ptr); 2197 #endif 2198 FUNC(reboot); 2199 FUNC(get_config_value); 2200 FUNC(set_config_value); 2201 FUNC(set_file_attributes); 2202 FUNC(file_browser); 2203 FUNC(draw_pixel); 2204 FUNC(draw_line); 2205 FUNC(draw_rect); 2206 FUNC(draw_rect_filled); 2207 FUNC(draw_ellipse); 2208 FUNC(draw_ellipse_filled); 2209 FUNC(draw_clear); 2210 FUNC(draw_string); 2211 FUNC(set_yield); 2315 for(r=chdk_funcs;r->name;r++) { 2316 lua_pushcfunction( L, r->func ); 2317 lua_setglobal( L, r->name ); 2318 } 2212 2319 #ifdef CAM_CHDK_PTP 2213 FUNC(read_usb_msg);2214 FUNC(write_usb_msg);2215 2320 luaL_dostring(L,"function usb_msg_table_to_string(t)" 2216 2321 " local v2s=function(v)" … … 2236 2341 2237 2342 #endif 2238 2239 } 2343 } -
trunk/core/main.c
r932 r948 59 59 // to try allocating memory to find out how much is available 60 60 // Call function to scan free list for the largest free block available. 61 extern int exmem_largest_block(); 62 return exmem_largest_block(); 61 cam_meminfo camera_meminfo; 62 GetExMemInfo(&camera_meminfo); 63 return camera_meminfo.free_block_max_size; 64 #elif defined(CAM_FIRMWARE_MEMINFO) 65 // Call firmware function to fill memory info structure and return size of largest free block 66 cam_meminfo camera_meminfo; 67 GetMemInfo(&camera_meminfo); 68 return camera_meminfo.free_block_max_size; 63 69 #else 64 70 int size, l_size, d; -
trunk/core/suba.c
r614 r948 86 86 #define SUBA_MAGIC "\xFF\x15\x15\x15SUBA" 87 87 88 int suba_largest_block(struct allocator *suba) 89 { 90 size_t sz = 0; 88 void suba_getmeminfo(struct allocator *suba, int *allocated_size, int *allocated_peak, int *allocated_count, int *free_size, int *largest_block, int *free_block_count) 89 { 90 size_t largest = 0; 91 size_t free = 0; 92 size_t count = 0; 91 93 92 94 if (suba) 93 95 { 94 96 struct cell *c = SADR(suba, suba->tail); 95 if (c->size > sz) sz = c->size; 97 if (c->size > largest) largest = c->size; 98 free += c->size; 99 count++; 96 100 while (c->next != suba->tail) 97 101 { 98 102 c = SADR(suba, c->next); 99 if (c->size > sz) sz = c->size; 100 } 101 } 102 103 return sz; 103 if (c->size > largest) largest = c->size; 104 free += c->size; 105 count++; 106 } 107 } 108 109 *largest_block = largest; 110 *free_size = free; 111 *free_block_count = count; 112 *allocated_size = suba->size_total; // TODO check this is a reasonable value for this field 113 *allocated_peak = suba->alloc_total; // TODO check this is a reasonable value for this field 114 *allocated_count = 0; // TODO implement this 104 115 } 105 116 -
trunk/include/camera.h
r933 r948 161 161 #undef PARAM_DISPLAY_MODE1 // param number for LCD display mode when camera in playback 162 162 #undef PARAM_DISPLAY_MODE2 // param number for LCD display mode when camera in record view hold mode 163 164 #undef CAM_DRIVE_MODE_FROM_TIMER_MODE // use PROPCASE_TIMER_MODE to check for multiple shot custom timer. 163 #undef CAM_FIRMWARE_MEMINFO // Use 'GetMemInfo' (dryos) or 'memPartInfoGet'/'memPartFindMax' (vxworks) 164 // function in firmware to get free memory details 165 // GetMemInfo should be found correctly by the gensig/finsig signature 166 // finder for all dryos based cameras. 167 168 #undef CAM_NO_MEMPARTINFO // VXWORKS camera does not have memPartInfoGet, fall back to memPartFindMax 169 170 #undef CAM_DRIVE_MODE_FROM_TIMER_MODE // use PROPCASE_TIMER_MODE to check for multiple shot custom timer. 165 171 // Used to enabled bracketing in custom timer, required on many recent cameras 166 172 // see http://chdk.setepontos.com/index.php/topic,3994.405.html … … 184 190 #undef CAM_NEED_SET_ZOOM_DELAY // Define to add a delay after setting the zoom position before resetting the focus position in shooting_set_zoom 185 191 186 #undef USE_REAL_AUTOISO// Define this to use real-iso instead of marketing-iso as values of autoiso mechanizm187 #undef OVEREXP_COMPENSATE_OVERALL// Define this to make overexposure_compensation work for all scenes, instead of day-light only192 #undef USE_REAL_AUTOISO // Define this to use real-iso instead of marketing-iso as values of autoiso mechanizm 193 #undef OVEREXP_COMPENSATE_OVERALL // Define this to make overexposure_compensation work for all scenes, instead of day-light only 188 194 189 195 #define CAMERA_MIN_DIST 0 // Define min distance that can be set in _MoveFocusLensToDistance (allow override - e.g. G12 min dist = 1) … … 200 206 // END of Camera-dependent settings 201 207 //========================================================== 208 209 // For newer cameras where the screen bitmap is double the width we need to scale 210 // the CHDK horizontal (X) co-ordinates 211 #if CAM_USES_ASPECT_CORRECTION 212 #define ASPECT_XCORRECTION(x) ((x)<<1) // See comments for CAM_USES_ASPECT_CORRECTION above 213 #else 214 #define ASPECT_XCORRECTION(x) (x) // See comments for CAM_USES_ASPECT_CORRECTION above 215 #endif 202 216 203 217 // curves only work in 10bpp for now … … 210 224 #endif 211 225 212 // For newer cameras where the screen bitmap is double the width we need to scale213 // the CHDK horizontal (X) co-ordinates214 #if CAM_USES_ASPECT_CORRECTION215 #define ASPECT_XCORRECTION(x) ((x)<<1) // See comments for CAM_USES_ASPECT_CORRECTION above216 #else217 #define ASPECT_XCORRECTION(x) (x) // See comments for CAM_USES_ASPECT_CORRECTION above218 #endif219 220 226 #endif /* CAMERA_H */ -
trunk/include/lolevel.h
r942 r948 302 302 #endif 303 303 304 // vxworks only 305 // used on a few cameras that don't have memPartInfoGet, see CAM_NO_MEMPARTINFO 306 extern int _memPartFindMax(int mempart_id); 307 extern int _memPartInfoGet(int mempart_id,int *info); 308 309 // helpful for Eye-Fi cards 304 310 extern void _SetFileAttributes(int fd, int attr); 305 311 -
trunk/include/platform.h
r933 r948 584 584 void ExitTask(); 585 585 586 // Data returned from GetMemInfo & GetExMemInfo functions stored in this data structure 587 typedef struct { 588 int start_address; 589 int end_address; 590 int total_size; 591 int allocated_size; 592 int allocated_peak; 593 int allocated_count; 594 int free_size; 595 int free_block_max_size; 596 int free_block_count; 597 } cam_meminfo; 598 599 #if defined(CAM_FIRMWARE_MEMINFO) 600 extern void GetMemInfo(cam_meminfo*); 601 #endif 602 586 603 #ifdef OPT_EXMEM_MALLOC 587 604 void exmem_malloc_init(void); 605 void GetExMemInfo(cam_meminfo*); 588 606 #endif 589 607 -
trunk/platform/a1100/platform_camera.h
r945 r948 83 83 #define CAM_ZEBRA_ASPECT_ADJUST 1 84 84 85 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 85 86 //---------------------------------------------------------- 86 87 -
trunk/platform/a540/platform_camera.h
r920 r948 55 55 56 56 #define CAM_EXT_TV_RANGE 1 57 58 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 57 59 //---------------------------------------------------------- -
trunk/platform/a590/platform_camera.h
r933 r948 57 57 #define CAM_MULTIPART 1 58 58 #define CAM_STARTUP_CRASH_FILE_OPEN_FIX 1 // enable fix for camera crash at startup when opening the conf / font files see http://chdk.setepontos.com/index.php?topic=6179.0 59 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 60 59 61 #undef CAMERA_MIN_DIST 60 62 #define CAMERA_MIN_DIST 100 // Override min subject distance -
trunk/platform/d10/platform_camera.h
r920 r948 93 93 // Used to enabled bracketing in custom timer, required on many recent cameras 94 94 // see http://chdk.setepontos.com/index.php/topic,3994.405.html 95 96 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 95 97 //---------------------------------------------------------- -
trunk/platform/g10/platform_camera.h
r920 r948 102 102 // see http://chdk.setepontos.com/index.php/topic,3994.405.html 103 103 104 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 104 105 //---------------------------------------------------------- 105 106 -
trunk/platform/g12/platform_camera.h
r933 r948 104 104 #define CAM_STARTUP_CRASH_FILE_OPEN_FIX 1 // enable fix for camera crash at startup when opening the conf / font files see http://chdk.setepontos.com/index.php?topic=6179.0 105 105 106 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 107 106 108 #define CAM_DRIVE_MODE_FROM_TIMER_MODE 1 // use PROPCASE_TIMER_MODE to check for multiple shot custom timer. 107 109 // Used to enabled bracketing in custom timer, required on many recent cameras -
trunk/platform/generic/wrappers.c
r942 r948 680 680 // round MEMISOSIZE up to next 4 byte boundary if needed (just in case) 681 681 exmem_start = mem + ((MEMISOSIZE+3)&0xFFFFFFFC); 682 exmem_size = EXMEM_ HEAP_SIZE - EXMEM_HEAP_SKIP- ((MEMISOSIZE+3)&0xFFFFFFFC);682 exmem_size = EXMEM_BUFFER_SIZE - ((MEMISOSIZE+3)&0xFFFFFFFC); 683 683 #else 684 684 // Set start & size based on requested values 685 685 exmem_start = mem; 686 exmem_size = EXMEM_ HEAP_SIZE - EXMEM_HEAP_SKIP;686 exmem_size = EXMEM_BUFFER_SIZE; 687 687 #endif 688 688 exmem_end = exmem_start + exmem_size; … … 717 717 } 718 718 719 int exmem_largest_block() 720 { 721 extern int suba_largest_block(void*); 722 return suba_largest_block(exmem_heap); 719 // Use suba functions to fill meminfo structure to match firmware GetMemInfo function 720 721 void GetExMemInfo(cam_meminfo *camera_meminfo) 722 { 723 extern void suba_getmeminfo(void*, int*, int*, int*, int*, int*, int*); 724 725 camera_meminfo->start_address = (int)exmem_start; 726 camera_meminfo->end_address = (int)exmem_start + exmem_size; 727 camera_meminfo->total_size = exmem_size; 728 suba_getmeminfo(exmem_heap, 729 &camera_meminfo->allocated_size, &camera_meminfo->allocated_peak, &camera_meminfo->allocated_count, 730 &camera_meminfo->free_size, &camera_meminfo->free_block_max_size, &camera_meminfo->free_block_count); 723 731 } 724 732 // regular malloc … … 765 773 #endif 766 774 } 775 776 #if defined(CAM_FIRMWARE_MEMINFO) 777 778 // Use firmware GetMemInfo function to retrieve info about Canon heap memory allocation 779 780 void GetMemInfo(cam_meminfo *camera_meminfo) 781 { 782 #if defined(CAM_DRYOS) 783 // Prior to dryos R39 GetMemInfo returns 9 values, after R39 it returns 10 (all but 1 are used in each case) 784 int fw_info[10]; 785 extern void _GetMemInfo(int*); 786 _GetMemInfo(fw_info); 787 788 #if defined(CAM_DRYOS_2_3_R39) 789 // For newer dryos version copy all 9 used values to CHDK structure 790 camera_meminfo->start_address = fw_info[0]; 791 camera_meminfo->end_address = fw_info[1]; 792 camera_meminfo->total_size = fw_info[2]; 793 camera_meminfo->allocated_size = fw_info[3]; 794 camera_meminfo->allocated_peak = fw_info[4]; 795 camera_meminfo->allocated_count = fw_info[5]; 796 camera_meminfo->free_size = fw_info[6]; 797 camera_meminfo->free_block_max_size = fw_info[7]; 798 camera_meminfo->free_block_count = fw_info[8]; 799 #else 800 // For older dryos version copy 8 used values to CHDK structure and calculate missing value 801 camera_meminfo->start_address = fw_info[0]; 802 camera_meminfo->end_address = fw_info[0] + fw_info[1]; 803 camera_meminfo->total_size = fw_info[1]; 804 camera_meminfo->allocated_size = fw_info[2]; 805 camera_meminfo->allocated_peak = fw_info[3]; 806 camera_meminfo->allocated_count = fw_info[4]; 807 camera_meminfo->free_size = fw_info[5]; 808 camera_meminfo->free_block_max_size = fw_info[6]; 809 camera_meminfo->free_block_count = fw_info[7]; 810 #endif 811 #else // vxworks 812 extern int sys_mempart_id; 813 int fw_info[5]; 814 // -1 for invalid 815 memset(camera_meminfo,0xFF,sizeof(cam_meminfo)); 816 #ifdef CAM_NO_MEMPARTINFO 817 camera_meminfo->free_block_max_size = _memPartFindMax(sys_mempart_id); 818 #else 819 _memPartInfoGet(sys_mempart_id,fw_info); 820 // TODO we could fill in start address from _start + MEMISOSIZE, if chdk not in exmem 821 // these are guessed, look reasonable on a540 822 camera_meminfo->free_size = fw_info[0]; 823 camera_meminfo->free_block_count = fw_info[1]; 824 camera_meminfo->free_block_max_size = fw_info[2]; 825 camera_meminfo->allocated_size = fw_info[3]; 826 camera_meminfo->allocated_count = fw_info[4]; 827 #endif 828 #endif 829 } 830 831 #endif 767 832 768 833 //---------------------------------------------------------------------------- -
trunk/platform/ixus310_elph500hs/platform_camera.h
r933 r948 119 119 // see http://chdk.setepontos.com/index.php?topic=6179.0 120 120 121 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 122 121 123 #define CAM_DRIVE_MODE_FROM_TIMER_MODE // use PROPCASE_TIMER_MODE to check for multiple shot custom timer. 122 124 // Used to enabled bracketing in custom timer, required on many recent cameras -
trunk/platform/ixus40_sd300/platform_camera.h
r859 r948 54 54 // camera name 55 55 #define PARAM_CAMERA_NAME 2 // parameter number for GetParameterData 56 #define CAM_NO_MEMPARTINFO 1 // vxworks function missing 56 57 //---------------------------------------------------------- 57 58 -
trunk/platform/s95/platform_camera.h
r920 r948 83 83 // see http://chdk.setepontos.com/index.php?topic=6179.0 84 84 85 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 86 85 87 // todo - we may need this to save memory 86 88 //#define CAM_ZEBRA_NOBUF 1 -
trunk/platform/sx20/platform_camera.h
r943 r948 91 91 #define CAM_STARTUP_CRASH_FILE_OPEN_FIX 1 // enable fix for camera crash at startup when opening the conf / font files see http://chdk.setepontos.com/index.php?topic=6179.0 92 92 93 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 94 93 95 #define CAM_DRIVE_MODE_FROM_TIMER_MODE 1 // use PROPCASE_TIMER_MODE to check for multiple shot custom timer. 94 96 // Used to enabled bracketing in custom timer, required on many recent cameras -
trunk/platform/sx30/platform_camera.h
r933 r948 108 108 // see http://chdk.setepontos.com/index.php/topic,3994.405.html 109 109 110 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 111 110 112 #define CAM_AV_OVERRIDE_IRIS_FIX 1 // for cameras that require _MoveIrisWithAv function to override Av. 111 113 -
trunk/platform/sx40hs/platform_camera.h
r933 r948 111 111 // see http://chdk.setepontos.com/index.php/topic,3994.405.html 112 112 113 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 114 113 115 #define CAM_AV_OVERRIDE_IRIS_FIX 1 // for cameras that require _MoveIrisWithAv function to override Av in bracketing. 114 116
Note: See TracChangeset
for help on using the changeset viewer.