]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blobdiff - rm_osal.h
Resolved SDOCM00114533
[keystone-rtos/rm-lld.git] / rm_osal.h
index 92ddc1b7e78318a6d0cfa58cb22daae8846bd646..fbee72006466e9838f67bc0803195bfd94d8746a 100644 (file)
--- a/rm_osal.h
+++ b/rm_osal.h
@@ -2,8 +2,8 @@
  *   @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 
+ *      This is the sample OS Adaptation layer which is used by the Resource
+ *      Manager. The OSAL layer can be ported in either of the following 
  *      manners to a native OS:
  *
  *      <b> Approach 1: </b>
@@ -32,7 +32,7 @@
  *
  *  \par
  *  NOTE:
- *      (C) Copyright 2012 Texas Instruments, Inc.
+ *      (C) Copyright 2012-2013 Texas Instruments, Inc.
  * 
  *  Redistribution and use in source and binary forms, with or without 
  *  modification, are permitted provided that the following conditions 
  *
  *  \par
 */
-#ifndef __RM_OSAL_H__
-#define __RM_OSAL_H__
+#ifndef RM_OSAL_H_
+#define RM_OSAL_H_
 
-/** @addtogroup RM_LLD_OSAL
- @{ */
+/** @addtogroup RM_OSAL_API
+ @{ 
+ */
 
 /**********************************************************************
  ************************* Extern Declarations ************************
  **********************************************************************/
 
-/* #include <string.h> 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 <string.h>
-
-extern void* Osal_rmMalloc (uint32_t num_bytes, bool shared);
-extern void Osal_rmFree (void *ptr, uint32_t size, bool shared);
-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);
+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 *mtSemObj);
+extern void  Osal_rmMtCsExit (void *mtSemObj, void *CsHandle);
+extern void  Osal_rmBeginMemAccess (void *ptr, uint32_t size);
+extern void  Osal_rmEndMemAccess (void *ptr, uint32_t size);
+extern void *Osal_rmTaskBlockCreate (void);
+extern void  Osal_rmTaskBlock (void *handle);
+extern void  Osal_rmTaskUnblock (void *handle);
+extern void  Osal_rmTaskBlockDelete (void *handle);
+extern void  Osal_rmLog (char *fmt, ... );
 
 /**
- * @brief   The macro is used by the RM LLD to allocate memory of specified
- * size
+ * @brief   The macro is used by RM to allocate memory of specified
+ *          size
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
@@ -104,18 +103,14 @@ extern void Osal_rmEndMemAccess (void *ptr, uint32_t size);
  *  <b> Parameter </b>
  *  @n  Number of bytes to be allocated
  *
- *  <b> Parameter </b>
- *  @n  If true the memory should could from shared memory
- *
  *  <b> Return Value </b>
  *  @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 
+ * @brief   The macro is used by RM to free a allocated block of 
+ *          memory 
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
@@ -131,35 +126,34 @@ extern void Osal_rmEndMemAccess (void *ptr, uint32_t size);
  *  <b> Return Value </b>
  *  @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
+ * @brief   The function is used to enter a critical section.
+ *          Function protects against 
+ *      
+ *          access from multiple cores 
+ *          and 
+ *          access from multiple threads on single core
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
  *
  *  @verbatim
-       voidOsal_rmCsEnter (void)
+       void *Osal_rmCsEnter (void)
     @endverbatim
  *      
  *  <b> Parameter </b>
- *  @n  None.
+ *  @n  Not applicable.
  *
  *  <b> Return Value </b>
- *  @n  Handle used to lock critical section.
+ *  @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.
+ * @brief   The function is used to exit a critical section 
+ *          protected using Osal_rmCsEnter() API.
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
@@ -177,39 +171,42 @@ extern void Osal_rmEndMemAccess (void *ptr, uint32_t size);
 #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
+ * @brief   The function is used to enter a multi-threaded critical
+ *          section.  Function protects against 
+ *      
+ *          access from multiple threads on single core
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
  *
  *  @verbatim
-       void* Osal_rmMtCsEnter (void)
+       void *Osal_rmMtCsEnter (void *mtSemObj)
     @endverbatim
  *      
  *  <b> Parameter </b>
- *  @n  None.
+ *  @n  Multi-threaded critical section object handle.
  *
  *  <b> Return Value </b>
- *  @n  Handle used to lock critical section.
+ *  @n  Handle used to lock the multi-threaded 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.
+ * @brief   The function is used to exit a multi-threaded critical
+ *          section protected using Osal_rmMtCsEnter() API.
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
  *
  *  @verbatim
-       void Osal_rmMtCsExit (void *CsHandle)
+       void Osal_rmMtCsExit (void *mtSemObj, void *CsHandle)
     @endverbatim
- *      
+ *
  *  <b> Parameter </b>
- *  @n  Handle for unlocking critical section.
+ *  @n  Multi-threaded critical section object handle.
+ *
+ *  <b> Parameter </b>
+ *  @n  Handle for unlocking multi-threaded critical section.
  *
  *  <b> Return Value </b>
  *  @n  Not applicable.
@@ -217,70 +214,155 @@ extern void Osal_rmEndMemAccess (void *ptr, uint32_t size);
 #define Rm_osalMtCsExit           Osal_rmMtCsExit
 
 /**
- * @brief   The macro is used by the RM LLD to log various 
- * messages. 
+ * @brief   The function is used 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.
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
  *
  *  @verbatim
-       void Osal_rmLog( char *fmt, ... ) 
+       void Osal_rmBeginMemAccess (void *ptr, uint32_t size)
     @endverbatim
+ *      
+ *  <b> Parameter </b>
+ *  @n  Address of memory block
+ *  @n  Size of memory block
+ *
+ *  <b> Return Value </b>
+ *  @n  Not applicable.
+ */
+#define Rm_osalBeginMemAccess     Osal_rmBeginMemAccess
+
+/**
+ * @brief   The function is used 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. 
  *
+ * <b> Prototype: </b>
+ *  The following is the C prototype for the expected OSAL API.
+ *
+ *  @verbatim
+       void Osal_rmEndMemAccess (void *ptr, uint32_t size)
+    @endverbatim
+ *      
  *  <b> Parameter </b>
- *  @n  printf-style format string 
+ *  @n  Address of memory block
+ *  @n  Size of memory block
  *
  *  <b> Return Value </b>
  *  @n  Not applicable.
  */
