/** * @file rm_osal.h * * @brief * This is the sample OS Adaptation layer which is used by the RM low level * driver. The OSAL layer can be ported in either of the following * manners to a native OS: * * Approach 1: * @n Use Prebuilt Libraries * - Ensure that the provide an implementation of all * Osal_XXX API for their native OS. * - Link the prebuilt libraries with their application. * - Refer to the "example" directory for an example of this * @n Pros: * - Customers can reuse prebuilt TI provided libraries * @n Cons: * - Level of indirection in the API to get to the actual OS call * * Approach 2: * @n Rebuilt Library * - Create a copy of this file and modify it to directly * inline the native OS calls * - Rebuild the RM low level drivver library; ensure that the Include * path points to the directory where the copy of this file * has been provided. * - Please refer to the "test" directory for an example of this * @n Pros: * - Optimizations can be done to remove the level of indirection * @n Cons: * - RM LLD Libraries need to be rebuilt by the customer. * * \par * NOTE: * (C) Copyright 2012 Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * \par */ #ifndef __RM_OSAL_H__ #define __RM_OSAL_H__ /** @addtogroup RM_LLD_OSAL @{ */ /********************************************************************** ************************* Extern Declarations ************************ **********************************************************************/ /* #include is here because there used to be * memcpy/memset prototypes here. This #include prevents warnings in * other code that unintentionally worked because of these prototypes */ #include #include extern void* Osal_rmMalloc (uint32_t num_bytes); extern void Osal_rmFree (void *ptr, uint32_t size); extern void* Osal_rmCsEnter (void); extern void Osal_rmCsExit (void *CsHandle); extern void* Osal_rmMtCsEnter (void); extern void Osal_rmMtCsExit (void *CsHandle); //extern void Osal_rmLog (char *fmt, ... ); extern void Osal_rmBeginMemAccess (void *ptr, uint32_t size); extern void Osal_rmEndMemAccess (void *ptr, uint32_t size); /** * @brief The macro is used by the RM LLD to allocate memory of specified * size * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void* Osal_rmMalloc (uint32_t numBytes) @endverbatim * * Parameter * @n Number of bytes to be allocated * * Parameter * @n If true the memory should could from shared memory * * Return Value * @n Pointer to the allocated block size */ #define Rm_osalMalloc Osal_rmMalloc /** * @brief The macro is used by the RM LLD to free a allocated block of * memory * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void Osal_rmFree (void *ptr, uint32_t size) @endverbatim * * Parameter * @n Pointer to the block of memory to be cleaned up. * @n Size of the allocated memory which is being freed. * * Return Value * @n Not applicable. */ #define Rm_osalFree Osal_rmFree /** * @brief The macro is used by the RM LLD to provide critical sections to * protect global and shared variables from * * access from multiple cores * and * access from multiple threads on single core * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void* Osal_rmCsEnter (void) @endverbatim * * Parameter * @n None. * * Return Value * @n Handle used to lock critical section. */ #define Rm_osalCsEnter Osal_rmCsEnter /** * @brief The macro is used by the RM LLD to exit a critical section * protected using Osal_rmCsEnter() API. * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void Osal_rmCsExit (void *CsHandle) @endverbatim * * Parameter * @n Handle for unlocking critical section. * * Return Value * @n Not applicable. */ #define Rm_osalCsExit Osal_rmCsExit /** * @brief The macro is used by the RM LLD to provide critical sections to * protect global and shared variables from * * access from multiple threads on single core * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void* Osal_rmMtCsEnter (void) @endverbatim * * Parameter * @n None. * * Return Value * @n Handle used to lock critical section. */ #define Rm_osalMtCsEnter Osal_rmMtCsEnter /** * @brief The macro is used by the RM LLD to exit a critical section * protected using Osal_rmMtCsEnter() API. * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void Osal_rmMtCsExit (void *CsHandle) @endverbatim * * Parameter * @n Handle for unlocking critical section. * * Return Value * @n Not applicable. */ #define Rm_osalMtCsExit Osal_rmMtCsExit /** * @brief The macro is used by the RM LLD to log various * messages. * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void Osal_rmLog( char *fmt, ... ) @endverbatim * * Parameter * @n printf-style format string * * Return Value * @n Not applicable. */ #define Rm_osalLog System_printf /** * @brief The macro is used by the RM LLD to indicate that a block * of memory is about to be accessed. If the memory block is cached then * this indicates that the application would need to ensure that the cache * is updated with the data from the actual memory. * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void Osal_rmBeginMemAccess (void *ptr, uint32_t size) @endverbatim * * Parameter * @n Address of memory block. * @n Size of memory block. * * Return Value * @n Not applicable. */ #define Rm_osalBeginMemAccess Osal_rmBeginMemAccess /** * @brief The macro is used by the RM LLD to indicate that the block of * memory has finished being accessed. If the memory block is cached then the * application would need to ensure that the contents of the cache are updated * immediately to the actual memory. * * Prototype: * The following is the C prototype for the expected OSAL API. * * @verbatim void Osal_rmEndMemAccess (void *ptr, uint32_t size) @endverbatim * * Parameter * @n Address of memory block. * @n Size of memory block. * * Return Value * @n Not applicable. */ #define Rm_osalEndMemAccess Osal_rmEndMemAccess /** @} */ #endif /* __RM_OSAL_H__ */