summaryrefslogtreecommitdiff
path: root/nuttx/mm/mm_gran.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-11 21:39:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-11 21:39:39 +0000
commit3192d123fd3fabeac0a58eadb90ccd86411910d4 (patch)
treec5d73a8df2e0ca85da53ba8ab344f19e34466663 /nuttx/mm/mm_gran.h
parent63240531781806cb440108ebd5ad0c3dc62510d3 (diff)
downloadpx4-nuttx-3192d123fd3fabeac0a58eadb90ccd86411910d4.tar.gz
px4-nuttx-3192d123fd3fabeac0a58eadb90ccd86411910d4.tar.bz2
px4-nuttx-3192d123fd3fabeac0a58eadb90ccd86411910d4.zip
Fixes for granule allocator
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5131 42af7a65-404d-4744-a932-0658087f49c3
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 */