Mouse code for the MacroRat
Diff: mbed-dev/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/efr32-rf-driver/buffer-pool-memory-manager/rail_integration.c
- Revision:
- 18:6a4db94011d3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-dev/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/efr32-rf-driver/buffer-pool-memory-manager/rail_integration.c Sun May 14 23:18:57 2017 +0000 @@ -0,0 +1,35 @@ +/***************************************************************************//** + * @file rail_integration.c + * @brief Simple code to link this memory manager with a RAIL application by +* implementing the appropriate callbacks. + * @copyright Copyright 2015 Silicon Laboratories, Inc. http://www.silabs.com + ******************************************************************************/ + +#include <stdint.h> +#include "rail.h" +#include "buffer_pool_allocator.h" + +/// Rely on the pool allocator's allocate function to get memory +void *RAILCb_AllocateMemory(uint32_t size) +{ + return memoryAllocate(size); +} + +/// Use the pool allocator's free function to return the memory to the pool +void RAILCb_FreeMemory(void *ptr) +{ + memoryFree(ptr); +} + +/// Get the memory pointer for this handle and offset into it as requested +void *RAILCb_BeginWriteMemory(void *handle, + uint32_t offset, + uint32_t *available) +{ + return ((uint8_t*)memoryPtrFromHandle(handle)) + offset; +} + +/// We don't need to track the completion of a memory write so do nothing +void RAILCb_EndWriteMemory(void *handle, uint32_t offset, uint32_t size) +{ +}