Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /***************************************************************************//**
sahilmgandhi 18:6a4db94011d3 2 * @file rail_integration.c
sahilmgandhi 18:6a4db94011d3 3 * @brief Simple code to link this memory manager with a RAIL application by
sahilmgandhi 18:6a4db94011d3 4 * implementing the appropriate callbacks.
sahilmgandhi 18:6a4db94011d3 5 * @copyright Copyright 2015 Silicon Laboratories, Inc. http://www.silabs.com
sahilmgandhi 18:6a4db94011d3 6 ******************************************************************************/
sahilmgandhi 18:6a4db94011d3 7
sahilmgandhi 18:6a4db94011d3 8 #include <stdint.h>
sahilmgandhi 18:6a4db94011d3 9 #include "rail.h"
sahilmgandhi 18:6a4db94011d3 10 #include "buffer_pool_allocator.h"
sahilmgandhi 18:6a4db94011d3 11
sahilmgandhi 18:6a4db94011d3 12 /// Rely on the pool allocator's allocate function to get memory
sahilmgandhi 18:6a4db94011d3 13 void *RAILCb_AllocateMemory(uint32_t size)
sahilmgandhi 18:6a4db94011d3 14 {
sahilmgandhi 18:6a4db94011d3 15 return memoryAllocate(size);
sahilmgandhi 18:6a4db94011d3 16 }
sahilmgandhi 18:6a4db94011d3 17
sahilmgandhi 18:6a4db94011d3 18 /// Use the pool allocator's free function to return the memory to the pool
sahilmgandhi 18:6a4db94011d3 19 void RAILCb_FreeMemory(void *ptr)
sahilmgandhi 18:6a4db94011d3 20 {
sahilmgandhi 18:6a4db94011d3 21 memoryFree(ptr);
sahilmgandhi 18:6a4db94011d3 22 }
sahilmgandhi 18:6a4db94011d3 23
sahilmgandhi 18:6a4db94011d3 24 /// Get the memory pointer for this handle and offset into it as requested
sahilmgandhi 18:6a4db94011d3 25 void *RAILCb_BeginWriteMemory(void *handle,
sahilmgandhi 18:6a4db94011d3 26 uint32_t offset,
sahilmgandhi 18:6a4db94011d3 27 uint32_t *available)
sahilmgandhi 18:6a4db94011d3 28 {
sahilmgandhi 18:6a4db94011d3 29 return ((uint8_t*)memoryPtrFromHandle(handle)) + offset;
sahilmgandhi 18:6a4db94011d3 30 }
sahilmgandhi 18:6a4db94011d3 31
sahilmgandhi 18:6a4db94011d3 32 /// We don't need to track the completion of a memory write so do nothing
sahilmgandhi 18:6a4db94011d3 33 void RAILCb_EndWriteMemory(void *handle, uint32_t offset, uint32_t size)
sahilmgandhi 18:6a4db94011d3 34 {
sahilmgandhi 18:6a4db94011d3 35 }