예제 #1
0
        private void FelWrite(byte[] buffer)
        {
            var req = new AWUSBRequest();

            req.Cmd = AWUSBRequest.RequestType.AW_USB_WRITE;
            req.Len = (uint)buffer.Length;
            WriteToUSB(req.Data);
            WriteToUSB(buffer);
            var resp = new AWUSBResponse(ReadFromUSB(13));

            if (resp.CswStatus != 0)
            {
                throw new FelException("FEL write error");
            }
        }
예제 #2
0
        private byte[] FelRead(UInt32 length)
        {
            var req = new AWUSBRequest();

            req.Cmd = AWUSBRequest.RequestType.AW_USB_READ;
            req.Len = length;
            WriteToUSB(req.Data);

            var result = ReadFromUSB(length);
            var resp   = new AWUSBResponse(ReadFromUSB(13));

            if (resp.CswStatus != 0)
            {
                throw new FelException("FEL read error");
            }
            return(result);
        }