BOOL RecordLoopbackDevice(int iNpcapAdapterID) { TRACE_ENTER(); g_NpcapAdapterID = iNpcapAdapterID; try { COM com; NetCfg netCfg; if (!netCfg.GetNetworkConfiguration()) { TRACE_PRINT("NetCfg::GetNetworkConfiguration: error."); TRACE_EXIT(); return FALSE; } } catch(...) { TRACE_PRINT("NetCfg::GetNetworkConfiguration: error (exception)."); TRACE_EXIT(); return FALSE; } TRACE_EXIT(); return TRUE; }
static uint8 MDRIVEH_Read(const uint32 Addr) { uint8 cData; uint8 unit; uint32 offset; cData = 0xFF; /* default is High-Z Data */ switch(Addr & 0x1) { case MDRIVEH_ADDR: TRACE_PRINT(VERBOSE_MSG, ("MDRIVEH: " ADDRESS_FORMAT " RD Addr = 0x%02x" NLP, PCX, cData)); break; case MDRIVEH_DATA: unit = (mdriveh_info->dma_addr & 0x380000) >> 19; offset = mdriveh_info->dma_addr & 0x7FFFF; if(mdriveh_info->storage[unit] != NULL) { cData = mdriveh_info->storage[unit][offset]; } TRACE_PRINT(RD_DATA_MSG, ("MDRIVEH: " ADDRESS_FORMAT " RD Data [%x:%05x] = 0x%02x" NLP, PCX, unit, offset, cData)); /* Increment M-DRIVE/H Data Address */ mdriveh_info->dma_addr++; mdriveh_info->dma_addr &= 0x3FFFFF; break; } return (cData); }
// --------------------------------------------------------------------------- // RunServerL() // Perform all server initialisation, in particular creation of the scheduler // and server and then run the scheduler. // --------------------------------------------------------------------------- // static void RunServerL() { TRACE_PRINT("RunServerL 1"); // Naming the server thread after the server helps to debug panics User::LeaveIfError(User::RenameThread( KDevTokenServerName )); TRACE_PRINT("RunServerL 2"); // Create and install the active scheduler we need CActiveScheduler* s=new(ELeave) CActiveScheduler; CleanupStack::PushL(s); CActiveScheduler::Install(s); TRACE_PRINT("RunServerL 3"); // Create the server and leave it on the cleanup stack CDevTokenServer::NewLC(); TRACE_PRINT("RunServerL 4"); // Before starting the server, notify client that initialisation is // complete. // (note that WINS on EKA1 uses threads since it lacks process emulation) RProcess::Rendezvous(KErrNone); TRACE_PRINT("RunServerL 5"); // Ready to run CActiveScheduler::Start(); // Cleanup the server and scheduler CleanupStack::PopAndDestroy(2); }
// --------------------------------------------------------------------------- // CDevTokenServer::NewLC() // --------------------------------------------------------------------------- // CServer2* CDevTokenServer::NewLC() { TRACE_PRINT(" CDevTokenServer::NewLC -->"); CDevTokenServer* self=new(ELeave) CDevTokenServer; CleanupStack::PushL(self); self->ConstructL(); TRACE_PRINT(" CDevTokenServer::NewLC <--"); return self; }
static uint8 VFDHD_Read(const uint32 Addr) { uint8 cData; VFDHD_DRIVE_INFO *pDrive; pDrive = &vfdhd_info->drive[vfdhd_info->sel_drive]; cData = 0x00; switch(Addr & 0x3) { case FDHD_CTRL_STATUS0: cData = (pDrive->wp & 1); /* [0] Write Protect (FD) */ cData |= (pDrive->ready & 1) << 1; /* [1] Drive ready (HD) */ cData |= (pDrive->track == 0) ? 0x04 : 0; /* [2] TK0 (FD/HD) */ cData |= (pDrive->write_fault & 1) << 3; /* [3] Write Fault (HD) */ cData |= (pDrive->seek_complete & 1) << 4; /* [4] Seek Complete (HD) */ cData |= (pDrive->sync_lost & 1) << 5; /* [5] Loss of Sync (HD) */ cData |= 0xC0; /* [7:6] Reserved (pulled up) */ TRACE_PRINT(STATUS_MSG, ("VFDHD: " ADDRESS_FORMAT " RD S0 = 0x%02x" NLP, PCX, cData)); break; case FDHD_CTRL_STATUS1: vfdhd_info->floppy_sel = (vfdhd_info->sel_drive == 0) ? 0 : 1; cData = (vfdhd_info->floppy_sel & 0x1); /* [0] Floppy Selected */ cData |= (vfdhd_info->controller_busy & 0x1) << 1; /* [1] Controller busy */ cData |= (vfdhd_info->motor_on & 0x1) << 2; /* [2] Motor On (FD) */ cData |= (vfdhd_info->hdsk_type & 0x1) << 3; /* [3] Hard Disk Type (0=5MB, 1=10MB) */ cData |= 0xF0; /* [7:4] Reserved (pulled up) */ if(vfdhd_info->sel_drive == 0) { /* cData &= 0xF0; */ } vfdhd_info->controller_busy = 0; TRACE_PRINT(STATUS_MSG, ("VFDHD: " ADDRESS_FORMAT " RD S1 = 0x%02x" NLP, PCX, cData)); break; case FDHD_DATA: /* DBG_PRINT(("VFDHD: " ADDRESS_FORMAT " RD Data" NLP, PCX)); */ if(vfdhd_info->datacount+40 >= VFDHD_RAW_LEN) { TRACE_PRINT(ERROR_MSG, ("VFDHD: " ADDRESS_FORMAT " Illegal data count %d." NLP, PCX, vfdhd_info->datacount)); vfdhd_info->datacount = 0; } cData = sdata.raw[vfdhd_info->datacount+40]; vfdhd_info->datacount++; /* DBG_PRINT(("VFDHD: " ADDRESS_FORMAT " RD Data Sector %d[%03d]: 0x%02x" NLP, PCX, pDrive->sector, vfdhd_info->datacount, cData)); */ break; case FDHD_RESET_START: /* Reset */ TRACE_PRINT(CMD_MSG, ("VFDHD: " ADDRESS_FORMAT " Reset" NLP, PCX)); vfdhd_info->datacount = 0; cData = 0xFF; /* Return High-Z data */ break; } return (cData); }
void do_method_attr(const int type) { switch(type) { case PRIVATE_TOK: TRACE_PRINT("method attribute is PRIVATE"); break; case PUBLIC_TOK: TRACE_PRINT("method attribute is PUBLIC"); break; case PROTECTED_TOK: TRACE_PRINT("method attribute is PROTECTED"); break; case STATIC_TOK: TRACE_PRINT("method attribute is STATIC"); break; } }
/*------------------------------------------------------------------------------ OSAL_AllocatorInit ------------------------------------------------------------------------------*/ OSAL_ERRORTYPE OSAL_AllocatorInit(OSAL_ALLOCATOR* alloc) { #ifdef OMX_MEM_TRC pf = fopen("omx_mem_trc.csv", "w"); if(pf) fprintf(pf, "linead memory usage in bytes;linear memory usage in 4096 pages;\n"); #endif #ifdef ANDROID if(alloc->pdwl) return OSAL_ERRORNONE; TRACE("OSAL_Init\n"); DWLInitParam_t dwlInit; dwlInit.clientType = DWL_CLIENT_TYPE_H264_DEC; alloc->pdwl = (void*)DWLInit(&dwlInit); // NOTE: error handling return OSAL_ERRORNONE; #endif #ifdef MEMALLOCHW OSAL_ERRORTYPE err = OSAL_ERRORNONE; // open memalloc for linear memory allocation alloc->fd_memalloc = open("/tmp/dev/memalloc", O_RDWR | O_SYNC); //alloc->fd_memalloc = open("/dev/memalloc", O_RDWR | O_SYNC); if (alloc->fd_memalloc == -1) { TRACE_PRINT("memalloc not found\n"); err = OSAL_ERROR_UNDEFINED; goto FAIL; } // open raw memory for memory mapping alloc->fd_mem = open("/dev/mem", O_RDWR | O_SYNC); //alloc->fd_mem = open("/dev/uio0", O_RDWR | O_SYNC); if (alloc->fd_mem == -1) { TRACE_PRINT("uio0 not found\n"); err = OSAL_ERROR_UNDEFINED; goto FAIL; } return OSAL_ERRORNONE; FAIL: if (alloc->fd_memalloc > 0) close(alloc->fd_memalloc); if (alloc->fd_mem > 0) close(alloc->fd_mem); return err; #else return OSAL_ERRORNONE; #endif }
// --------------------------------------------------------------------------- // CDevTokenServer::ConstructL() // 2nd phase construction - ensure the timer and server objects are running. // --------------------------------------------------------------------------- // void CDevTokenServer::ConstructL() { TRACE_PRINT(" CDevTokenServer::ConstructL -->"); TRACE_PRINT(" CDevTokenServer::ConstructL 1"); DevTokenDialog::InitialiseL(); StartL( KDevTokenServerName ); TRACE_PRINT(" CDevTokenServer::ConstructL 2"); // Ensure that the server still exits even if the 1st client fails to connect iShutdown.ConstructL(); iShutdown.Start(); }
static CODEC_STATE decoder_setppargs_vp8(CODEC_PROTOTYPE * codec, PP_ARGS * args) { CALLSTACK; CODEC_VP8 *this = (CODEC_VP8 *) codec; assert(this); assert(args); PPResult ret; ret = HantroHwDecOmx_pp_init(&this->pp_instance, &this->pp_config); if(ret == PP_OK) { this->transforms = HantroHwDecOmx_pp_set_output(&this->pp_config, args, OMX_TRUE); if(this->transforms == PPTR_ARG_ERROR) { LOGE("error in line %d: HantroHwDecOmx_pp_set_output returned PPTR_ARG_ERROR", __LINE__); return CODEC_ERROR_INVALID_ARGUMENT; } #ifdef ENABLE_PP if(this->transforms == PPTR_NONE) { TRACE_PRINT("PP_DISABLED\n"); this->pp_state = PP_DISABLED; } else { TRACE_PRINT("PP_COMBINED_MODE\n"); PPResult res; res = HantroHwDecOmx_pp_pipeline_enable(this->pp_instance, this->instance, PP_PIPELINED_DEC_TYPE_VP8); if(res != PP_OK) { return CODEC_ERROR_UNSPECIFIED; } this->pp_state = PP_PIPELINE; } return CODEC_OK; #else this->pp_state = PP_DISABLED; return CODEC_OK; #endif } return CODEC_ERROR_UNSPECIFIED; }
/* Reset routine */ static t_stat scp300f_reset(DEVICE *dptr) { PNP_INFO *pnp = (PNP_INFO *)dptr->ctxt; TRACE_PRINT(VERBOSE_MSG, ("SCP300F: Reset." NLP)); if(dptr->flags & DEV_DIS) { /* Disconnect I/O Ports */ sim_map_resource(pnp->io_base, pnp->io_size, RESOURCE_TYPE_IO, &scp300fdev, TRUE); sim_map_resource(pnp->mem_base, pnp->mem_size, RESOURCE_TYPE_MEMORY, &scp300f_mem, TRUE); } else { /* Connect SCP300F at base address */ if(sim_map_resource(pnp->io_base, pnp->io_size, RESOURCE_TYPE_IO, &scp300fdev, FALSE) != 0) { printf("%s: error mapping I/O resource at 0x%04x\n", __FUNCTION__, pnp->io_base); return SCPE_ARG; } /* Connect SCP300F Memory (512K RAM, 1MB FLASH) */ if(sim_map_resource(pnp->mem_base, pnp->mem_size, RESOURCE_TYPE_MEMORY, &scp300f_mem, FALSE) != 0) { printf("%s: error mapping MEM resource at 0x%04x\n", __FUNCTION__, pnp->mem_base); return SCPE_ARG; } /* Re-enable ROM */ scp300f_info->rom_enabled = 1; } return SCPE_OK; }
static t_stat set_if3_connect(UNIT *uptr, int32 val, char *cptr, void *desc) { if(uptr->flags & UNIT_DISABLE) { TRACE_PRINT(ERROR_MSG, ("IF3[%d]: not enabled." NLP, uptr->u3)); return SCPE_OK; } if(val & UNIT_IF3_CONNECT) { TRACE_PRINT((RXIRQ_MSG|TXIRQ_MSG), ("IF3[%d]: IRQ polling started..." NLP, uptr->u3)); sim_activate(uptr, 100000); } else { TRACE_PRINT((RXIRQ_MSG|TXIRQ_MSG), ("IF3[%d]: IRQ polling stopped." NLP, uptr->u3)); sim_cancel(uptr); } return (SCPE_OK); }
int32 petr (int32 inst, int32 dev, int32 dat) { int32 tmpAC = 0; int i = 0; t_stat result; ios = 1; for (i=0;i<inst;i++) { do { result = petr_svc(&petr_unit); if (result != SCPE_OK) { printf("PETR: Read error\n"); break; } } while ((petr_unit.buf & 0100) == 0); /* NOTE: Lines without seventh hole are ignored by PETR. */ petr_unit.buf &= 077; /* Mask to 6 bits. */ tmpAC |= ((petr_unit.buf & 001) >> 0) << 17; /* bit 0 */ tmpAC |= ((petr_unit.buf & 002) >> 1) << 14; /* bit 3 */ tmpAC |= ((petr_unit.buf & 004) >> 2) << 11; /* bit 6 */ tmpAC |= ((petr_unit.buf & 010) >> 3) << 8; /* bit 9 */ tmpAC |= ((petr_unit.buf & 020) >> 4) << 5; /* bit 12 */ tmpAC |= ((petr_unit.buf & 040) >> 5) << 2; /* bit 15 */ if (i < (inst-1)) { uint32 bit0 = (tmpAC & 1) << 17; TRACE_PRINT(petr_dev, TRACE_MSG, ("PETR read [%04x=0x%02x] %03o\n", petr_unit.pos-1, petr_unit.buf, petr_unit.buf)); tmpAC >>= 1; tmpAC |= bit0; } else {
hid_return hid_os_force_claim(HIDInterface* const hidif, int const interface, HIDInterfaceMatcher const* const matcher, unsigned short retries UNUSED) { if (!hidif) { ERROR_PRINT("cannot open NULL HIDInterface."); return HID_RET_INVALID_PARAMETER; } if (!hid_is_opened(hidif)) { ERROR_PRINT("cannot force claim interface of unopened HIDInterface."); return HID_RET_DEVICE_ALREADY_OPENED; } if (!matcher) { ERROR_PRINT("cannot match against NULL HIDInterfaceMatcher."); return HID_RET_INVALID_PARAMETER; } WARNING_PRINT("code not tested on the Darwin platform!"); TRACE_PRINT("claiming USB device %s...", hidif->id); #if 1 if (usb_claim_interface(hidif->dev_handle, interface) < 0) { WARNING_PRINT("failed to claim USB device %s...", hidif->id); /* return HID_RET_FAIL_CLAIM_IFACE; */ } #endif return HID_RET_SUCCESS; }
static int32 selchandev(const int32 port, const int32 io, const int32 data) { DBG_PRINT(("SELCHAN: IO %s, Port %02x" NLP, io ? "WR" : "RD", port)); if(io) { selchan_info->selchan <<= 8; selchan_info->selchan &= 0xFFFFFF00; selchan_info->selchan |= data; selchan_info->dma_addr = (selchan_info->selchan & 0xFFFFF00) >> 8; selchan_info->dma_mode = (selchan_info->selchan & 0xFF); selchan_info->reg_cnt ++; if(selchan_info->reg_cnt == 4) { TRACE_PRINT(VERBOSE_MSG, ("SELCHAN: " ADDRESS_FORMAT " DMA=0x%06x, Mode=0x%02x (%s, %s, %s)" NLP, PCX, selchan_info->dma_addr, selchan_info->dma_mode, selchan_info->dma_mode & SELCHAN_MODE_WRITE ? "WR" : "RD", selchan_info->dma_mode & SELCHAN_MODE_IO ? "I/O" : "MEM", selchan_info->dma_mode & SELCHAN_MODE_IO ? "FIX" : selchan_info->dma_mode & SELCHAN_MODE_CNT_UP ? "INC" : "DEC")); } return 0; } else {
/* precondition: current_disk < NUM_OF_DSK */ static void writebuf(void) { int32 i, rtn; UNIT *uptr; i = current_byte[current_disk]; /* null-fill rest of sector if any */ while (i < DSK_SECTSIZE) dskbuf[i++] = 0; uptr = dsk_dev.units + current_disk; if (((uptr -> flags) & UNIT_DSK_WLK) == 0) { /* write enabled */ TRACE_PRINT(WRITE_MSG, ("DSK%i: " ADDRESS_FORMAT " OUT 0x0a (WRITE) D%d T%d S%d" NLP, current_disk, PCX, current_disk, current_track[current_disk], current_sector[current_disk])); if (dskseek(uptr)) { printf("DSK%i: " ADDRESS_FORMAT " fseek failed D%d T%d S%d" NLP, current_disk, PCX, current_disk, current_track[current_disk], current_sector[current_disk]); } rtn = fwrite(dskbuf, DSK_SECTSIZE, 1, uptr -> fileref); if (rtn != 1) { printf("DSK%i: " ADDRESS_FORMAT " fwrite failed T%d S%d Return=%d" NLP, current_disk, PCX, current_track[current_disk], current_sector[current_disk], rtn); } } else if ( (dsk_dev.dctrl & VERBOSE_MSG) && (warnLock[current_disk] < warnLevelDSK) ) { /* write locked - print warning message if required */ warnLock[current_disk]++; /*05*/ printf("DSK%i: " ADDRESS_FORMAT " Attempt to write to locked DSK%d - ignored." NLP, current_disk, PCX, current_disk); } current_flag[current_disk] &= 0xfe; /* ENWD off */ current_byte[current_disk] = 0xff; dirty = FALSE; }
/* Reset routine */ static t_stat if3_reset(DEVICE *dptr) { uint8 i; PNP_INFO *pnp = (PNP_INFO *)dptr->ctxt; if(dptr->flags & DEV_DIS) { /* Disconnect I/O Ports */ for(i=0;i<IF3_MAX_BOARDS;i++) sim_cancel(&if3_unit[i]); sim_map_resource(pnp->io_base, pnp->io_size, RESOURCE_TYPE_IO, &if3dev, TRUE); } else { /* Connect IF3 at base address */ if(sim_map_resource(pnp->io_base, pnp->io_size, RESOURCE_TYPE_IO, &if3dev, FALSE) != 0) { printf("%s: error mapping I/O resource at 0x%04x\n", __FUNCTION__, pnp->io_base); return SCPE_ARG; } for(i=0;i<IF3_MAX_BOARDS;i++) { if3_unit[i].u3 = i; /* Store unit board ID in u3. Also guarantees that u3 < IF3_MAX_BOARDS */ if(if3_unit[i].flags & UNIT_IF3_CONNECT) { TRACE_PRINT((RXIRQ_MSG|TXIRQ_MSG), ("IF3[%d]: IRQ polling started..." NLP, i)); sim_activate(&if3_unit[i], 200000); /* start Rx/Tx interrupt polling routine */ } } } return SCPE_OK; }
static uint8 SCP300F_Read(const uint32 Addr) { uint8 cData = 0xFF; switch(Addr & SCP300F_IO_MASK) { case SCP300F_MPIC_0: case SCP300F_MPIC_1: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " Master 8259 DATA RD[%02x]: not implemented." NLP, PCX, Addr)); break; case SCP300F_SPIC_0: case SCP300F_SPIC_1: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " Slave 8259 DATA RD[%02x]: not implemented." NLP, PCX, Addr)); break; case SCP300F_9513_DATA: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " 9513 DATA RD[%02x]: not implemented." NLP, PCX, Addr)); break; case SCP300F_9513_STATUS: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " 9513 STAT RD[%02x]: not implemented." NLP, PCX, Addr)); break; case SCP300F_UART_DATA: /* UART is handled by the 2SIO, if this gets called, then the 2SIO was not */ case SCP300F_UART_STATUS: /* configured properly. */ TRACE_PRINT(VERBOSE_MSG, ("SCP300F: " ADDRESS_FORMAT " RD[%02x]: UART not configured properly." NLP, PCX, Addr)); break; case SCP300F_PIO_DATA: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " PIO DATA RD[%02x]: not implemented." NLP, PCX, Addr)); break; case SCP300F_PIO_STATUS: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " PIO STATUS RD[%02x]: not implemented." NLP, PCX, Addr)); break; case SCP300F_EPROM_DIS: TRACE_PRINT(ROM_MSG, ("SCP300F: " ADDRESS_FORMAT " EPROM DIS RD: EPROM Disabled." NLP, PCX)); scp300f_info->rom_enabled = 0; break; case SCP300F_SENSE_SW: /* Sense Switch */ cData = scp300f_sr; TRACE_PRINT(VERBOSE_MSG, ("SCP300F: " ADDRESS_FORMAT " RD: Sense Switch=0x%02x" NLP, PCX, cData)); break; default: TRACE_PRINT(VERBOSE_MSG, ("SCP300F: " ADDRESS_FORMAT " RD[%02x]: not Implemented." NLP, PCX, Addr)); break; } return (cData); }
static uint8 HDC1001_Read(const uint32 Addr) { uint8 cData; cData = hdc1001_info->taskfile[Addr & 0x07]; TRACE_PRINT(VERBOSE_MSG, ("HDC1001: " ADDRESS_FORMAT " RD TF[%d]=0x%02x" NLP, PCX, Addr & 7, cData)); return (cData); }
static uint8 IF3_Read(const uint32 Addr) { uint8 cData = 0xFF; /* Check if board is connected */ if(!(if3_unit[if3_board].flags & UNIT_IF3_CONNECT)) { TRACE_PRINT(ERROR_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART[%d] Board not connected DATA=0x%02x" NLP, if3_board, PCX, if3_user, cData)); return cData; } switch(Addr & 0x07) { case IF3_UART_DATA: cData = sio0d(IF3_PORT_BASE+(if3_board*0x10)+(if3_user*2), 0, 0); TRACE_PRINT(UART_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART[%d] DATA=0x%02x Port=0x%03x" NLP, if3_board, PCX, if3_user, cData, IF3_PORT_BASE+(if3_board*0x10)+(if3_user*2))); break; case IF3_UART_STAT: cData = sio0s(IF3_PORT_BASE+(if3_board*0x10)+1+(if3_user*2), 0, 0); TRACE_PRINT(UART_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART[%d] STAT=0x%02x Port=0x%03x" NLP, if3_board, PCX, if3_user, cData, IF3_PORT_BASE+(if3_board*0x10)+1+(if3_user*2))); break; case IF3_UART_MODE: TRACE_PRINT(ERROR_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART MODE cannot read 0x%02x" NLP, if3_board, PCX, Addr)); break; case IF3_UART_CMD: TRACE_PRINT(ERROR_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART CMD cannot read 0x%02x" NLP, if3_board, PCX, Addr)); break; case IF3_TISR: update_rx_tx_isr (&if3_unit[if3_board]); cData = if3_tisr[if3_board]; TRACE_PRINT(TXIRQ_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART TISR=0x%02x" NLP, if3_board, PCX, cData)); break; case IF3_RISR: update_rx_tx_isr (&if3_unit[if3_board]); cData = if3_risr[if3_board]; TRACE_PRINT(RXIRQ_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART RISR=0x%02x" NLP, if3_board, PCX, cData)); break; case IF3_RESERVED: TRACE_PRINT(ERROR_MSG, ("IF3[%d]: " ADDRESS_FORMAT " RD UART RESERVED cannot read 0x%02x" NLP, if3_board, PCX, Addr)); break; case IF3_USER_SEL: TRACE_PRINT(USER_MSG, ("IF3[%d]: " ADDRESS_FORMAT " Cannot read UART_SEL" NLP, if3_board, PCX)); break; } return (cData); }
static hid_return hid_prepare_report_descriptor(HIDInterface* const hidif) { int len; ASSERT(hid_is_opened(hidif)); ASSERT(hidif->hid_parser); TRACE_PRINT("initialising the report descriptor for USB device %s...", hidif->id); if (hidif->hid_parser->ReportDescSize > REPORT_DSC_SIZE) { ERROR_PRINT("report descriptor size for USB device %s exceeds maximum size: " "%d > %d.\n", hidif->id, hidif->hid_parser->ReportDescSize, REPORT_DSC_SIZE); return HID_RET_REPORT_DESC_LONG; } TRACE_PRINT("retrieving report descriptor for USB device %s...", hidif->id); len = usb_control_msg(hidif->dev_handle, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR, (USB_DT_REPORT << 8) + 0, hidif->interface, (char*)hidif->hid_parser->ReportDesc, hidif->hid_parser->ReportDescSize, USB_TIMEOUT); if (len < 0) { WARNING_PRINT("failed to get report descriptor for USB device %s...", hidif->id); NOTICE_PRINT("Error from libusb: %s", usb_strerror()); return HID_RET_FAIL_GET_REPORT; } if (len < hidif->hid_parser->ReportDescSize) { WARNING_PRINT("HID report descriptor for USB device %s is too short; " "expected: %d bytes; got: %d bytes.\n", hidif->id, hidif->hid_parser->ReportDescSize, len); return HID_RET_REPORT_DESC_SHORT; } NOTICE_PRINT("successfully initialised report descriptor for USB device %s.", hidif->id); return HID_RET_SUCCESS; }
/*! @todo This code does not seem to properly retrieve descriptors for devices * with multiple interfaces. We probably need to parse each interface a little * more to determine which endpoints we want to talk to with usb_control_msg * (EP1IN can't be right for everything). */ static hid_return hid_prepare_hid_descriptor(HIDInterface* const hidif) { int len; byte buffer[9]; ASSERT(hid_is_opened(hidif)); ASSERT(hidif->hid_parser); TRACE_PRINT("initialising the HID descriptor for USB device %s...", hidif->id); /* TODO: BUFLEN seems to depend on the device, so we need to do something * about the following. */ TRACE_PRINT("retrieving HID descriptor for USB device %s...", hidif->id); len = usb_control_msg(hidif->dev_handle, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR, (USB_DT_HID << 8) + 0, hidif->interface, (char*)buffer, sizeof(buffer), USB_TIMEOUT); if (len < 0) { WARNING_PRINT("failed to get HID descriptor for USB device %s:%s", hidif->id, usb_strerror()); return HID_RET_NOT_HID_DEVICE; } if (len < sizeof(buffer)) { WARNING_PRINT("HID descriptor for USB device %s is too short; " "expected: %d bytes; got: %d bytes.\n", hidif->id, sizeof(buffer), len); return HID_RET_HID_DESC_SHORT; } /* TODO: * the constants 7 and 8 should be exported. */ hidif->hid_parser->ReportDescSize = buffer[7] | (buffer[8] << 8); NOTICE_PRINT("successfully initialised HID descriptor for USB device %s (%d bytes).", hidif->id, hidif->hid_parser->ReportDescSize); return HID_RET_SUCCESS; }
static uint8 HDC1001_Write(const uint32 Addr, uint8 cData) { /* uint8 result = HDC1001_STATUS_COMPLETE; */ HDC1001_DRIVE_INFO *pDrive; pDrive = &hdc1001_info->drive[hdc1001_info->sel_drive]; switch(Addr & 0x07) { case TF_SDH: hdc1001_info->sel_drive = (cData >> 3) & 0x03; pDrive = &hdc1001_info->drive[hdc1001_info->sel_drive]; case TF_DATA: case TF_ERROR: case TF_SECNT: case TF_SECNO: case TF_CYLLO: case TF_CYLHI: hdc1001_info->taskfile[Addr & 0x07] = cData; TRACE_PRINT(VERBOSE_MSG, ("HDC1001: " ADDRESS_FORMAT " WR TF[%d]=0x%02x" NLP, PCX, Addr & 7, cData)); break; case TF_CMD: pDrive->track = hdc1001_info->taskfile[TF_CYLLO] | (hdc1001_info->taskfile[TF_CYLHI] << 8); pDrive->xfr_nsects = hdc1001_info->taskfile[TF_SECNT]; TRACE_PRINT(CMD_MSG, ("HDC1001[%d]: Command=%d, T:%d/H:%d/S:%d N=%d" NLP, hdc1001_info->sel_drive, hdc1001_info->taskfile[TF_CMD], pDrive->track, hdc1001_info->taskfile[TF_SDH] & 0x07, hdc1001_info->taskfile[TF_SECNO], pDrive->xfr_nsects)); break; default: break; } return 0; }
static uint8 IF3_Write(const uint32 Addr, uint8 cData) { /* Check if board is connected for all ports except "user select" */ if((Addr & 0x7) != IF3_USER_SEL) { if(!(if3_unit[if3_board].flags & UNIT_IF3_CONNECT)) { TRACE_PRINT(ERROR_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART[%d] Board not connected DATA=0x%02x" NLP, if3_board, PCX, if3_user, cData)); return cData; } } switch(Addr & 0x07) { case IF3_UART_DATA: sio0d(IF3_PORT_BASE+(if3_board*0x10)+(if3_user*2), 1, cData); TRACE_PRINT(UART_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART[%d] DATA=0x%02x Port=0x%03x" NLP, if3_board, PCX, if3_user, cData, IF3_PORT_BASE+(if3_board*0x10)+(if3_user*2))); break; case IF3_UART_STAT: TRACE_PRINT(UART_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART[%d] STAT=0x%02x" NLP, if3_board, PCX, if3_user, cData)); break; case IF3_UART_MODE: TRACE_PRINT(UART_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART[%d] MODE=0x%02x" NLP, if3_board, PCX, if3_user, cData)); break; case IF3_UART_CMD: TRACE_PRINT(UART_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART[%d] CMD=0x%02x" NLP, if3_board, PCX, if3_user, cData)); break; case IF3_TISR: TRACE_PRINT(TXIRQ_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART TIMR=0x%02x" NLP, if3_board, PCX, cData)); if3_timr[if3_board] = cData; break; case IF3_RISR: TRACE_PRINT(RXIRQ_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART RIMR=0x%02x" NLP, if3_board, PCX, cData)); if3_rimr[if3_board] = cData; break; case IF3_RESERVED: TRACE_PRINT(UART_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART[%d] RESERVED=0x%02x" NLP, if3_board, PCX, if3_user, cData)); break; case IF3_USER_SEL: if3_board = (cData & 0x18) >> 3; /* guarantees that if3_board < IF3_MAX_BOARDS */ if3_user = cData & 0x7; TRACE_PRINT(USER_MSG, ("IF3[%d]: " ADDRESS_FORMAT " WR UART_SEL=0x%02x (Board=%d, Rel_User=%d, User=%d)" NLP, if3_board, PCX, cData, if3_board, if3_user, cData)); break; } return(0); }
static uint8 SCP300F_Write(const uint32 Addr, uint8 cData) { switch(Addr & SCP300F_IO_MASK) { case SCP300F_MPIC_0: case SCP300F_MPIC_1: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " Master 8259 DATA WR[%02x]=%02x: not implemented." NLP, PCX, Addr, cData)); break; case SCP300F_SPIC_0: case SCP300F_SPIC_1: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " Slave 8259 DATA WR[%02x]=%02x: not implemented." NLP, PCX, Addr, cData)); break; case SCP300F_9513_DATA: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " 9513 DATA WR[%02x]=%02x: not implemented." NLP, PCX, Addr, cData)); break; case SCP300F_9513_STATUS: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " 9513 STAT WR[%02x]=%02x: not implemented." NLP, PCX, Addr, cData)); break; case SCP300F_UART_DATA: /* UART is handled by the 2SIO, if this gets called, then the 2SIO was not */ case SCP300F_UART_STATUS: /* configured properly. */ TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " WR[%02x]: UART not configured properly." NLP, PCX, Addr)); break; case SCP300F_PIO_DATA: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " PIO DATA WR[%02x]=%02x: not implemented." NLP, PCX, Addr, cData)); break; case SCP300F_PIO_STATUS: TRACE_PRINT(UART_MSG, ("SCP300F: " ADDRESS_FORMAT " WR[%02x]: Cannot write to PIO STATUS." NLP, PCX, Addr)); break; case SCP300F_EPROM_DIS: TRACE_PRINT(ROM_MSG, ("SCP300F: " ADDRESS_FORMAT " EPROM DIS WR: EPROM Disabled." NLP, PCX)); scp300f_info->rom_enabled = 0; break; case SCP300F_SENSE_SW: TRACE_PRINT(VERBOSE_MSG, ("SCP300F: " ADDRESS_FORMAT " WR[%02x]: Cannot write to SR." NLP, PCX, Addr)); break; default: TRACE_PRINT(VERBOSE_MSG, ("SCP300F: " ADDRESS_FORMAT " WR[0x%02x]=0x%02x: not Implemented." NLP, PCX, Addr, cData)); break; } return(0); }
static uint8 MDRIVEH_Write(const uint32 Addr, uint8 cData) { uint8 result = 0; uint8 unit; uint32 offset; switch(Addr & 0x1) { case MDRIVEH_ADDR: mdriveh_info->dma_addr <<= 8; mdriveh_info->dma_addr &= 0x003FFF00; mdriveh_info->dma_addr |= cData; TRACE_PRINT(SEEK_MSG, ("MDRIVEH: " ADDRESS_FORMAT " DMA Address=%06x" NLP, PCX, mdriveh_info->dma_addr)); break; case MDRIVEH_DATA: unit = (mdriveh_info->dma_addr & 0x380000) >> 19; offset = mdriveh_info->dma_addr & 0x7FFFF; if(mdriveh_info->storage[unit] != NULL) { if(mdriveh_info->uptr[unit].flags & UNIT_MDRIVEH_WLK) { TRACE_PRINT(WR_DATA_MSG, ("MDRIVEH: " ADDRESS_FORMAT " WR Data [%x:%05x] = Unit Write Locked" NLP, PCX, unit, offset)); } else { TRACE_PRINT(WR_DATA_MSG, ("MDRIVEH: " ADDRESS_FORMAT " WR Data [%x:%05x] = 0x%02x" NLP, PCX, unit, offset, cData)); mdriveh_info->storage[unit][offset] = cData; } } else { TRACE_PRINT(WR_DATA_MSG, ("MDRIVEH: " ADDRESS_FORMAT " WR Data [%x:%05x] = Unit OFFLINE" NLP, PCX, unit, offset)); } /* Increment M-DRIVE/H Data Address */ mdriveh_info->dma_addr++; mdriveh_info->dma_addr &= 0x3FFFFF; break; } return (result); }
server_t *create_server(unsigned int max_connections) { /* Create a connection object. */ server_t *srv = calloc(1, sizeof(server_t)); /* Create a socket. */ srv->socket = socket(AF_INET, SOCK_DGRAM, 0); if (srv->socket < 0) { TRACE(NETWORK_TRACE, TRACE_PRINT("Unable to create socket.")); goto cleanup; } /* Use a stack allocated sockaddr to bind the server. */ struct sockaddr_in server_addr; memset((char *)&server_addr, 0, sizeof(server_addr)); server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = htonl(INADDR_ANY); server_addr.sin_port = htons(PORT); /* Bind the socket. */ if (bind(srv->socket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { TRACE(NETWORK_TRACE, TRACE_PRINT("Failed to bind the socket.")); goto cleanup; } srv->clients = calloc(max_connections, sizeof(connection_t)); //server_loop(srv); return srv; cleanup: if (srv->clients) { free(srv->clients); } free(srv); return NULL; }
/* Unit service routine */ static t_stat if3_svc (UNIT *uptr) { uint8 pending_rx_irqs; uint8 pending_tx_irqs; uint8 board = uptr->u3; update_rx_tx_isr(uptr); pending_rx_irqs = if3_risr[board] & if3_rimr[board]; if(pending_rx_irqs) { TRACE_PRINT(RXIRQ_MSG, ("IF3[%d]: " ADDRESS_FORMAT " Rx IRQ Pending: 0x%02x" NLP, board, PCX, pending_rx_irqs)); raise_ss1_interrupt(SS1_VI2_INT); } pending_tx_irqs = if3_tisr[board] & if3_timr[board]; if(pending_tx_irqs) { TRACE_PRINT(TXIRQ_MSG, ("IF3[%d]: " ADDRESS_FORMAT " Tx IRQ Pending: 0x%02x" NLP, board, PCX, pending_tx_irqs)); raise_ss1_interrupt(SS1_VI3_INT); } sim_activate(&if3_unit[board], 200000); return SCPE_OK; }
vector<tstring> getWlanAdapterGuids() { TRACE_ENTER(); HANDLE hClient = NULL; WLAN_INTERFACE_INFO sInfo[64]; RPC_TSTR strGuid = NULL; vector<tstring> nstrWlanAdapterGuids; if (!initWlanFunctions()) { TRACE_PRINT("initWlanFunctions: error."); TRACE_EXIT(); return nstrWlanAdapterGuids; } if (OpenHandleAndCheckVersion(&hClient) != ERROR_SUCCESS) { TRACE_PRINT("OpenHandleAndCheckVersion: error."); TRACE_EXIT(); return nstrWlanAdapterGuids; } UINT nCount = EnumInterface(hClient, sInfo); for (UINT i = 0; i < nCount; ++i) { if (UuidToString(&sInfo[i].InterfaceGuid, &strGuid) == RPC_S_OK) { TRACE_PRINT1("EnumInterface: executing, strGuid = %s.", (TCHAR*) strGuid); nstrWlanAdapterGuids.push_back((TCHAR*) strGuid); RpcStringFree(&strGuid); } } TRACE_EXIT(); return nstrWlanAdapterGuids; }
static int32 scp300f_mem(const int32 Addr, const int32 write, const int32 data) { /* DBG_PRINT(("SCP300F: ROM %s, Addr %04x" NLP, write ? "WR" : "RD", Addr)); */ if(write) { if(scp300f_info->rom_enabled) { TRACE_PRINT(ROM_MSG, ("SCP300F: " ADDRESS_FORMAT " WR ROM[0x%05x]: Cannot write to ROM." NLP, PCX, Addr)); } else { } return 0; } else { if(scp300f_info->rom_enabled) { return scp300f_rom[Addr & SCP300F_ADDR_MASK]; } else { return scp300f_ram[Addr & SCP300F_ADDR_MASK]; } } }
int32 dsk12(const int32 port, const int32 io, const int32 data) { int32 i; UNIT *uptr; if (current_disk >= NUM_OF_DSK) { if ((dsk_dev.dctrl & VERBOSE_MSG) && (warnDSK12 < warnLevelDSK)) { warnDSK12++; /*04*/ printf("DSK%i: " ADDRESS_FORMAT " Attempt of %s 0x0a on unattached disk - ignored." NLP, current_disk, PCX, selectInOut(io)); } return 0; } /* now current_disk < NUM_OF_DSK */ in9_count = 0; uptr = dsk_dev.units + current_disk; if (io == 0) { if (current_byte[current_disk] >= DSK_SECTSIZE) { /* physically read the sector */ TRACE_PRINT(READ_MSG, ("DSK%i: " ADDRESS_FORMAT " IN 0x0a (READ) D%d T%d S%d" NLP, current_disk, PCX, current_disk, current_track[current_disk], current_sector[current_disk])); for (i = 0; i < DSK_SECTSIZE; i++) dskbuf[i] = 0; dskseek(uptr); fread(dskbuf, DSK_SECTSIZE, 1, uptr -> fileref); current_byte[current_disk] = 0; } return dskbuf[current_byte[current_disk]++] & 0xff; } else { if (current_byte[current_disk] >= DSK_SECTSIZE) writebuf(); /* from above we have that current_disk < NUM_OF_DSK */ else { dirty = TRUE; /* this guarantees for the next call to writebuf that current_disk < NUM_OF_DSK */ dskbuf[current_byte[current_disk]++] = data & 0xff; } return 0; /* ignored since OUT */ } }