Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private void FelWrite(byte[] buffer)
        {
            if (!isFel)
            {
                throw new InvalidOperationException("Not operating in FEL mode");
            }
            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");
            }
        }