void mrc_dump_process() { /* generate instruction into uncacheable memory (else we would have to flush I and D caches) */ void *alloc_buf = malloc(32); void *func_buf = UNCACHEABLE(alloc_buf); unsigned int addr_func = (unsigned int)UNCACHEABLE(func_buf); unsigned int (*func)() = (unsigned int (*)())addr_func; /* build MRC instruction */ unsigned int instr = 0xEE100010; instr |= (mrc_op1<<21); instr |= (mrc_crn<<16); instr |= (0<<12); instr |= (mrc_cp<<8); instr |= (mrc_op2<<5); instr |= mrc_crm; /* write along with RET */ MEM(addr_func) = instr; MEM(addr_func + 4) = 0xE1A0F00E; /* call generated code */ mrc_value = func(); free(alloc_buf); }
static void script_parse_header(int script_index) { script_selected = script_index; // side effect (!) // clear params submenu (hide all unused stuff) script_reset_params(); // try to read the script static char _buf[1024+128]; char* buf = UNCACHEABLE(_buf)+64; char* fn = get_script_path(script_selected); int r = read_file(fn, buf, 1024); if (r < 0) { snprintf(script_titles[script_index], SCRIPT_TITLE_SIZE, "Error"); return; } buf[r+1] = 0; // get some default title guess_script_title_from_first_line(buf, script_titles[script_index], SCRIPT_TITLE_SIZE); // parse CHDK script header script_scan(fn, buf); // update submenu script_update_menu(); }
void save_log() { NotifyBox(1000, "%d ", strlen(log)); FILE* f = FIO_CreateFileEx(CARD_DRIVE"shoot.log"); FIO_WriteFile(f, UNCACHEABLE(log), strlen(log)); FIO_CloseFile(f); beep(); }
unsigned int lv_rec_save_block(FILE *save_file, lv_rec_save_data_t *save_data, unsigned int length, int skip_saving) { unsigned int written = 0; while(length > 0) { /* get next chunk in buffer */ if(!save_data->chunkData.chunkAvail) { lv_rec_next_chunk(&save_data->chunkData); } /* end of suite reached, wrap over */ if(!save_data->chunkData.chunkAvail) { save_data->chunkData.currentChunk = NULL; lv_rec_next_chunk(&save_data->chunkData); } /* this should not happen */ if(!save_data->chunkData.chunkAvail) { break; } unsigned int avail = MIN(save_data->chunkData.chunkAvail, length); if(!skip_saving) { FIO_WriteFile(save_file, UNCACHEABLE(&save_data->chunkData.chunkAddress[save_data->chunkData.chunkOffset]), avail); written += avail; } length -= avail; save_data->chunkData.chunkOffset += avail; save_data->chunkData.chunkAvail -= avail; } return written; }