QualcommHeader1.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. *====================================================================*/
  8. /*====================================================================*
  9. *
  10. * signed QualcommHeader1 (struct qualcomm_fmi * header, uint8_t MMV, uint16_t MMTYPE, uint16_tFMI);
  11. *
  12. * mme.h
  13. *
  14. * Encode memory with an Atheros vendor specific message header
  15. * having HomePlug message protocol version (INTELLON_MMV) and
  16. * Atheros message type (MMTYPE);
  17. *
  18. * return the number of bytes actually encoded or 0 on encode error;
  19. * the error code is stored in errno;
  20. *
  21. * see the INT6000 Firmware Technical Reference Manual for more
  22. * about MME headers and message types; the Atheros OUI is
  23. * implicit in this function;
  24. *
  25. * MMV is the version number of the MME command set; currently,
  26. * there is only one command set for Atheros MMEs;
  27. *
  28. * MMTYPE indicates the desired Atheros device operation taken
  29. * from the TRM; some operations are undocumented and should not
  30. * be used;
  31. *
  32. * OUI is the Organizationally Unique Identifier resgistered with
  33. * the IEEE by the vendor and is a constant for Atheros Devices;
  34. *
  35. * There is no need to flush the header since this function writes
  36. * to all locations unless there is an error; the caller may elect
  37. * to flush the buffer before calling this function;
  38. *
  39. * Contributor(s):
  40. * Charles Maier <cmaier@qca.qualcomm.com>
  41. *
  42. *--------------------------------------------------------------------*/
  43. #ifndef QUALCOMMHEADER1_SOURCE
  44. #define QUALCOMMHEADER1_SOURCE
  45. #include <stdint.h>
  46. #include <memory.h>
  47. #include "../tools/endian.h"
  48. #include "../mme/mme.h"
  49. signed QualcommHeader1 (struct qualcomm_fmi * header, uint8_t MMV, uint16_t MMTYPE)
  50. {
  51. header->MMV = MMV;
  52. header->MMTYPE = HTOLE16 (MMTYPE);
  53. header->FMSN = 0;
  54. header->FMID = 0;
  55. header->OUI [0] = 0x00;
  56. header->OUI [1] = 0xB0;
  57. header->OUI [2] = 0x52;
  58. return (sizeof (* header));
  59. }
  60. #endif