Exemplo n.º 1
0
// Build a combined meminfo from available heaps
// free block max size is the single largest free block
// other fields are total, or zero where it doesn't make sense to combine
void GetCombinedMemInfo(cam_meminfo *camera_meminfo)
{
    // get system meminfo, should always be available
    GetMemInfo(camera_meminfo);
// some fields are set to -1 for vxworks cams
#if !defined(CAM_DRYOS)
    camera_meminfo->allocated_peak = 0;
    camera_meminfo->total_size = 0;
#ifdef CAM_NO_MEMPARTINFO
    // a more useful base value than 0
    camera_meminfo->free_size = camera_meminfo->free_block_max_size;
    camera_meminfo->free_block_count = 0;
    camera_meminfo->allocated_size = 0;
    camera_meminfo->allocated_count = 0;
#endif
#endif

    // these don't make sense to combine
    camera_meminfo->start_address = camera_meminfo->end_address = 0;

    cam_meminfo m;
    if(GetARamInfo(&m)) {
        combine_meminfo(camera_meminfo,&m);
    }
    if(GetExMemInfo(&m)) {
        combine_meminfo(camera_meminfo,&m);
    }
}
Exemplo n.º 2
0
void gui_module_draw()
{
    int idx, showidx;

    if (modinspect_redraw) {

    	draw_filled_rect(0, 0, camera_screen.width-1, camera_screen.height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR));
        draw_txt_string(5, 0,  "*** Module Inspector ***", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
        draw_txt_string(0, 2,  "Idx Name         Addr       Size", MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

		showidx=0;
		for ( idx=0; idx<20; idx++)
		{
			struct flat_hdr* flat = module_get_adr(idx);
			if (flat==0) continue;

			char namebuf[12];
			memcpy(namebuf,flat->modulename,11);
			namebuf[11]=0;

			char txt[50];
		    sprintf(txt,"%02d: %-12s %08x - %d bytes", idx, namebuf, (unsigned)flat, flat->reloc_start);
        	draw_txt_string(0, 3+showidx,  txt,       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));
			showidx++;
		}

//    sprintf(buf, lang_str(LANG_MSG_MEMORY_INFO_TEXT), core_get_free_memory(), MEMISOSIZE, &_start, &_end);
//		sprintf(buf,"MEM     %08x-%08x - %d free",&_start, &_end,core_get_free_memory());
//		sprintf(buf,"--- %-12s %08x - %d","CHDK",&_start, MEMISOSIZE );

        draw_txt_string(1, 4+showidx,  "SET-redraw, DISP-unload_all, MENU-exit",       MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE));

    	cam_meminfo meminfo;

        // Display Canon heap memory info
        // amount of data displayed may vary depending on GetMemInfo implementation
        memset(&meminfo,0,sizeof(meminfo));
        GetMemInfo(&meminfo);
        gui_mem_info("MEM", &meminfo, showidx);
        showidx += 3;

        // Display EXMEM memory info (only if enabled)
        memset(&meminfo,0,sizeof(meminfo));
        if (GetExMemInfo(&meminfo))
        {
            gui_mem_info("EXMEM", &meminfo, showidx);
		}
	}

	modinspect_redraw = 0;
}
Exemplo n.º 3
0
int core_get_free_memory()
{
    cam_meminfo camera_meminfo;

#if defined(OPT_EXMEM_MALLOC) && !defined(OPT_EXMEM_TESTING)
    // If using the exmem / suba memory allocation system then don't need
    // to try allocating memory to find out how much is available
    // Call function to scan free list for the largest free block available.
    GetExMemInfo(&camera_meminfo);
#else
    // Call function to fill memory info structure and return size of largest free block
    // If implemented this will use firmware function, otherwise it will calculate largest
    // free block
    GetMemInfo(&camera_meminfo);
#endif

    return camera_meminfo.free_block_max_size;
}