if_bootcmd.c 925 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include "defs.h"
  10. #include "dev.h"
  11. #include "if_usb.h"
  12. /**
  13. * @brief This function issues Boot command to the Boot2 code
  14. * @param ivalue 1:Boot from FW by USB-Download
  15. * 2:Boot from FW in EEPROM
  16. * @return 0
  17. */
  18. int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
  19. {
  20. struct usb_card_rec *cardp = priv->wlan_dev.card;
  21. struct bootcmdstr sbootcmd;
  22. int i;
  23. /* Prepare command */
  24. sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER;
  25. sbootcmd.u8cmd_tag = ivalue;
  26. for (i=0; i<11; i++)
  27. sbootcmd.au8dumy[i]=0x00;
  28. memcpy(cardp->bulk_out_buffer, &sbootcmd, sizeof(struct bootcmdstr));
  29. /* Issue command */
  30. usb_tx_block(priv, cardp->bulk_out_buffer, sizeof(struct bootcmdstr));
  31. return 0;
  32. }