mbed-os5 only for TYBLE16
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
features/netsocket/EMACMemoryManager.h@1:9db0e321a9f4, 2019-12-31 (annotated)
- Committer:
- kenjiArai
- Date:
- Tue Dec 31 06:02:27 2019 +0000
- Revision:
- 1:9db0e321a9f4
- Parent:
- 0:5b88d5760320
updated based on mbed-os5.15.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:5b88d5760320 | 1 | /* Copyright (c) 2017 ARM Limited |
kenjiArai | 0:5b88d5760320 | 2 | * |
kenjiArai | 0:5b88d5760320 | 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kenjiArai | 0:5b88d5760320 | 4 | * you may not use this file except in compliance with the License. |
kenjiArai | 0:5b88d5760320 | 5 | * You may obtain a copy of the License at |
kenjiArai | 0:5b88d5760320 | 6 | * |
kenjiArai | 0:5b88d5760320 | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
kenjiArai | 0:5b88d5760320 | 8 | * |
kenjiArai | 0:5b88d5760320 | 9 | * Unless required by applicable law or agreed to in writing, software |
kenjiArai | 0:5b88d5760320 | 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
kenjiArai | 0:5b88d5760320 | 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kenjiArai | 0:5b88d5760320 | 12 | * See the License for the specific language governing permissions and |
kenjiArai | 0:5b88d5760320 | 13 | * limitations under the License. |
kenjiArai | 0:5b88d5760320 | 14 | */ |
kenjiArai | 0:5b88d5760320 | 15 | |
kenjiArai | 0:5b88d5760320 | 16 | #ifndef EMAC_MEMORY_MANAGER_H |
kenjiArai | 0:5b88d5760320 | 17 | #define EMAC_MEMORY_MANAGER_H |
kenjiArai | 0:5b88d5760320 | 18 | |
kenjiArai | 0:5b88d5760320 | 19 | /** |
kenjiArai | 0:5b88d5760320 | 20 | * Emac interface memory manager |
kenjiArai | 0:5b88d5760320 | 21 | * |
kenjiArai | 0:5b88d5760320 | 22 | * This interface provides abstraction for memory modules used in different IP stacks (often to accommodate zero |
kenjiArai | 0:5b88d5760320 | 23 | * copy). Emac interface is required to accept output packets and provide received data using this stack- |
kenjiArai | 0:5b88d5760320 | 24 | * independent API. This header should be implemented for each IP stack, so that we keep emacs module independent. |
kenjiArai | 0:5b88d5760320 | 25 | * |
kenjiArai | 0:5b88d5760320 | 26 | * Emac memory interface uses memory buffer chains to store data. Data passed in either direction |
kenjiArai | 0:5b88d5760320 | 27 | * may be either contiguous (a single-buffer chain), or may consist of multiple buffers. |
kenjiArai | 0:5b88d5760320 | 28 | * Chaining of the buffers is made using singly-linked list. The Emac data-passing APIs do not specify |
kenjiArai | 0:5b88d5760320 | 29 | * alignment or structure of the chain in either direction. |
kenjiArai | 0:5b88d5760320 | 30 | * |
kenjiArai | 0:5b88d5760320 | 31 | * Memory buffers can be allocated either from heap or from memory pools. Heap buffers are always contiguous. |
kenjiArai | 0:5b88d5760320 | 32 | * Memory pool buffers may be either contiguous or chained depending on allocation size. |
kenjiArai | 0:5b88d5760320 | 33 | * |
kenjiArai | 0:5b88d5760320 | 34 | * On Emac interface buffer chain ownership is transferred. Emac must free buffer chain that it is given for |
kenjiArai | 0:5b88d5760320 | 35 | * link output and the stack must free the buffer chain that it is given for link input. |
kenjiArai | 0:5b88d5760320 | 36 | * |
kenjiArai | 0:5b88d5760320 | 37 | */ |
kenjiArai | 0:5b88d5760320 | 38 | |
kenjiArai | 0:5b88d5760320 | 39 | #include "nsapi.h" |
kenjiArai | 0:5b88d5760320 | 40 | #include "NetStackMemoryManager.h" |
kenjiArai | 0:5b88d5760320 | 41 | |
kenjiArai | 0:5b88d5760320 | 42 | typedef void emac_mem_buf_t; // Memory buffer |
kenjiArai | 0:5b88d5760320 | 43 | |
kenjiArai | 0:5b88d5760320 | 44 | class EMACMemoryManager : public NetStackMemoryManager { |
kenjiArai | 0:5b88d5760320 | 45 | |
kenjiArai | 0:5b88d5760320 | 46 | }; |
kenjiArai | 0:5b88d5760320 | 47 | |
kenjiArai | 0:5b88d5760320 | 48 | #endif /* EMAC_MEMORY_MANAGER_H */ |