diff --git a/hal/hal_hci/hal_usb.c b/hal/hal_hci/hal_usb.c index 7961a82..196e204 100644 --- a/hal/hal_hci/hal_usb.c +++ b/hal/hal_hci/hal_usb.c @@ -319,18 +319,9 @@ int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr) { - u8 requesttype; - u16 wvalue; - u16 index; - u16 len; + u16 wvalue = (u16)(addr & 0x0000ffff); u8 data = 0; - - requesttype = 0x01;/* read_in */ - index = 0;/* n/a */ - - wvalue = (u16)(addr & 0x0000ffff); - len = 1; /* WLANON PAGE0_REG needs to add an offset 0x8000 */ #if defined(CONFIG_RTL8710B) @@ -338,7 +329,7 @@ u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr) wvalue |= 0x8000; #endif - usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype); + usbctrl_vendorreq(pintfhdl, wvalue, 0, &data, 1, VENDOR_READ); return data; @@ -346,26 +337,16 @@ u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr) u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr) { - u8 requesttype; - u16 wvalue; - u16 index; - u16 len; - u16 data = 0; + u16 wvalue = (u16)(addr & 0x0000ffff); + u16 data; - - requesttype = 0x01;/* read_in */ - index = 0;/* n/a */ - - wvalue = (u16)(addr & 0x0000ffff); - len = 2; - /* WLANON PAGE0_REG needs to add an offset 0x8000 */ #if defined(CONFIG_RTL8710B) if(wvalue >= 0x0000 && wvalue < 0x0100) wvalue |= 0x8000; #endif - usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype); + usbctrl_vendorreq(pintfhdl, wvalue, 0, &data, 2, VENDOR_READ); return data; @@ -374,18 +355,8 @@ u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr) u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) { - u8 requesttype; - u16 wvalue; - u16 index; - u16 len; - u32 data = 0; - - - requesttype = 0x01;/* read_in */ - index = 0;/* n/a */ - - wvalue = (u16)(addr & 0x0000ffff); - len = 4; + u16 wvalue = (u16)(addr & 0x0000ffff); + u32 data; /* WLANON PAGE0_REG needs to add an offset 0x8000 */ #if defined(CONFIG_RTL8710B) @@ -393,7 +364,7 @@ u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) wvalue |= 0x8000; #endif - usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype); + usbctrl_vendorreq(pintfhdl, wvalue, 0, &data, 4, VENDOR_READ); return data;