ULONG ov534_reg_write(struct InstData *data, UBYTE reg, UBYTE *val) { mybug(-1, ("ov534_reg_write register %01x with value %01x\n", reg, *val)); psdPipeSetup(data->ps3eye_ep0pipe, URTF_OUT|URTF_VENDOR|URTF_DEVICE, 0x01, 0x00, reg); return(psdDoPipe(data->ps3eye_ep0pipe, val, 1)); }
uint32_t urndis_ctrl_msg(struct NepClassEth *ncp, uint8_t rt, uint8_t r, uint16_t index, uint16_t value, void *buf, size_t buflen) { LONG err=-1; struct PsdPipe *pp; struct MsgPort *mp; if((mp = CreateMsgPort())) { if((pp = psdAllocPipe(ncp->ncp_Device, mp, NULL))) { psdSetAttrs(PGA_PIPE, pp, PPA_NakTimeout, FALSE, PPA_NakTimeoutTime, 5000, PPA_AllowRuntPackets, TRUE, TAG_END); // bug("urndis_ctrl_msg:pipesetup( %d,%d,%d,%d,%d )\n",pp, rt, r, value, index); psdPipeSetup(pp, rt, r, value, index); // bug("urndis_ctrl_msg:psdDoPipe(%d,%d,%d)\n",pp, buf, buflen); err = psdDoPipe(pp, buf, buflen); if(err!=0){ bug("urndis_ctrl_msg:error %d,%s\n",err,psdNumToStr(NTS_IOERR, err, "unknown")); } psdFreePipe(pp); } DeleteMsgPort(mp); } return err; }
ULONG ov534_reg_read(struct InstData *data, UBYTE reg, UBYTE *val) { ULONG ioerr; psdPipeSetup(data->ps3eye_ep0pipe, URTF_IN|URTF_VENDOR|URTF_DEVICE, 0x01, 0x00, reg); ioerr =psdDoPipe(data->ps3eye_ep0pipe, val, 1); mybug(-1, ("ov534_reg_read register %01x returns value %01x (ioerr %x)\n", reg, *val, ioerr)); return(ioerr); }
BOOL SendCommand(struct NepClassRocket *nch) { LONG ioerr; psdPipeSetup(nch->nch_EP0Pipe, URTF_OUT|URTF_CLASS|URTF_INTERFACE, UHR_SET_REPORT, 0x0200, 0); ioerr = psdDoPipe(nch->nch_EP0Pipe, nch->nch_Buf, 64); if(ioerr) { Printf("Error sending command: %s (%ld)\n", psdNumToStr(NTS_IOERR, ioerr, "unknown"), ioerr); return FALSE; } return TRUE; }
BOOL GetStatus(struct NepClassUPS *nch, ULONG outlet) { LONG ioerr; UBYTE buf[2]; psdPipeSetup(nch->nch_EP0Pipe, URTF_IN|URTF_CLASS|URTF_INTERFACE, UHR_GET_REPORT, 0x0300|(outlet*3), 0); ioerr = psdDoPipe(nch->nch_EP0Pipe, buf, 2); if(ioerr) { Printf("Error getting status: %s (%ld)\n", psdNumToStr(NTS_IOERR, ioerr, "unknown"), ioerr); return(FALSE); } return(buf[1]); }
BOOL SendInit(struct NepClassRocket *nch) { UBYTE cmd0[8] = { 0x55, 0x53, 0x42, 0x43, 0x00, 0x00, 0x04, 0x00 }; UBYTE cmd1[8] = { 0x55, 0x53, 0x42, 0x43, 0x00, 0x40, 0x02, 0x00 }; LONG ioerr; psdPipeSetup(nch->nch_EP0Pipe, URTF_OUT|URTF_CLASS|URTF_INTERFACE, UHR_SET_REPORT, 0x0200, 1); ioerr = psdDoPipe(nch->nch_EP0Pipe, cmd0, 8); if(ioerr) { Printf("Error sending init cmd 0: %s (%ld)\n", psdNumToStr(NTS_IOERR, ioerr, "unknown"), ioerr); return FALSE; } psdPipeSetup(nch->nch_EP0Pipe, URTF_OUT|URTF_CLASS|URTF_INTERFACE, UHR_SET_REPORT, 0x0200, 1); ioerr = psdDoPipe(nch->nch_EP0Pipe, cmd1, 8); if(ioerr) { Printf("Error sending init cmd 1: %s (%ld)\n", psdNumToStr(NTS_IOERR, ioerr, "unknown"), ioerr); return FALSE; } return TRUE; }
BOOL SendCommand(struct NepClassUPS *nch, ULONG outlet, ULONG cmd) { LONG ioerr; UBYTE buf[2]; buf[0] = outlet*3; buf[1] = cmd; psdPipeSetup(nch->nch_EP0Pipe, URTF_OUT|URTF_CLASS|URTF_INTERFACE, UHR_SET_REPORT, (ULONG) 0x0300|buf[0], 0); ioerr = psdDoPipe(nch->nch_EP0Pipe, buf, 2); if(ioerr) { Printf("Error sending cmd %s: %s (%ld)\n", cmd, psdNumToStr(NTS_IOERR, ioerr, "unknown"), ioerr); return(FALSE); } return(TRUE); }
void SetFreq(struct NepClassDRadio *nch, ULONG pll_div) { LONG ioerr; psdPipeSetup(nch->nch_EP0Pipe, URTF_IN|URTF_VENDOR|URTF_DEVICE, CMDID_SETFREQ, (pll_div>>8) & 0xff, pll_div & 0xff); ioerr = psdDoPipe(nch->nch_EP0Pipe, nch->nch_Buf, 1); if(ioerr) { Printf("Error sending set freq request: %s (%ld)\n", psdNumToStr(NTS_IOERR, ioerr, "unknown"), ioerr); } /*psdPipeSetup(nch->nch_EP0Pipe, URTF_IN|URTF_VENDOR|URTF_DEVICE, CMDID_CTRL, 0x9c, 0xb7); ioerr = psdDoPipe(nch->nch_EP0Pipe, nch->nch_Buf, 1); if(ioerr) { Printf("Error sending set freq request: %s (%ld)\n", psdNumToStr(NTS_IOERR, ioerr, "unknown"), ioerr); }*/ }