-#define Rm_osalLog                Osal_rmLog
+#define Rm_osalEndMemAccess       Osal_rmEndMemAccess
+
+/**
+ * @brief   The macro is used by RM to create a task blocking
+ *          mechanism allowing a RM instance to block when it
+ *          has not been provided a service callback function
+ *          and it must send a packet to remote RM instance 
+ *          to complete a service.
+ *
+ * <b> Prototype: </b>
+ *  The following is the C prototype for the expected OSAL API.
+ *
+ *  @verbatim
+       void *Osal_rmTaskBlockCreate (void)
+    @endverbatim
+ *      
+ *  <b> Parameter </b>
+ *  @n  Not applicable.
+ *
+ *  <b> Return Value </b>
+ *  @n  Task blocking mechanism handle cast as a void pointer
+ */
+#define Rm_osalTaskBlockCreate    Osal_rmTaskBlockCreate
+
+/**
+ * @brief   The macro is used by a RM instance to block when it
+ *          has not been provided a service callback function
+ *          and it must send a packet to remote RM instance 
+ *          to complete a service.  The blocking operation
+ *          should block the current RM instance's task/thread
+ *          from executing until a task/thread from which the
+ *          RM receive code runs unblocks the RM instance
+ *
+ * <b> Prototype: </b>
+ *  The following is the C prototype for the expected OSAL API.
+ *
+ *  @verbatim
+       void  Osal_rmTaskBlock (void *handle)
+    @endverbatim
+ *      
+ *  <b> Parameter </b>
+ *  @n  Task blocking mechanism handle cast as a void pointer
+ *
+ *  <b> Return Value </b>
+ *  @n  Not applicable.
+ */
+#define Rm_osalTaskBlock          Osal_rmTaskBlock
 
 /**
- * @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.
+ * @brief   The macro is used by a RM instance to unblock from 
+ *          a previous block operation.
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
  *
  *  @verbatim
-       void Osal_rmBeginMemAccess (void *ptr, uint32_t size) 
+       void  Osal_rmTaskUnblock (void *handle)
     @endverbatim
+ *      
+ *  <b> Parameter </b>
+ *  @n  Task blocking mechanism handle cast as a void pointer
  *
+ *  <b> Return Value </b>
+ *  @n  Not applicable.
+ */
+#define Rm_osalTaskUnblock        Osal_rmTaskUnblock
+
+/**
+ * @brief   The macro is used by a RM instance to delete its
+ *          task blocking mechanism.
+ *
+ * <b> Prototype: </b>
+ *  The following is the C prototype for the expected OSAL API.
+ *
+ *  @verbatim
+       void  Osal_rmTaskBlockDelete (void *handle)
+    @endverbatim
+ *      
  *  <b> Parameter </b>
- *  @n  Address of memory block.
- *  @n  Size of memory block.
+ *  @n  Task blocking mechanism handle cast as a void pointer
  *
  *  <b> Return Value </b>
  *  @n  Not applicable.
  */
-#define Rm_osalBeginMemAccess     Osal_rmBeginMemAccess
+#define Rm_osalTaskBlockDelete    Osal_rmTaskBlockDelete
 
 /**
- * @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.
+ * @brief   The macro is used by RM to log various 
+ *          messages. 
  *
  * <b> Prototype: </b>
  *  The following is the C prototype for the expected OSAL API.
  *
  *  @verbatim
-       void Osal_rmEndMemAccess (void *ptr, uint32_t size
+       void Osal_rmLog( char *fmt, ... 
     @endverbatim
  *
  *  <b> Parameter </b>
- *  @n  Address of memory block.
- *  @n  Size of memory block.
+ *  @n  printf-style format string 
  *
  *  <b> Return Value </b>
  *  @n  Not applicable.
  */
-#define Rm_osalEndMemAccess       Osal_rmEndMemAccess
+#define Rm_osalLog                Osal_rmLog
 
 /**
 @}
 */
-#endif /* __RM_OSAL_H__ */
+
+#endif /* RM_OSAL_H_ */