aboutsummaryrefslogtreecommitdiff
path: root/nuttx/mm/mm_gran.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-09-11 21:39:39 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-09-11 21:39:39 +0000
commit7bb74973bd7a1839c12ddf2b1d9221007f31ebc6 (patch)
treec5d73a8df2e0ca85da53ba8ab344f19e34466663 /nuttx/mm/mm_gran.h
parent594b34a3564056f8f003ee9a19aa5837bcb1a4d4 (diff)
downloadpx4-firmware-7bb74973bd7a1839c12ddf2b1d9221007f31ebc6.tar.gz
px4-firmware-7bb74973bd7a1839c12ddf2b1d9221007f31ebc6.tar.bz2
px4-firmware-7bb74973bd7a1839c12ddf2b1d9221007f31ebc6.zip
Fixes for granule allocator
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5131 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/mm/mm_gran.h')
-rw-r--r--nuttx/mm/mm_gran.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/nuttx/mm/mm_gran.h b/nuttx/mm/mm_gran.h
index d8a334e29..4a76397c8 100644
--- a/nuttx/mm/mm_gran.h
+++ b/nuttx/mm/mm_gran.h
@@ -43,6 +43,7 @@
#include <nuttx/config.h>
#include <stdint.h>
+#include <semaphore.h>
#include <nuttx/gran.h>
@@ -87,6 +88,7 @@ struct gran_s
{
uint8_t log2gran; /* Log base 2 of the size of one granule */
uint16_t ngranules; /* The total number of (aligned) granules in the heap */
+ sem_t exclsem; /* For exclusive access to the GAT */
uintptr_t heapstart; /* The aligned start of the granule heap */
uint32_t gat[1]; /* Start of the granule allocation table */
};
@@ -105,4 +107,22 @@ extern FAR struct gran_s *g_graninfo;
* Public Function Prototypes
****************************************************************************/
+/****************************************************************************
+ * Name: gran_semtake and gran_semgive
+ *
+ * Description:
+ * Managed semaphore for the granule allocator. gran_semgive is
+ * implemented as a macro.
+ *
+ * Input Parameters:
+ * priv - Pointer to the gran state
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void gran_semtake(FAR struct gran_s *priv);
+#define gran_semgive(p) sem_post(&(p)->exclsem);
+
#endif /* __MM_MM_GRAN_H */