mac_high_level.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**************************************************************************************************
  2. Filename: mac_high_level.h
  3. Revised: $Date: 2011-02-28 16:59:59 -0800 (Mon, 28 Feb 2011) $
  4. Revision: $Revision: 25230 $
  5. Description: Contains interfaces shared between high and low level MAC.
  6. Copyright 2006-2010 Texas Instruments Incorporated. All rights reserved.
  7. IMPORTANT: Your use of this Software is limited to those specific rights
  8. granted under the terms of a software license agreement between the user
  9. who downloaded the software, his/her employer (which must be your employer)
  10. and Texas Instruments Incorporated (the "License"). You may not use this
  11. Software unless you agree to abide by the terms of the License. The License
  12. limits your use, and you acknowledge, that the Software may not be modified,
  13. copied or distributed unless embedded on a Texas Instruments microcontroller
  14. or used solely and exclusively in conjunction with a Texas Instruments radio
  15. frequency transceiver, which is integrated into your product. Other than for
  16. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  17. works of, modify, distribute, perform, display or sell this Software and/or
  18. its documentation for any purpose.
  19. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  20. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  21. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  22. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  23. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  24. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  25. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  26. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  27. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  28. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  29. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  30. Should you have any questions regarding your right to use this Software,
  31. contact Texas Instruments Incorporated at www.TI.com.
  32. **************************************************************************************************/
  33. #ifndef MAC_HIGH_LEVEL_H
  34. #define MAC_HIGH_LEVEL_H
  35. /* ------------------------------------------------------------------------------------------------
  36. * Includes
  37. * ------------------------------------------------------------------------------------------------
  38. */
  39. #include "mac_api.h"
  40. /* ------------------------------------------------------------------------------------------------
  41. * Macros
  42. * ------------------------------------------------------------------------------------------------
  43. */
  44. #ifndef MAC_INTERNAL_API
  45. #define MAC_INTERNAL_API
  46. #endif
  47. /* ------------------------------------------------------------------------------------------------
  48. * Constants
  49. * ------------------------------------------------------------------------------------------------
  50. */
  51. /* RX flag masks */
  52. #define MAC_RX_FLAG_VERSION 0x03 /* received frame's version */
  53. #define MAC_RX_FLAG_ACK_PENDING 0x04 /* outgoing ACK has pending bit set */
  54. #define MAC_RX_FLAG_SECURITY 0x08 /* received frame has security bit set */
  55. #define MAC_RX_FLAG_PENDING 0x10 /* received frame has pending bit set */
  56. #define MAC_RX_FLAG_ACK_REQUEST 0x20 /* received frame has ack request bit set */
  57. #define MAC_RX_FLAG_INTRA_PAN 0x40 /* received frame has intra pan fcf bit set */
  58. #define MAC_RX_FLAG_CRC_OK 0x80 /* received frame CRC OK bit */
  59. /* ------------------------------------------------------------------------------------------------
  60. * Typedefs
  61. * ------------------------------------------------------------------------------------------------
  62. */
  63. /* Structure for internal data tx */
  64. typedef struct
  65. {
  66. macEventHdr_t hdr;
  67. sData_t msdu;
  68. macTxIntData_t internal;
  69. macSec_t sec;
  70. } macTx_t;
  71. /* Structure for internal data rx */
  72. typedef struct
  73. {
  74. macEventHdr_t hdr;
  75. sData_t msdu;
  76. macRxIntData_t internal;
  77. macSec_t sec;
  78. macDataInd_t mac;
  79. sData_t mhr;
  80. } macRx_t;
  81. /* Function pointer for the 16 byte random seed callback */
  82. typedef void (*macRNGFcn_t )(uint8* seed);
  83. /* ------------------------------------------------------------------------------------------------
  84. * Global Variables
  85. * ------------------------------------------------------------------------------------------------
  86. */
  87. /* pointer to current tx frame */
  88. extern macTx_t *pMacDataTx;
  89. /* TRUE if operating as a PAN coordinator */
  90. extern bool macPanCoordinator;
  91. /* ------------------------------------------------------------------------------------------------
  92. * Function Prototypes
  93. * ------------------------------------------------------------------------------------------------
  94. */
  95. /* functions located in mac_data.c */
  96. MAC_INTERNAL_API uint8 *macDataRxMemAlloc(uint16 len);
  97. MAC_INTERNAL_API uint8 macDataRxMemFree(uint8 **pMsg);
  98. MAC_INTERNAL_API uint8 macDataTxTimeAvailable(void);
  99. /**************************************************************************************************
  100. */
  101. #endif /* MAC_HIGH_LEVEL_H */