QualcommHeader.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. *====================================================================*/
  8. /*====================================================================*
  9. *
  10. * signed QualcommHeader (struct qualcomm_hdr * header, uint8_t MMV, uint16_t MMTYPE);
  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. * MMTYPE indicates the desired Atheros device operation taken
  22. * from the TRM; some operations are undocumented and should not
  23. * be used;
  24. *
  25. * OUI is the Organizationally Unique Identifier resgistered with
  26. * the IEEE by the vendor and is a constant for Atheros Devices;
  27. *
  28. * There is no need to flush the header since this function writes
  29. * to all locations unless there is an error; the caller may elect
  30. * to flush the buffer before calling this function;
  31. *
  32. * Contributor(s):
  33. * Charles Maier <cmaier@qca.qualcomm.com>
  34. *
  35. *--------------------------------------------------------------------*/
  36. #ifndef QUALCOMMHEADER_SOURCE
  37. #define QUALCOMMHEADER_SOURCE
  38. #include <stdint.h>
  39. #include "../mme/mme.h"
  40. #include "../tools/endian.h"
  41. signed QualcommHeader (struct qualcomm_hdr * header, uint8_t MMV, uint16_t MMTYPE)
  42. {
  43. header->MMV = MMV;
  44. header->MMTYPE = HTOLE16 (MMTYPE);
  45. header->OUI [0] = 0x00;
  46. header->OUI [1] = 0xB0;
  47. header->OUI [2] = 0x52;
  48. return (sizeof (* header));
  49. }
  50. #endif