void AXUCode::ProcessPBList(u32 pb_addr) { // Samples per millisecond. In theory DSP sampling rate can be changed from // 32KHz to 48KHz, but AX always process at 32KHz. const u32 spms = 32; AXPB pb; while (pb_addr) { AXBuffers buffers = {{m_samples_left, m_samples_right, m_samples_surround, m_samples_auxA_left, m_samples_auxA_right, m_samples_auxA_surround, m_samples_auxB_left, m_samples_auxB_right, m_samples_auxB_surround}}; ReadPB(pb_addr, pb); u32 updates_addr = HILO_TO_32(pb.updates.data); u16* updates = (u16*)HLEMemory_Get_Pointer(updates_addr); for (int curr_ms = 0; curr_ms < 5; ++curr_ms) { ApplyUpdatesForMs(curr_ms, (u16*)&pb, pb.updates.num_updates, updates); ProcessVoice(pb, buffers, spms, ConvertMixerControl(pb.mixer_control), m_coeffs_available ? m_coeffs : nullptr); // Forward the buffers for (size_t i = 0; i < ArraySize(buffers.ptrs); ++i) buffers.ptrs[i] += spms; } WritePB(pb_addr, pb); pb_addr = HILO_TO_32(pb.next_pb); } }
void AXWiiUCode::ProcessPBList(u32 pb_addr) { AXPBWii pb; while (pb_addr) { AXBuffers buffers = {{ m_samples_left, m_samples_right, m_samples_surround, m_samples_auxA_left, m_samples_auxA_right, m_samples_auxA_surround, m_samples_auxB_left, m_samples_auxB_right, m_samples_auxB_surround, m_samples_auxC_left, m_samples_auxC_right, m_samples_auxC_surround, m_samples_wm0, m_samples_aux0, m_samples_wm1, m_samples_aux1, m_samples_wm2, m_samples_aux2, m_samples_wm3, m_samples_aux3 }}; ReadPB(pb_addr, pb); u16 num_updates[3]; u16 updates[1024]; u32 updates_addr; if (ExtractUpdatesFields(pb, num_updates, updates, &updates_addr)) { for (int curr_ms = 0; curr_ms < 3; ++curr_ms) { ApplyUpdatesForMs(curr_ms, (u16*)&pb, num_updates, updates); ProcessVoice(pb, buffers, 32, ConvertMixerControl(HILO_TO_32(pb.mixer_control)), m_coeffs_available ? m_coeffs : nullptr); // Forward the buffers for (size_t i = 0; i < ArraySize(buffers.ptrs); ++i) buffers.ptrs[i] += 32; } ReinjectUpdatesFields(pb, num_updates, updates_addr); } else { ProcessVoice(pb, buffers, 96, ConvertMixerControl(HILO_TO_32(pb.mixer_control)), m_coeffs_available ? m_coeffs : nullptr); } WritePB(pb_addr, pb); pb_addr = HILO_TO_32(pb.next_pb); } }
t_uint64 ReadB (t_uint64 va) { t_uint64 pa; if (dmapen) pa = trans_d (va, cm_racc); /* mapping on? */ else pa = va; return ReadPB (pa); }
static t_stat hdump_cmd(int32 arg, CONST char* buf) { int i; t_addr low, high, base, top; char gbuf[2*CBUFSIZE]; char *token; uint32 byte[16]; t_bool ascii = FALSE; t_bool first = TRUE; if (buf[0]=='-' && buf[1]=='a') { ascii = TRUE; buf += 2; while (*buf && isspace(*buf)) buf++; } memset(byte,0,sizeof(uint32)*16); gbuf[sizeof(gbuf)-1] = '\0'; strncpy(gbuf, buf, sizeof(gbuf)-1); token = strtok(gbuf,"- \t\n"); if (!token) return SCPE_2FARG; low = strtol(token,0,16); token = strtok(NULL,"- \t\n"); if (!token) return SCPE_2FARG; high = strtol(token,0,16); base = low - (low % 16); top = (high + 15) - ((high+15) % 16); for (; base<top; base++) { if ((base % 16)==0) { if (!first && ascii) putascii(byte); printf("\n%08x: ",base); first = FALSE; } if (base < low) printf(" "); else if (base > high) printf(" "); else { i = base %16; if (ReadPB(base,byte+i) != SCPE_OK) printf("?? "); else printf("%02x ",byte[i] & 0xff); } } if (!first && ascii) putascii(byte); putchar('\n'); return SCPE_OK; }
void CUCode_AX::ProcessPBList(u32 pb_addr) { // Samples per millisecond. In theory DSP sampling rate can be changed from // 32KHz to 48KHz, but AX always process at 32KHz. const u32 spms = 32; AXPB pb; while (pb_addr) { AXBuffers buffers = {{ m_samples_left, m_samples_right, m_samples_surround, m_samples_auxA_left, m_samples_auxA_right, m_samples_auxA_surround, m_samples_auxB_left, m_samples_auxB_right, m_samples_auxB_surround }}; if (!ReadPB(pb_addr, pb)) break; for (int curr_ms = 0; curr_ms < 5; ++curr_ms) { ApplyUpdatesForMs(pb, curr_ms); Process1ms(pb, buffers, ConvertMixerControl(pb.mixer_control)); // Forward the buffers for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i) buffers.ptrs[i] += spms; } WritePB(pb_addr, pb); pb_addr = HILO_TO_32(pb.next_pb); } }
t_stat ReadVB(t_addr a, uint32* val) { t_addr addr; IOHANDLER* ioh; t_stat rc = TranslateAddr(a,&addr,&ioh,MEM_READ,m68k_fcode,m68k_dma); switch (rc) { case SIM_NOMEM: /* note this is a hack to persuade memory testing code that there is no memory: * writing to such an address is a bit bucket, * and reading from it will return some arbitrary value. * * SIM_NOMEM has to be defined for systems without a strict memory handling that will * result in reading out anything without trapping a memory fault */ *val = 0xff; return SCPE_OK; case SIM_ISIO: return ioh->io(ioh,val,IO_READ,BMASK); case SCPE_OK: return ReadPB(addr,val); default: return rc; } }
static int simpb_html (struct shttpd_arg_t *arg) { int n = 0, ret = 0; char * current = NULL; char *sr; char *line; int sr_len; n += snprintf (arg->buf + n, arg->buflen - n, "%s", "HTTP/1.1 200 OK\r\n" "Content-Type: text/html\r\n\r\n" "<html><head><title>PhoneBook in SIM Card</title>" "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\"/>" "<meta name=\"viewport\" content=\"width=320, initial-scale=1.0\" />" "</head><body>"); sr = sqlite_exec("/var/root/Library/AddressBook/AddressBook.sqlitedb","select ROWID,first from ABPerson"); sr_len = strlen(sr); n += snprintf(arg->buf + n, arg->buflen - n, "<table border=\"0\" cellpadding=\"5\" align=\"center\">"); for(line = sr; line < (sr + sr_len-1); line = strstr(line,"|\n")+2) { int id; char name[128]; char *phone; char sql[256]; sscanf(line,"%d|%[^|]",&id,name); fprintf(stderr,"id:%d,name:%s\n",id,name); sprintf(sql,"select value from ABMultiValue where record_id=%d",id); phone = sqlite_exec("/var/root/Library/AddressBook/AddressBook.sqlitedb",sql); fprintf(stderr,"phone:%s\n",phone); if(phone != NULL) { phone[strlen(phone)-2] = 0; n += snprintf(arg->buf + n, arg->buflen - n, "<tr><td><a href=\"/?phone_num=%s\">%s</a></td><td>%s</td></tr>", name,name,phone ); free(phone); } } if(sr) free(sr); n += snprintf (arg->buf + n, arg->buflen - n, "</table>"); n += snprintf (arg->buf + n, arg->buflen - n, "<p align=\"center\">--------- SIM Card ---------</p>"); if(cached_pb_len == 0) { int pbs_len = ReadPB(gsm_modem); memcpy(cached_pb,readbuf,pbs_len); cached_pb_len = pbs_len; } fprintf(stderr,"cached_pb_len: %d\n",cached_pb_len); n += snprintf(arg->buf + n, arg->buflen - n, "<table border=\"0\" cellpadding=\"5\" align=\"center\">"); for (current = strstr(cached_pb, "\r\n+CPBR: "); current != NULL && current < cached_pb + cached_pb_len - 1; current = strstr(current + 1, "\r\n+CPBR: ")) { int pos,i; unsigned char phone_num[32]; unsigned char name[64]; unsigned short *ucs2; unsigned char *utf8; //"\r\n+CPBR: 1,"111111",129,"a"\r\n" sscanf(current, "\r\n+CPBR: %d,\"%[^\"]\",%*d,\"%[^\"]", &pos,phone_num,name); // fprintf(stderr,"%d, %s, %s\n",pos,phone_num,name); // for(i=0; i<strlen(phone_num); i++) // fprintf(stderr,"%02X ",phone_num[i]); // fprintf(stderr,"\n"); // for(i=0; i<strlen(name); i++) // fprintf(stderr,"%02X ",name[i]); // fprintf(stderr,"\n"); ucs2 = (unsigned short *)HexToBin(name,strlen(name)); // fprintf(stderr,"ucs2: "); // for(i=0; i<(strlen(name)/4); i++) // fprintf(stderr,"%04X ",ucs2[i]); // fprintf(stderr,"\n"); utf8 = ucs2_to_utf8(ucs2,strlen(name)/4); free(ucs2); // for(i=0; i<strlen(utf8); i++) // fprintf(stderr,"%02X ",utf8[i]); // fprintf(stderr,"\n"); n += snprintf(arg->buf + n, arg->buflen - n, "<tr><td><a href=\"/?phone_num=%s\">%s</a></td><td>%s</td></tr>", phone_num,utf8,phone_num ); } n += snprintf (arg->buf + n, arg->buflen - n, "</table></body></html>"); assert (n < (int) arg->buflen); arg->last = 1; return (n); }