Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /* mbed Microcontroller Library
switches 0:5c4d7b2438d3 2 * Copyright (c) 2016 ARM Limited
switches 0:5c4d7b2438d3 3 *
switches 0:5c4d7b2438d3 4 * Licensed under the Apache License, Version 2.0 (the "License");
switches 0:5c4d7b2438d3 5 * you may not use this file except in compliance with the License.
switches 0:5c4d7b2438d3 6 * You may obtain a copy of the License at
switches 0:5c4d7b2438d3 7 *
switches 0:5c4d7b2438d3 8 * http://www.apache.org/licenses/LICENSE-2.0
switches 0:5c4d7b2438d3 9 *
switches 0:5c4d7b2438d3 10 * Unless required by applicable law or agreed to in writing, software
switches 0:5c4d7b2438d3 11 * distributed under the License is distributed on an "AS IS" BASIS,
switches 0:5c4d7b2438d3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:5c4d7b2438d3 13 * See the License for the specific language governing permissions and
switches 0:5c4d7b2438d3 14 * limitations under the License.
switches 0:5c4d7b2438d3 15 */
switches 0:5c4d7b2438d3 16 #ifndef MBED_EMAC_STACK_MEM_H
switches 0:5c4d7b2438d3 17 #define MBED_EMAC_STACK_MEM_H
switches 0:5c4d7b2438d3 18
switches 0:5c4d7b2438d3 19 #if DEVICE_EMAC
switches 0:5c4d7b2438d3 20
switches 0:5c4d7b2438d3 21 #include <stdint.h>
switches 0:5c4d7b2438d3 22
switches 0:5c4d7b2438d3 23 /**
switches 0:5c4d7b2438d3 24 * Stack memory module
switches 0:5c4d7b2438d3 25 *
switches 0:5c4d7b2438d3 26 * This interface provides abstraction for memory modules used in different IP stacks (often to accommodate zero copy).
switches 0:5c4d7b2438d3 27 * Emac interface may be required to accept output packets and provide received data using this stack specific API.
switches 0:5c4d7b2438d3 28 * This header should be implemented for each IP stack, so that we keep emacs module independent.
switches 0:5c4d7b2438d3 29 */
switches 0:5c4d7b2438d3 30 typedef void emac_stack_mem_t;
switches 0:5c4d7b2438d3 31 typedef void emac_stack_mem_chain_t;
switches 0:5c4d7b2438d3 32 typedef void emac_stack_t;
switches 0:5c4d7b2438d3 33
switches 0:5c4d7b2438d3 34 /**
switches 0:5c4d7b2438d3 35 * Allocates stack memory
switches 0:5c4d7b2438d3 36 *
switches 0:5c4d7b2438d3 37 * @param stack Emac stack context
switches 0:5c4d7b2438d3 38 * @param size Size of memory to allocate
switches 0:5c4d7b2438d3 39 * @param align Memory alignment requirements
switches 0:5c4d7b2438d3 40 * @return Allocated memory struct, or NULL in case of error
switches 0:5c4d7b2438d3 41 */
switches 0:5c4d7b2438d3 42 emac_stack_mem_t *emac_stack_mem_alloc(emac_stack_t* stack, uint32_t size, uint32_t align);
switches 0:5c4d7b2438d3 43
switches 0:5c4d7b2438d3 44 /**
switches 0:5c4d7b2438d3 45 * Free memory allocated using @a stack_mem_alloc
switches 0:5c4d7b2438d3 46 *
switches 0:5c4d7b2438d3 47 * @param stack Emac stack context
switches 0:5c4d7b2438d3 48 * @param mem Memory to be freed
switches 0:5c4d7b2438d3 49 */
switches 0:5c4d7b2438d3 50 void emac_stack_mem_free(emac_stack_t* stack, emac_stack_mem_t *mem);
switches 0:5c4d7b2438d3 51
switches 0:5c4d7b2438d3 52 /**
switches 0:5c4d7b2438d3 53 * Copy memory
switches 0:5c4d7b2438d3 54 *
switches 0:5c4d7b2438d3 55 * @param stack Emac stack context
switches 0:5c4d7b2438d3 56 * @param to Memory to copy to
switches 0:5c4d7b2438d3 57 * @param from Memory to copy from
switches 0:5c4d7b2438d3 58 */
switches 0:5c4d7b2438d3 59 void emac_stack_mem_copy(emac_stack_t* stack, emac_stack_mem_t *to, emac_stack_mem_t *from);
switches 0:5c4d7b2438d3 60
switches 0:5c4d7b2438d3 61 /**
switches 0:5c4d7b2438d3 62 * Return pointer to the payload
switches 0:5c4d7b2438d3 63 *
switches 0:5c4d7b2438d3 64 * @param stack Emac stack context
switches 0:5c4d7b2438d3 65 * @param mem Memory structure
switches 0:5c4d7b2438d3 66 * @return Pointer to the payload
switches 0:5c4d7b2438d3 67 */
switches 0:5c4d7b2438d3 68 void *emac_stack_mem_ptr(emac_stack_t* stack, emac_stack_mem_t *mem);
switches 0:5c4d7b2438d3 69
switches 0:5c4d7b2438d3 70 /**
switches 0:5c4d7b2438d3 71 * Return actual payload size
switches 0:5c4d7b2438d3 72 *
switches 0:5c4d7b2438d3 73 * @param stack Emac stack context
switches 0:5c4d7b2438d3 74 * @param mem Memory structure
switches 0:5c4d7b2438d3 75 * @return Size in bytes
switches 0:5c4d7b2438d3 76 */
switches 0:5c4d7b2438d3 77 uint32_t emac_stack_mem_len(emac_stack_t* stack, emac_stack_mem_t *mem);
switches 0:5c4d7b2438d3 78
switches 0:5c4d7b2438d3 79 /**
switches 0:5c4d7b2438d3 80 * Sets the actual payload size (the allocated payload size will not change)
switches 0:5c4d7b2438d3 81 *
switches 0:5c4d7b2438d3 82 * @param stack Emac stack context
switches 0:5c4d7b2438d3 83 * @param mem Memory structure
switches 0:5c4d7b2438d3 84 * @param len Actual payload size
switches 0:5c4d7b2438d3 85 */
switches 0:5c4d7b2438d3 86 void emac_stack_mem_set_len(emac_stack_t* stack, emac_stack_mem_t *mem, uint32_t len);
switches 0:5c4d7b2438d3 87
switches 0:5c4d7b2438d3 88 /**
switches 0:5c4d7b2438d3 89 * Returns first memory structure from the list and move the head to point to the next node
switches 0:5c4d7b2438d3 90 *
switches 0:5c4d7b2438d3 91 * @param stack Emac stack context
switches 0:5c4d7b2438d3 92 * @param list Pointer to the list
switches 0:5c4d7b2438d3 93 * @return First memory structure from the list
switches 0:5c4d7b2438d3 94 */
switches 0:5c4d7b2438d3 95 emac_stack_mem_t *emac_stack_mem_chain_dequeue(emac_stack_t* stack, emac_stack_mem_chain_t **chain);
switches 0:5c4d7b2438d3 96
switches 0:5c4d7b2438d3 97 /**
switches 0:5c4d7b2438d3 98 * Return total length of the memory chain
switches 0:5c4d7b2438d3 99 *
switches 0:5c4d7b2438d3 100 * @param stack Emac stack context
switches 0:5c4d7b2438d3 101 * @param chain Memory chain
switches 0:5c4d7b2438d3 102 * @return Chain length
switches 0:5c4d7b2438d3 103 */
switches 0:5c4d7b2438d3 104 uint32_t emac_stack_mem_chain_len(emac_stack_t* stack, emac_stack_mem_chain_t *chain);
switches 0:5c4d7b2438d3 105
switches 0:5c4d7b2438d3 106 /**
switches 0:5c4d7b2438d3 107 * Increases the reference counter for the memory
switches 0:5c4d7b2438d3 108 *
switches 0:5c4d7b2438d3 109 * @param stack Emac stack context
switches 0:5c4d7b2438d3 110 * @param mem Memory structure
switches 0:5c4d7b2438d3 111 */
switches 0:5c4d7b2438d3 112 void emac_stack_mem_ref(emac_stack_t* stack, emac_stack_mem_t *mem);
switches 0:5c4d7b2438d3 113
switches 0:5c4d7b2438d3 114 #endif /* DEVICE_EMAC */
switches 0:5c4d7b2438d3 115
switches 0:5c4d7b2438d3 116 #endif /* EMAC_MBED_STACK_MEM_h */