rayddteam

Untitled

Dec 5th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff -r a7c552e1ed7f head/sys/dev/flash/mx25l.c
  2. --- a/head/sys/dev/flash/mx25l.c Wed Dec 05 12:37:28 2012 +0200
  3. +++ b/head/sys/dev/flash/mx25l.c Wed Dec 05 13:42:00 2012 +0200
  4. @@ -231,7 +231,7 @@
  5. uint8_t txBuf[4];//, rxBuf[4];
  6. uint8_t status;
  7. struct spi_command cmd;
  8. - int err;
  9. + int err, timeout;
  10.  
  11. sc = device_get_softc(dev);
  12.  
  13. @@ -246,9 +246,15 @@
  14. cmd.tx_cmd_sz = 1;
  15. err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd);
  16.  
  17. - status = mx25l_get_status(dev);
  18. -
  19. - if (writable && !(status & STATUS_WEL))
  20. + timeout = 1000;
  21. + while (timeout--) {
  22. + status = mx25l_get_status(dev);
  23. + if (writable && (status & STATUS_WEL))
  24. + break;
  25. + if (!writable && !(status & STATUS_WEL))
  26. + break;
  27. + }
  28. + if (timeout == 0)
  29. device_printf(dev, "%s - fail\n", __func__);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment