Caching the advertising data and the scan response.
Fork of MaximBLE by
exactLE/wsf/include/wsf_buf.h@0:b562096246b3, 2016-03-03 (annotated)
- Committer:
- enginerd
- Date:
- Thu Mar 03 14:13:21 2016 +0000
- Revision:
- 0:b562096246b3
Initial commit of Maxim Integrated Bluetooth LE Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
enginerd | 0:b562096246b3 | 1 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 2 | /*! |
enginerd | 0:b562096246b3 | 3 | * \file wsf_buf.h |
enginerd | 0:b562096246b3 | 4 | * |
enginerd | 0:b562096246b3 | 5 | * \brief Buffer pool service. |
enginerd | 0:b562096246b3 | 6 | * |
enginerd | 0:b562096246b3 | 7 | * $Date: 2013-05-13 15:20:24 -0700 (Mon, 13 May 2013) $ |
enginerd | 0:b562096246b3 | 8 | * $Revision: 612 $ |
enginerd | 0:b562096246b3 | 9 | * |
enginerd | 0:b562096246b3 | 10 | * Copyright (c) 2009-2016 ARM Limited. All rights reserved. |
enginerd | 0:b562096246b3 | 11 | * |
enginerd | 0:b562096246b3 | 12 | * SPDX-License-Identifier: LicenseRef-PBL |
enginerd | 0:b562096246b3 | 13 | * |
enginerd | 0:b562096246b3 | 14 | * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use |
enginerd | 0:b562096246b3 | 15 | * this file except in compliance with the License. You may obtain a copy of the License at |
enginerd | 0:b562096246b3 | 16 | * |
enginerd | 0:b562096246b3 | 17 | * https://www.mbed.com/licenses/PBL-1.0 |
enginerd | 0:b562096246b3 | 18 | * |
enginerd | 0:b562096246b3 | 19 | * See the License for the specific language governing permissions and limitations under the License. |
enginerd | 0:b562096246b3 | 20 | */ |
enginerd | 0:b562096246b3 | 21 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 22 | #ifndef WSF_BUF_H |
enginerd | 0:b562096246b3 | 23 | #define WSF_BUF_H |
enginerd | 0:b562096246b3 | 24 | |
enginerd | 0:b562096246b3 | 25 | #ifdef __cplusplus |
enginerd | 0:b562096246b3 | 26 | extern "C" { |
enginerd | 0:b562096246b3 | 27 | #endif |
enginerd | 0:b562096246b3 | 28 | |
enginerd | 0:b562096246b3 | 29 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 30 | Macros |
enginerd | 0:b562096246b3 | 31 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 32 | |
enginerd | 0:b562096246b3 | 33 | /*! Length of the buffer statistics array */ |
enginerd | 0:b562096246b3 | 34 | #define WSF_BUF_STATS_MAX_LEN 128 |
enginerd | 0:b562096246b3 | 35 | |
enginerd | 0:b562096246b3 | 36 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 37 | Data Types |
enginerd | 0:b562096246b3 | 38 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 39 | |
enginerd | 0:b562096246b3 | 40 | /*! Buffer pool descriptor structure */ |
enginerd | 0:b562096246b3 | 41 | typedef struct |
enginerd | 0:b562096246b3 | 42 | { |
enginerd | 0:b562096246b3 | 43 | uint16_t len; /*! length of buffers in pool */ |
enginerd | 0:b562096246b3 | 44 | uint8_t num; /*! number of buffers in pool */ |
enginerd | 0:b562096246b3 | 45 | } wsfBufPoolDesc_t; |
enginerd | 0:b562096246b3 | 46 | |
enginerd | 0:b562096246b3 | 47 | |
enginerd | 0:b562096246b3 | 48 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 49 | Function Declarations |
enginerd | 0:b562096246b3 | 50 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 51 | |
enginerd | 0:b562096246b3 | 52 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 53 | /*! |
enginerd | 0:b562096246b3 | 54 | * \fn WsfBufInit |
enginerd | 0:b562096246b3 | 55 | * |
enginerd | 0:b562096246b3 | 56 | * \brief Initialize the buffer pool service. This function should only be called once |
enginerd | 0:b562096246b3 | 57 | * upon system initialization. |
enginerd | 0:b562096246b3 | 58 | * |
enginerd | 0:b562096246b3 | 59 | * \param bufMemLen Length in bytes of memory pointed to by pBufMem. |
enginerd | 0:b562096246b3 | 60 | * \param pBufMem Memory in which to store the pools used by the buffer pool service. |
enginerd | 0:b562096246b3 | 61 | * \param numPools Number of buffer pools. |
enginerd | 0:b562096246b3 | 62 | * \param pDesc Array of buffer pool descriptors, one for each pool. |
enginerd | 0:b562096246b3 | 63 | * |
enginerd | 0:b562096246b3 | 64 | * \return TRUE if initialization was successful, FALSE otherwise. |
enginerd | 0:b562096246b3 | 65 | */ |
enginerd | 0:b562096246b3 | 66 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 67 | bool_t WsfBufInit(uint16_t bufMemLen, uint8_t *pBufMem, uint8_t numPools, wsfBufPoolDesc_t *pDesc); |
enginerd | 0:b562096246b3 | 68 | |
enginerd | 0:b562096246b3 | 69 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 70 | /*! |
enginerd | 0:b562096246b3 | 71 | * \fn WsfBufAlloc |
enginerd | 0:b562096246b3 | 72 | * |
enginerd | 0:b562096246b3 | 73 | * \brief Allocate a buffer. |
enginerd | 0:b562096246b3 | 74 | * |
enginerd | 0:b562096246b3 | 75 | * \param len Length of buffer to allocate. |
enginerd | 0:b562096246b3 | 76 | * |
enginerd | 0:b562096246b3 | 77 | * \return Pointer to allocated buffer or NULL if allocation fails. |
enginerd | 0:b562096246b3 | 78 | */ |
enginerd | 0:b562096246b3 | 79 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 80 | void *WsfBufAlloc(uint16_t len); |
enginerd | 0:b562096246b3 | 81 | |
enginerd | 0:b562096246b3 | 82 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 83 | /*! |
enginerd | 0:b562096246b3 | 84 | * \fn WsfBufFree |
enginerd | 0:b562096246b3 | 85 | * |
enginerd | 0:b562096246b3 | 86 | * \brief Free a buffer. |
enginerd | 0:b562096246b3 | 87 | * |
enginerd | 0:b562096246b3 | 88 | * \param pBuf Buffer to free. |
enginerd | 0:b562096246b3 | 89 | * |
enginerd | 0:b562096246b3 | 90 | * \return None. |
enginerd | 0:b562096246b3 | 91 | */ |
enginerd | 0:b562096246b3 | 92 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 93 | void WsfBufFree(void *pBuf); |
enginerd | 0:b562096246b3 | 94 | |
enginerd | 0:b562096246b3 | 95 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 96 | /*! |
enginerd | 0:b562096246b3 | 97 | * \fn WsfBufGetMaxAlloc |
enginerd | 0:b562096246b3 | 98 | * |
enginerd | 0:b562096246b3 | 99 | * \brief Diagnostic function to get maximum allocated buffers from a pool. |
enginerd | 0:b562096246b3 | 100 | * |
enginerd | 0:b562096246b3 | 101 | * \param pool Buffer pool number. |
enginerd | 0:b562096246b3 | 102 | * |
enginerd | 0:b562096246b3 | 103 | * \return Number of allocated buffers. |
enginerd | 0:b562096246b3 | 104 | */ |
enginerd | 0:b562096246b3 | 105 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 106 | uint8_t WsfBufGetMaxAlloc(uint8_t pool); |
enginerd | 0:b562096246b3 | 107 | |
enginerd | 0:b562096246b3 | 108 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 109 | /*! |
enginerd | 0:b562096246b3 | 110 | * \fn WsfBufGetNumAlloc |
enginerd | 0:b562096246b3 | 111 | * |
enginerd | 0:b562096246b3 | 112 | * \brief Diagnostic function to get the number of currently allocated buffers in a pool. |
enginerd | 0:b562096246b3 | 113 | * |
enginerd | 0:b562096246b3 | 114 | * \param pool Buffer pool number. |
enginerd | 0:b562096246b3 | 115 | * |
enginerd | 0:b562096246b3 | 116 | * \return Number of allocated buffers. |
enginerd | 0:b562096246b3 | 117 | */ |
enginerd | 0:b562096246b3 | 118 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 119 | uint8_t WsfBufGetNumAlloc(uint8_t pool); |
enginerd | 0:b562096246b3 | 120 | |
enginerd | 0:b562096246b3 | 121 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 122 | /*! |
enginerd | 0:b562096246b3 | 123 | * \fn WsfBufGetAllocStats |
enginerd | 0:b562096246b3 | 124 | * |
enginerd | 0:b562096246b3 | 125 | * \brief Diagnostic function to get the buffer allocation statistics. |
enginerd | 0:b562096246b3 | 126 | * |
enginerd | 0:b562096246b3 | 127 | * \return Buffer allocation statistics array. |
enginerd | 0:b562096246b3 | 128 | */ |
enginerd | 0:b562096246b3 | 129 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 130 | uint8_t *WsfBufGetAllocStats(void); |
enginerd | 0:b562096246b3 | 131 | |
enginerd | 0:b562096246b3 | 132 | |
enginerd | 0:b562096246b3 | 133 | #ifdef __cplusplus |
enginerd | 0:b562096246b3 | 134 | }; |
enginerd | 0:b562096246b3 | 135 | #endif |
enginerd | 0:b562096246b3 | 136 | |
enginerd | 0:b562096246b3 | 137 | #endif /* WSF_BUF_H */ |