dfu: Fix warnings.
This commit is contained in:
parent
d4411fc51f
commit
61d464bf09
|
@ -121,13 +121,19 @@ static const char *usb_strings[] = {
|
||||||
DFU_IFACE_STRING,
|
DFU_IFACE_STRING,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static u32 get_le32(const void *vp)
|
||||||
|
{
|
||||||
|
const u8 *p = vp;
|
||||||
|
return ((u32)p[3] << 24) + ((u32)p[2] << 16) + (p[1] << 8) + p[0];
|
||||||
|
}
|
||||||
|
|
||||||
static u8 usbdfu_getstatus(u32 *bwPollTimeout)
|
static u8 usbdfu_getstatus(u32 *bwPollTimeout)
|
||||||
{
|
{
|
||||||
switch(usbdfu_state) {
|
switch(usbdfu_state) {
|
||||||
case STATE_DFU_DNLOAD_SYNC:
|
case STATE_DFU_DNLOAD_SYNC:
|
||||||
usbdfu_state = STATE_DFU_DNBUSY;
|
usbdfu_state = STATE_DFU_DNBUSY;
|
||||||
*bwPollTimeout = dfu_poll_timeout(prog.buf[0],
|
*bwPollTimeout = dfu_poll_timeout(prog.buf[0],
|
||||||
*(u32 *)(prog.buf + 1),
|
get_le32(prog.buf + 1),
|
||||||
prog.blocknum);
|
prog.blocknum);
|
||||||
return DFU_STATUS_OK;
|
return DFU_STATUS_OK;
|
||||||
|
|
||||||
|
@ -151,7 +157,7 @@ usbdfu_getstatus_complete(usbd_device *dev, struct usb_setup_data *req)
|
||||||
|
|
||||||
flash_unlock();
|
flash_unlock();
|
||||||
if(prog.blocknum == 0) {
|
if(prog.blocknum == 0) {
|
||||||
u32 addr = *(u32 *)(prog.buf + 1);
|
u32 addr = get_le32(prog.buf + 1);
|
||||||
if (addr < APP_ADDRESS ||
|
if (addr < APP_ADDRESS ||
|
||||||
(addr >= max_address)) {
|
(addr >= max_address)) {
|
||||||
flash_lock();
|
flash_lock();
|
||||||
|
|
Loading…
Reference in New Issue