Changeset 1175
- Timestamp:
- 05/07/11 06:11:49 (2 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
core/main.c (modified) (1 diff)
-
core/suba.c (modified) (1 diff)
-
include/camera.h (modified) (1 diff)
-
include/platform.h (modified) (1 diff)
-
platform/d10/platform_camera.h (modified) (1 diff)
-
platform/g12/platform_camera.h (modified) (1 diff)
-
platform/generic/wrappers.c (modified) (3 diffs)
-
platform/sx30/platform_camera.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/main.c
r1124 r1175 55 55 // to try allocating memory to find out how much is available 56 56 // Call function to scan free list for the largest free block available. 57 extern int exmem_largest_block(); 58 return exmem_largest_block(); 57 cam_meminfo camera_meminfo; 58 GetExMemInfo(&camera_meminfo); 59 return camera_meminfo.free_block_max_size; 60 #elif defined(CAM_FIRMWARE_MEMINFO) 61 // Call firmware function to fill memory info structure and return size of largest free block 62 cam_meminfo camera_meminfo; 63 GetMemInfo(&camera_meminfo); 64 return camera_meminfo.free_block_max_size; 59 65 #else 60 66 int size, l_size, d; -
trunk/core/suba.c
r1124 r1175 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
r1140 r1175 146 146 #undef PARAM_CAMERA_NAME // parameter number for GetParameterData to get camera name 147 147 148 149 #undef CAM_FIRMWARE_MEMINFO // Use 'GetMemInfo' function in firmware to get free memory details 150 // GetMemInfo should be found correctly by the gensig/finsig signature 151 // finder for all dryos based cameras. 152 148 153 //---------------------------------------------------------- 149 154 // Override Default values for Camera if necessary -
trunk/include/platform.h
r1101 r1175 560 560 void ExitTask(); 561 561 562 // Data returned from GetMemInfo & GetExMemInfo functions stored in this data structure 563 typedef struct { 564 int start_address; 565 int end_address; 566 int total_size; 567 int allocated_size; 568 int allocated_peak; 569 int allocated_count; 570 int free_size; 571 int free_block_max_size; 572 int free_block_count; 573 } cam_meminfo; 574 575 #if defined(CAM_FIRMWARE_MEMINFO) 576 extern void GetMemInfo(cam_meminfo*); 577 #endif 578 562 579 #ifdef OPT_EXMEM_MALLOC 563 580 void exmem_malloc_init(void); 581 void GetExMemInfo(cam_meminfo*); 564 582 #endif 565 583 -
trunk/platform/d10/platform_camera.h
r1140 r1175 131 131 #define CAM_CHDK_PTP 1 // include CHDK PTP support 132 132 133 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 134 133 135 //---------------------------------------------------------- 134 135 136 //==========================================================137 // SD-Series (IXUS-Series)138 //========================================================== -
trunk/platform/g12/platform_camera.h
r1148 r1175 110 110 // see http://chdk.setepontos.com/index.php?topic=6179.0 111 111 112 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 113 112 114 //---------------------------------------------------------- 113 115 -
trunk/platform/generic/wrappers.c
r1160 r1175 700 700 // round MEMISOSIZE up to next 4 byte boundary if needed (just in case) 701 701 exmem_start = mem + ((MEMISOSIZE+3)&0xFFFFFFFC); 702 exmem_size = EXMEM_ HEAP_SIZE - EXMEM_HEAP_SKIP- ((MEMISOSIZE+3)&0xFFFFFFFC);702 exmem_size = EXMEM_BUFFER_SIZE - ((MEMISOSIZE+3)&0xFFFFFFFC); 703 703 #else 704 704 // Set start & size based on requested values 705 705 exmem_start = mem; 706 exmem_size = EXMEM_ HEAP_SIZE - EXMEM_HEAP_SKIP;706 exmem_size = EXMEM_BUFFER_SIZE; 707 707 #endif 708 708 exmem_end = exmem_start + exmem_size; … … 737 737 } 738 738 739 int exmem_largest_block() 740 { 741 extern int suba_largest_block(void*); 742 return suba_largest_block(exmem_heap); 739 // Use suba functions to fill meminfo structure to match firmware GetMemInfo function 740 741 void GetExMemInfo(cam_meminfo *camera_meminfo) 742 { 743 extern void suba_getmeminfo(void*, int*, int*, int*, int*, int*, int*); 744 745 camera_meminfo->start_address = (int)exmem_start; 746 camera_meminfo->end_address = (int)exmem_start + exmem_size; 747 camera_meminfo->total_size = exmem_size; 748 suba_getmeminfo(exmem_heap, 749 &camera_meminfo->allocated_size, &camera_meminfo->allocated_peak, &camera_meminfo->allocated_count, 750 &camera_meminfo->free_size, &camera_meminfo->free_block_max_size, &camera_meminfo->free_block_count); 743 751 } 744 752 // regular malloc … … 785 793 #endif 786 794 } 795 796 #if defined(CAM_FIRMWARE_MEMINFO) 797 798 // Use firmware GetMemInfo function to retrieve info about Canon heap memory allocation 799 800 void GetMemInfo(cam_meminfo *camera_meminfo) 801 { 802 // Prior to dryos R39 GetMemInfo returns 9 values, after R39 it returns 10 (all but 1 are used in each case) 803 int fw_info[10]; 804 extern void _GetMemInfo(int*); 805 _GetMemInfo(fw_info); 806 807 #if defined(CAM_DRYOS_2_3_R39) 808 // For newer dryos version copy all 9 used values to CHDK structure 809 camera_meminfo->start_address = fw_info[0]; 810 camera_meminfo->end_address = fw_info[1]; 811 camera_meminfo->total_size = fw_info[2]; 812 camera_meminfo->allocated_size = fw_info[3]; 813 camera_meminfo->allocated_peak = fw_info[4]; 814 camera_meminfo->allocated_count = fw_info[5]; 815 camera_meminfo->free_size = fw_info[6]; 816 camera_meminfo->free_block_max_size = fw_info[7]; 817 camera_meminfo->free_block_count = fw_info[8]; 818 #else 819 // For older dryos version copy 8 used values to CHDK structure and calculate missing value 820 camera_meminfo->start_address = fw_info[0]; 821 camera_meminfo->end_address = fw_info[0] + fw_info[1]; 822 camera_meminfo->total_size = fw_info[1]; 823 camera_meminfo->allocated_size = fw_info[2]; 824 camera_meminfo->allocated_peak = fw_info[3]; 825 camera_meminfo->allocated_count = fw_info[4]; 826 camera_meminfo->free_size = fw_info[5]; 827 camera_meminfo->free_block_max_size = fw_info[6]; 828 camera_meminfo->free_block_count = fw_info[7]; 829 #endif 830 } 831 832 #endif 787 833 788 834 //---------------------------------------------------------------------------- -
trunk/platform/sx30/platform_camera.h
r1140 r1175 104 104 105 105 #define CAM_KEY_CLICK_DELAY 150 // SX30 appears to need extra delay for clicks 106 107 #define CAM_FIRMWARE_MEMINFO 1 // Use 'GetMemInfo' to get free memory size. 108 106 109 //----------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.