void Call(){ printf("Call thread id %u \n", (unsigned int)pthread_self()); Global ++; INTERLEV_ACCESS(0,"cs1.Call","0"); cs2: Create(); Global ++; INTERLEV_ACCESS(0,"cs1.Call","0,1,2"); PAUSE("Create 0,1,2"); cs3: Join(); Global ++; INTERLEV_ACCESS(0,"cs1.Call","0"); PAUSE("Join 0,1,2"); cs6: Create(); Global ++; INTERLEV_ACCESS(0,"cs1.Call","0,3,4"); PAUSE("Create 0,3,4"); cs7: Join(); Global ++; INTERLEV_ACCESS(0,"cs1.Call","0"); PAUSE("Join 0,3,4"); }
static int dump_rom_2 (CalcHandle* handle, CalcDumpSize size, const char *filename) { int i, err = 0; static const uint16_t keys[] = { 0x40, 0x09, 0x09, /* Quit, Clear, Clear, */ 0xFE63, 0x97, 0xDA, /* Send(, 9, prgm */ 0xAB, 0xA8, 0xA6, 0x9D, /* R, O, M, D */ 0xAE, 0xA6, 0xA9, 0x05 /* U, M, P, Enter */ }; // Launch program by remote control for(i = 0; i < (int)(sizeof(keys) / sizeof(keys[0])); i++) { TRYF(send_key(handle, keys[i])); PAUSE(100); } do { handle->updat->refresh(); if (handle->updat->cancel) return ERR_ABORT; //send RDY request ??? PAUSE(1000); err = rd_is_ready(handle); } while (err == ERROR_READ_TIMEOUT); // Get dump TRYF(rd_dump(handle, filename)); return 0; }
static int dump_rom_2 (CalcHandle* handle, CalcDumpSize size, const char *filename) { #if 0 int i; static const uint16_t keys[] = { 0x40, 0x09, 0x09, 0xFC9C, /* Quit, Clear, Clear, Asm( */ 0xDA, 0xAB, 0xA8, 0xA6, /* prgm, R, O, M */ 0x9D, 0xAE, 0xA6, 0xA9, /* D, U, M, P */ 0x86 }; /* ) */ // Launch program by remote control PAUSE(200); for(i = 0; i < sizeof(keys) / sizeof(uint16_t); i++) { TRYF(send_key(handle, keys[i])); PAUSE(100); } // This fixes a 100% reproducible timeout: send_key normally requests a data ACK, // but when the program is running, no data ACK is sent. Therefore, hit the Enter // key without requesting a data ACK, only the initial delay ACK. TRYF(cmd_s_execute(handle, "", "", EID_KEY, NULL, 0x05)); TRYF(cmd_r_delay_ack(handle)); PAUSE(400); #endif #if 1 TRYF(cmd_s_execute(handle, NULL, "ROMDUMP", EID_PRGM, NULL, 0)); TRYF(cmd_r_data_ack(handle)); PAUSE(400); #endif // Get dump TRYF(rd_dump(handle, filename)); return 0; }
static int execute (CalcHandle* handle, VarEntry *ve, const char* args) { unsigned int i; // Go back to homescreen PAUSE(200); TRYF(send_key(handle, (KEY92P_CTRL + KEY92P_Q))); TRYF(send_key(handle, KEY92P_CLEAR)); TRYF(send_key(handle, KEY92P_CLEAR)); // Launch program by remote control for(i = 0; i < strlen(ve->folder); i++) TRYF(send_key(handle, (ve->folder)[i])); if(strcmp(ve->folder, "")) TRYF(send_key(handle, '\\')); for(i = 0; i < strlen(ve->name); i++) TRYF(send_key(handle, (ve->name)[i])); TRYF(send_key(handle, KEY92P_LP)); if(args) { for(i = 0; i < strlen(args); i++) TRYF(send_key(handle, args[i])); } TRYF(send_key(handle, KEY92P_RP)); TRYF(send_key(handle, KEY92P_ENTER)); PAUSE(200); return 0; }
void *foo1(void *x) { int *tid = x; printf("Call thread id %u \n", (unsigned int)pthread_self()); Global ++; INTERLEV_ACCESS(1,"cs1.foo1","0,1,3,4"); INTERLEV_ACCESS(3,"cs2.foo1","0,3,1,2"); PAUSE("foo1.before cs3"); cs3: pthread_create(&tt[*tid], NULL, foo2, NULL); PAUSE("foo1 after cs3"); Global ++; INTERLEV_ACCESS(1,"cs1.foo1","0,1,2,3,4"); INTERLEV_ACCESS(3,"cs2.foo1","0,3,4,1,2"); pthread_join(tt[*tid], NULL); PAUSE("foo1 after join 3"); Global ++; INTERLEV_ACCESS(1,"cs1.foo1","0,1,3,4"); INTERLEV_ACCESS(3,"cs2.foo1","0,3,1,2"); return x; }
static int execute (CalcHandle* handle, VarEntry *ve, const char* args) { unsigned int i; // Go back to homescreen PAUSE(200); TRYF(send_key(handle, KEY83_Quit)); TRYF(send_key(handle, KEY83_Clear)); TRYF(send_key(handle, KEY83_Clear)); // Launch program by remote control if(ve->type == TI83_ASM) { TRYF(send_key(handle, KEY83_SendMBL)); TRYF(send_key(handle, KEY83_9)); } TRYF(send_key(handle, KEY83_Exec)); for(i = 0; i < strlen(ve->name); i++) { const CalcKey *ck = ticalcs_keys_83((ve->name)[i]); TRYF(send_key(handle, ck->normal.value)); } TRYF(send_key(handle, KEY83_Enter)); PAUSE(200); return 0; }
static int dump_rom_2 (CalcHandle* handle, CalcDumpSize size, const char *filename) { int ret = 0; unsigned int i; if (handle->model == CALC_TI83) { static const uint16_t keys[] = { 0x40, 0x09, 0x09, /* Quit, Clear, Clear, */ 0xFE63, 0x97, 0xDA, /* Send(, 9, prgm */ 0xAB, 0xA8, 0xA6, 0x9D, /* R, O, M, D */ 0xAE, 0xA6, 0xA9, 0x05 /* U, M, P, Enter */ }; // Launch program by remote control for (i = 0; !ret && i < sizeof(keys) / sizeof(keys[0]); i++) { ret = send_key(handle, (uint32_t)(keys[i])); PAUSE(100); } } else if (handle->model == CALC_TI86) { static const uint16_t keys[] = { 0x76, 0x08, 0x08, /* Quit, Clear, Clear, */ 0x28, 0x3A, 0x34, 0x11, /* A, S, M, (, */ 0x39, 0x36, 0x34, 0x2B, /* R, O, M, D, */ 0x56, 0x4E, 0x51, 0x12, /* u, m, p, ), */ 0x06 /* Enter */ }; uint16_t dummy; // Launch program by remote control for (i = 0; !ret && i < (sizeof(keys) / sizeof(keys[0])) - 1; i++) { ret = send_key(handle, (uint32_t)(keys[i])); } if (!ret) { ret = SEND_KEY(handle, keys[i]); if (!ret) { ret = RECV_ACK(handle, &dummy); } PAUSE(200); } } if (!ret) { // Get dump ret = rd_dump(handle, filename); // TI-86: normally there would be another ACK after the program exits, but the ROM dumper disables that behaviour. } return ret; }
static int dump_rom_2 (CalcHandle* handle, CalcDumpSize size, const char *filename) { static const uint16_t keys_83p[] = { 0x40, 0x09, 0x09, 0xFC9C, /* Quit, Clear, Clear, Asm( */ 0xDA, 0xAB, 0xA8, 0xA6, /* prgm, R, O, M */ 0x9D, 0xAE, 0xA6, 0xA9, /* D, U, M, P */ 0x86, 0x05 }; /* ), Enter */ static const uint16_t keys_73[] = { 0x40, 0x09, 0x09, 0xDA, /* Quit, Clear, Clear, prgm */ 0xAB, 0xA8, 0xA6, 0x9D, /* R, O, M, D, */ 0xAE, 0xA6, 0xA9, 0x05 }; /* U, M, P, Enter */ int ret = 0; const uint16_t *keys; unsigned int i, nkeys; if (handle->model == CALC_TI73) { keys = keys_73; nkeys = sizeof(keys_73) / sizeof(keys_73[0]); } else { keys = keys_83p; nkeys = sizeof(keys_83p) / sizeof(keys_83p[0]); } // Launch program by remote control PAUSE(200); for (i = 0; !ret && i < nkeys - 1; i++) { ret = send_key(handle, (uint32_t)(keys[i])); PAUSE(100); } if (!ret) { // This fixes a 100% reproducible timeout: send_key normally requests an ACK, // but when the program is running, no ACK is sent. Therefore, hit the Enter key // without requesting an ACK. ret = SEND_KEY(handle, keys[i]); if (!ret) { ret = RECV_ACK(handle, NULL); // when the key is received if (!ret) { PAUSE(1000); // Get dump // (Normally there would be another ACK after the program exits, // but the ROM dumper disables that behavior) ret = rd_dump(handle, filename); } } } return ret; }
u32 wrapWaitSynchronizationN(u32 nanoseconds1,u32 handles_ptr,u32 handles_count,u32 wait_all,u32 nanoseconds2,u32 out) // TODO: timeouts { bool all_unlocked = true; for (u32 i = 0; i < handles_count; i++) { u32 handle = mem_Read32(handles_ptr + i * 4); handleinfo* hi = handle_Get(handle); if (hi == NULL) { arm11_SetR(1, i); ERROR("handle %08x not found.\n", handle); PAUSE(); #ifdef EXIT_ON_ERROR exit(1); #endif return -1; } if (hi->type >= NUM_HANDLE_TYPES) { // This should never happen. ERROR("handle %08x has non-defined type.\n", handle); PAUSE(); exit(1); } // Lookup actual callback in table. if (handle_types[hi->type].fnWaitSynchronization != NULL) { bool locked = false; handle_types[hi->type].fnWaitSynchronization(hi, &locked); if (!locked && !wait_all) { arm11_SetR(1, i); return 0; } else all_unlocked = false; } else { ERROR("WaitSynchronization undefined for handle-type \"%s\".\n", handle_types[hi->type].name); PAUSE(); arm11_SetR(1, i); //we just say this one is open return 0; } } if(wait_all && all_unlocked) { arm11_SetR(1, handles_count); return 0; } // Put thread in WAITING state if not all handles were unlocked. u32* wait_list = malloc(handles_count*4); mem_Read((u8 *) wait_list, handles_ptr, handles_count * 4); threads_SetCurrentThreadWaitList(wait_list, wait_all, handles_count); return 0; }
bool gosFX::CardCloud__Specification::IsDataValid(bool fix_data) { Check_Object(this); float max_offset, min_offset; float max_scale, min_scale; m_USize.ExpensiveComputeRange(&min_scale, &max_scale); float lower = min_scale; if(lower > 0.0f) lower = 0.0f; float upper = max_scale; // //------------------------------------ // Calculate the worst case UV offsets //------------------------------------ // m_VOffset.ExpensiveComputeRange(&min_offset, &max_offset); lower += min_offset; upper += max_offset; if(upper > 99.0f || lower < -99.0f) { if(fix_data) { m_VOffset.SetCurve(0.0f); PAUSE(("Warning: Curve \"VOffset\" in Effect \"%s\" Is Out of Range and has been Reset", (PSTR)m_name)); } else return false; } m_VSize.ExpensiveComputeRange(&min_scale, &max_scale); lower = min_scale; if(lower > 0.0f) lower = 0.0f; upper = max_scale; // //------------------------------------ // Calculate the worst case UV offsets //------------------------------------ // max_offset, min_offset; m_UOffset.ExpensiveComputeRange(&min_offset, &max_offset); lower += min_offset; upper += max_offset; if(upper > 99.0f || lower < -99.0f) { if(fix_data) { m_UOffset.SetCurve(0.0f); PAUSE(("Warning: Curve \"UOffset\" in Effect \"%s\" Is Out of Range and has been Reset", (PSTR)m_name)); } else return false; } return SpinningCloud__Specification::IsDataValid(fix_data); }
static int execute (CalcHandle* handle, VarEntry *ve, const char* args) { int ret; if (handle->model == CALC_TI73 && ve->type == TI73_ASM) { return ERR_VOID_FUNCTION; } // Go back to homescreen PAUSE(200); ret = send_key(handle, KEY83P_Quit); if (!ret) { ret = send_key(handle, KEY83P_Clear); if (!ret) { ret = send_key(handle, KEY83P_Clear); } } if (!ret) { // Launch program by remote control if (ve->type == TI83p_ASM) { ret = send_key(handle, KEY83P_Asm); } if (!ret) { ret = send_key(handle, KEY83P_Exec); if (!ret) { unsigned int i; for (i = 0; !ret && i < strlen(ve->name); i++) { const CalcKey *ck = ticalcs_keys_83p((ve->name)[i]); ret = send_key(handle, (uint32_t)(ck->normal.value)); } if (!ret) { ret = send_key(handle, KEY83P_Enter); PAUSE(200); } } } } return ret; }
static int execute (CalcHandle* handle, VarEntry *ve, const char* args) { int ret; // Go back to homescreen PAUSE(200); ret = send_key(handle, KEY83_Quit); if (!ret) { ret = send_key(handle, KEY83_Clear); if (!ret) { ret = send_key(handle, KEY83_Clear); } } if (!ret) { // Launch program by remote control if (ve->type == TI83_ASM) { ret = send_key(handle, KEY83_SendMBL); if (!ret) { ret = send_key(handle, KEY83_9); } } if (!ret) { ret = send_key(handle, KEY83_Exec); if (!ret) { unsigned int i; for (i = 0; !ret && i < strlen(ve->name); i++) { const CalcKey *ck = ticalcs_keys_83((ve->name)[i]); ret = send_key(handle, (uint32_t)(ck->normal.value)); } if (!ret) { ret = send_key(handle, KEY83_Enter); PAUSE(200); } } } } return ret; }
static int dump_rom_1 (CalcHandle* handle) { // Go back to homescreen PAUSE(200); TRYF(send_key(handle, (KEY92P_CTRL + KEY92P_Q))); TRYF(send_key(handle, KEY92P_CLEAR)); TRYF(send_key(handle, KEY92P_CLEAR)); PAUSE(200); // Send dumping program TRYF(rd_send(handle, "romdump.92p", romDumpSize92, romDump92)); PAUSE(1000); return 0; }
// 0xBB00: delay acknowledgement TIEXPORT3 int TICALL dusb_cmd_r_delay_ack(CalcHandle *handle) { DUSBVirtualPacket* pkt; int retval = 0; VALIDATE_HANDLE(handle); pkt = dusb_vtl_pkt_new_ex(handle, 0, 0, NULL); retval = dusb_recv_data(handle, pkt); if (!retval) { if (pkt->type == DUSB_VPKT_ERROR) { retval = ERR_CALC_ERROR2 + err_code_pkt(pkt); } else if (pkt->type != DUSB_VPKT_DELAY_ACK) { ticalcs_info("cmd_r_data_ack: expected type 0x%4X, received type 0x%4X", DUSB_VPKT_DELAY_ACK, pkt->type); retval = ERR_INVALID_PACKET; } } PAUSE(100); dusb_vtl_pkt_del(handle, pkt); return retval; }
static int dump_rom_2 (CalcHandle* handle, CalcDumpSize size, const char *filename) { int err; // Wait for user's action (execing program) sprintf(handle->updat->text, _("Waiting for execing of program...")); handle->updat->label(); do { handle->updat->refresh(); if (handle->updat->cancel) return ERR_ABORT; //send RDY request ??? PAUSE(1000); err = rd_is_ready(handle); } while (err == ERROR_READ_TIMEOUT); // Get dump TRYF(rd_dump(handle, filename)); return 0; }
//¶¯Ì¬ÏÔʾͼ±ê void VirtualWifiNotifyIcon::dynamic_show_icon() { HICON* iconarray=new HICON[m_notifyiconinfo->DynamicNums]; for (int i=0;i<m_notifyiconinfo->DynamicNums;++i) { iconarray[i]=LoadIcon(m_notifyiconinfo->DynamicShow[i]); } //CloseBallon(); for (;;) //ËÀÑ»· { for (int i=0;i<m_notifyiconinfo->DynamicNums;) { PAUSE(INT_DYNAMIC_SHOW_TIME); if (!m_isdynamic_show) { goto end; } if (!m_isshow) { SetIcon(iconarray[i]); ++i; } } } end: delete[] iconarray; SetIcon(LoadIcon(m_notifyiconinfo->NoStartPath)); }
void smp_send_broadcast_ici_interrupts_disabled(int32 currentCPU, int32 message, addr_t data, addr_t data2, addr_t data3, void *dataPointer, uint32 flags) { if (!sICIEnabled) return; TRACE(("smp_send_broadcast_ici_interrupts_disabled: cpu %ld mess 0x%lx, " "data 0x%lx, data2 0x%lx, data3 0x%lx, ptr %p, flags 0x%lx\n", currentCPU, message, data, data2, data3, dataPointer, flags)); struct smp_msg *msg; find_free_message_interrupts_disabled(currentCPU, &msg); msg->message = message; msg->data = data; msg->data2 = data2; msg->data3 = data3; msg->data_ptr = dataPointer; msg->ref_count = sNumCPUs - 1; msg->flags = flags; msg->proc_bitmap = SET_BIT(0, currentCPU); msg->done = false; TRACE(("smp_send_broadcast_ici_interrupts_disabled %ld: inserting msg %p " "into broadcast mbox\n", currentCPU, msg)); // stick it in the appropriate cpu's mailbox acquire_spinlock_nocheck(&sBroadcastMessageSpinlock); msg->next = sBroadcastMessages; sBroadcastMessages = msg; release_spinlock(&sBroadcastMessageSpinlock); arch_smp_send_broadcast_ici(); TRACE(("smp_send_broadcast_ici_interrupts_disabled %ld: sent interrupt\n", currentCPU)); if ((flags & SMP_MSG_FLAG_SYNC) != 0) { // wait for the other cpus to finish processing it // the interrupt handler will ref count it to <0 // if the message is sync after it has removed it from the mailbox TRACE(("smp_send_broadcast_ici_interrupts_disabled %ld: waiting for " "ack\n", currentCPU)); while (msg->done == false) { process_all_pending_ici(currentCPU); PAUSE(); } TRACE(("smp_send_broadcast_ici_interrupts_disabled %ld: returning " "message to free list\n", currentCPU)); // for SYNC messages, it's our responsibility to put it // back into the free list return_free_message(msg); } TRACE(("smp_send_broadcast_ici_interrupts_disabled: done\n")); }
// same code as calc_89.c static int dump_rom_2 (CalcHandle* handle, CalcDumpSize size, const char *filename) { // Launch program by remote control TRYF(send_key(handle, 'm')); TRYF(send_key(handle, 'a')); TRYF(send_key(handle, 'i')); TRYF(send_key(handle, 'n')); TRYF(send_key(handle, '\\')); TRYF(send_key(handle, 'r')); TRYF(send_key(handle, 'o')); TRYF(send_key(handle, 'm')); TRYF(send_key(handle, 'd')); TRYF(send_key(handle, 'u')); TRYF(send_key(handle, 'm')); TRYF(send_key(handle, 'p')); TRYF(send_key(handle, KEY92P_LP)); TRYF(send_key(handle, KEY92P_RP)); TRYF(send_key(handle, KEY92P_ENTER)); PAUSE(200); // Get dump TRYF(rd_dump(handle, filename)); return 0; }
/*! Finds a free message and gets it. NOTE: has side effect of disabling interrupts return value is the former interrupt state */ static cpu_status find_free_message(struct smp_msg** msg) { cpu_status state; TRACE(("find_free_message: entry\n")); retry: while (sFreeMessageCount <= 0) { state = disable_interrupts(); process_all_pending_ici(smp_get_current_cpu()); restore_interrupts(state); PAUSE(); } state = disable_interrupts(); acquire_spinlock(&sFreeMessageSpinlock); if (sFreeMessageCount <= 0) { // someone grabbed one while we were getting the lock, // go back to waiting for it release_spinlock(&sFreeMessageSpinlock); restore_interrupts(state); goto retry; } *msg = sFreeMessages; sFreeMessages = (*msg)->next; sFreeMessageCount--; release_spinlock(&sFreeMessageSpinlock); TRACE(("find_free_message: returning msg %p\n", *msg)); return state; }
int main(void) { void *context = zmq_ctx_new(); void *sink = zmq_socket(context, ZMQ_ROUTER); zmq_bind(sink, "inproc://example"); // First allow 0MQ to set the identity void *anonymous = zmq_socket(context, ZMQ_REQ); zmq_connect(anonymous, "inproc://example"); s_send(anonymous, "ROUTER uses a generated UUID"); s_dump(sink); // Then set the identity ourselves void *identified = zmq_socket(context, ZMQ_REQ); zmq_setsockopt(identified, ZMQ_IDENTITY, "PEER2", 5); zmq_connect(identified, "inproc://example"); s_send(identified, "ROUTER socket uses REQ's socket identity"); s_dump(sink); zmq_close(sink); zmq_close(anonymous); zmq_close(identified); zmq_ctx_destroy(context); PAUSE(); return 0; }
u32 services_SyncRequest(handleinfo* h, bool *locked) { u32 i; // Lookup which requested service in table. for(i=0; i<ARRAY_SIZE(services); i++) { if(services[i].subtype == h->subtype) return services[i].fnSyncRequest(); } if (h->subtype == SERVICE_DIRECT) { if (h->misc[0] & HANDLE_SERV_STAT_ACKING) { mem_Write(h->misc_ptr[0], arm11_ServiceBufferAddress() + 0x80, 0x200); h->misc[0] &= ~(HANDLE_SERV_STAT_ACKING | HANDLE_SERV_STAT_SYNCING); *locked = false; return 0; } else { if (!(h->misc[0] & HANDLE_SERV_STAT_SYNCING)) mem_Read(h->misc_ptr[0], arm11_ServiceBufferAddress() + 0x80, 0x200); h->misc[0] |= HANDLE_SERV_STAT_SYNCING; *locked = true; return 0; } } ERROR("invalid handle.\n"); arm11_Dump(); PAUSE(); return 0; }
//--------------------------------------------------------------------------- long Terrain::init (PacketFile* pakFile, int whichPacket, unsigned long visibleVertices, volatile float& percent, float percentRange ) { clearList(); clearMoverList(); long result = pakFile->seekPacket( whichPacket ); if (result != NO_ERR) STOP(("Unable to seek Packet %d in file %s",whichPacket,pakFile->getFilename())); int tmp = pakFile->getPacketSize(); realVerticesMapSide = sqrt( float(tmp/ sizeof(PostcompVertex))); if (!justResaveAllMaps && (realVerticesMapSide != 120) && (realVerticesMapSide != 100) && (realVerticesMapSide != 80) && (realVerticesMapSide != 60)) { PAUSE(("This map size NO longer supported %d. Must be 120, 100, 80 or 60 now! Can Continue, for NOW!!",realVerticesMapSide)); // return -1; } init( realVerticesMapSide, pakFile, visibleVertices, percent, percentRange ); return(NO_ERR); }
void AUTO_FLASH_FUNCTION() { int flag=1; char Option[10]; while(flag) { UI_TOP(Language); DISPLAY("AUTO_FLASH",Language); scanf("%s",Option); if ( strcmp(Option,"yes")==0 || strcmp(Option,"YES")==0 ) { AUTO_FLASH(Language,Device); flag=0; } else if ( strcmp(Option,"no")==0 || strcmp(Option,"NO")==0 ) { UI_TOP(Language); DISPLAY("AUTO_FLASH_OFF",Language); PAUSE(); flag=0; } } }
int main() { // Parse the configuration file and fetch out information we need. Cfg::basic_ptree<std::string, std::string> cfg; try { Cfg::read_ini("example.configuration", cfg); } catch (const Cfg::ini_parser_error &e) { RETURN_ON_FAILURE_MSG("ini_parser_error"); } try { std::cout << cfg.get<std::string>("ACCOUNT.account_name") << std::endl; std::cout << cfg.get<std::string>("ACCOUNT.primary_access_key") << std::endl; std::cout << cfg.get<std::string>("ACCOUNT.secondary_access_key") << std::endl; std::cout << cfg.get<std::string>("ACCOUNT.end_point") << std::endl; std::cout << cfg.get<bool>("ACCOUNT.use_https") << std::endl; std::cout << cfg.get<bool>("ACCOUNT.use_dev_account") << std::endl; } catch (const Cfg::ptree_bad_path &e) { RETURN_ON_FAILURE_MSG("ptree_bad_path"); } catch (const Cfg::ptree_bad_data &e) { RETURN_ON_FAILURE_MSG("ptree_bad_data"); } catch (const std::exception &e) { RETURN_ON_FAILURE_MSG("exception"); } PAUSE(); return 0; }
static int dump_rom_2 (CalcHandle* handle, CalcDumpSize size, const char *filename) { int err; //uint16_t keys[] = { // 0x76, 0x08, 0x08, /* Quit, Clear, Clear, */ // 0x28, 0x3A, 0x34, 0x11, /* A, S, M, (, */ // 0x39, 0x36, 0x34, 0x2B, /* R, O, M, D */ // 0x56, 0x4E, 0x51, 0x12, /* u, m, p, ) */ // 0x06 /* Enter */ //}; // Wait for user's action (execing program) sprintf(handle->updat->text, _("Waiting for user's action...")); handle->updat->label(); do { handle->updat->refresh(); if (handle->updat->cancel) return ERR_ABORT; //send RDY request ??? PAUSE(1000); err = rd_is_ready(handle); } while (err == ERROR_READ_TIMEOUT); // Get dump TRYF(rd_dump(handle, filename)); return 0; }
/* Generic SVC implementations. */ u32 svcSendSyncRequest() { u32 handle = arm11_R(0); handleinfo* hi = handle_Get(handle); if(hi == NULL) { ERROR("handle %08x not found.\n", handle); IPC_debugprint(arm11_ServiceBufferAddress() + 0x80); arm11_Dump(); PAUSE(); #ifdef EXIT_ON_ERROR exit(1); #else return 0; #endif } if(hi->type >= NUM_HANDLE_TYPES) { // This should never happen. ERROR("handle %08x has non-defined type.\n", handle); PAUSE(); exit(1); } // Lookup actual callback in table. if (handle_types[hi->type].fnSyncRequest != NULL) { u32 ret; bool locked = false; ret = handle_types[hi->type].fnSyncRequest(hi, &locked); // Handle is locked so we put thread into WAITING state. if (locked) { u32* wait_list = malloc(4); wait_list[0] = handle; threads_SetCurrentThreadWaitList(wait_list, true, 1); } return ret; } else { ERROR("svcSyncRequest undefined for handle-type \"%s\".\n", handle_types[hi->type].name); PAUSE(); exit(1); } }
static int send_key (CalcHandle* handle, uint16_t key) { TRYF(ti92_send_KEY(key)); TRYF(ti92_recv_ACK(&key)); PAUSE(50); return 0; }
u32 svcWaitSynchronization1() //todo timeout { u32 handle = arm11_R(0); handleinfo* hi = handle_Get(handle); if(hi == NULL) { ERROR("handle %08x not found.\n", handle); PAUSE(); #ifdef EXIT_ON_ERROR exit(1); #else return 0; #endif } if(hi->type >= NUM_HANDLE_TYPES) { // This should never happen. ERROR("handle %08x has non-defined type.\n", handle); PAUSE(); exit(1); } // Lookup actual callback in table. if (handle_types[hi->type].fnWaitSynchronization != NULL) { u32 ret; bool locked = false; ret = handle_types[hi->type].fnWaitSynchronization(hi, &locked); if (locked) { // If handle is locked we put thread in WAITING state. u32* wait_list = (u32*) malloc(4); wait_list[0] = handle; threads_SetCurrentThreadWaitList(wait_list, true, 1); } return ret; } else { ERROR("WaitSynchronization undefined for handle-type \"%s\".\n", handle_types[hi->type].name); PAUSE(); return 0; } }
static void alive_thd(void *data) { while(1) { PAUSE(SECONDS(1)); eprintf("@"); } }
static int dump_rom_1 (CalcHandle* handle) { // Send dumping program TRYF(rd_send(handle, "romdump.86p", romDumpSize86, romDump86)); PAUSE(1000); return 0; }