pibscalers.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. *====================================================================*/
  8. /*====================================================================*
  9. *
  10. * uint16_t pibscalers (struct _file_ * pib);
  11. *
  12. * return the number of scalers (carriers) based on the FWVERSION
  13. * stored in a .pib file; this function is a fix so that older
  14. * toolkit programs will work with newer chipsets;
  15. *
  16. * old chipsets support 1155 carriers; new chipsets support 2880
  17. * carriers;
  18. *
  19. *
  20. *--------------------------------------------------------------------*/
  21. #ifndef PIBSCALERS_SOURCE
  22. #define PIBSCALERS_SOURCE
  23. #include <unistd.h>
  24. #include <errno.h>
  25. #include "../plc/plc.h"
  26. #include "../pib/pib.h"
  27. #include "../tools/error.h"
  28. uint16_t pibscalers (struct _file_ * pib)
  29. {
  30. struct pib_header pib_header;
  31. if (read (pib->file, & pib_header, sizeof (pib_header)) != sizeof (pib_header))
  32. {
  33. error (1, errno, "%s", pib->name);
  34. }
  35. if (pib_header.FWVERSION < 0x05)
  36. {
  37. return (INT_CARRIERS);
  38. }
  39. return (AMP_CARRIERS);
  40. }
  41. #endif