if_bootcmd.c 957 B

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