Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 1 | /** |
| 2 | * This file contains functions used in USB Boot command |
| 3 | * and Boot2/FW update |
| 4 | */ |
| 5 | |
| 6 | #include <linux/delay.h> |
| 7 | #include <linux/firmware.h> |
| 8 | #include <linux/netdevice.h> |
| 9 | #include <linux/usb.h> |
| 10 | |
| 11 | #include "defs.h" |
| 12 | #include "dev.h" |
| 13 | #include "if_usb.h" |
| 14 | |
| 15 | /** |
| 16 | * @brief This function issues Boot command to the Boot2 code |
| 17 | * @param ivalue 1:Boot from FW by USB-Download |
| 18 | * 2:Boot from FW in EEPROM |
| 19 | * @return 0 |
| 20 | */ |
| 21 | int if_usb_issue_boot_command(wlan_private *priv, int ivalue) |
| 22 | { |
| 23 | struct usb_card_rec *cardp = priv->wlan_dev.card; |
| 24 | struct bootcmdstr sbootcmd; |
| 25 | int i; |
| 26 | |
| 27 | /* Prepare command */ |
| 28 | sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER; |
| 29 | sbootcmd.u8cmd_tag = ivalue; |
| 30 | for (i=0; i<11; i++) |
| 31 | sbootcmd.au8dumy[i]=0x00; |
| 32 | memcpy(cardp->bulk_out_buffer, &sbootcmd, sizeof(struct bootcmdstr)); |
| 33 | |
| 34 | /* Issue command */ |
| 35 | usb_tx_block(priv, cardp->bulk_out_buffer, sizeof(struct bootcmdstr)); |
| 36 | |
| 37 | return 0; |
| 38 | } |