aboutsummaryrefslogtreecommitdiff
path: root/nuttx/mm
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-09-12 00:12:18 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-09-12 00:12:18 +0000
commit675f37494ad7f096e0b4c42189fe224c54e4fdb1 (patch)
treef8d171198bb20d4dbec10a7a8d033163423f304c /nuttx/mm
parent7bb74973bd7a1839c12ddf2b1d9221007f31ebc6 (diff)
downloadpx4-firmware-675f37494ad7f096e0b4c42189fe224c54e4fdb1.tar.gz
px4-firmware-675f37494ad7f096e0b4c42189fe224c54e4fdb1.tar.bz2
px4-firmware-675f37494ad7f096e0b4c42189fe224c54e4fdb1.zip
Misc ENC28J60 fixes
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5132 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/mm')
-rw-r--r--nuttx/mm/mm_granalloc.c14
-rw-r--r--nuttx/mm/mm_graninit.c2
2 files changed, 12 insertions, 4 deletions
diff --git a/nuttx/mm/mm_granalloc.c b/nuttx/mm/mm_granalloc.c
index 0e94d464b..62fbc0870 100644
--- a/nuttx/mm/mm_granalloc.c
+++ b/nuttx/mm/mm_granalloc.c
@@ -158,10 +158,18 @@ static inline FAR void *gran_common_alloc(FAR struct gran_s *priv, size_t size)
for (i = 0; i < priv->ngranules; i += 32)
{
- /* Get the GAT index associated with the granule (i) */
+ /* Get the GAT index associated with the granule table entry [i] */
j = i >> 5;
- curr = priv->gat[j];
+ curr = priv->gat[j];
+
+ /* Handle the case where there are no free granules in the entry */
+
+ if (curr == 0xffffffff)
+ {
+ alloc += (32 << priv->log2gran);
+ continue;
+ }
/* Get the next entry from the GAT to support a 64 bit shift */
@@ -228,7 +236,7 @@ static inline FAR void *gran_common_alloc(FAR struct gran_s *priv, size_t size)
* Allocate memory from the granule heap.
*
* NOTE: The current implementation also restricts the maximum allocation
- * size to 32 granaules. That restriction could be eliminated with some
+ * size to 32 granules. That restriction could be eliminated with some
* additional coding effort.
*
* Input Parameters:
diff --git a/nuttx/mm/mm_graninit.c b/nuttx/mm/mm_graninit.c
index bc2c6f2a1..d3144b2aa 100644
--- a/nuttx/mm/mm_graninit.c
+++ b/nuttx/mm/mm_graninit.c
@@ -139,7 +139,7 @@ static inline FAR struct gran_s *gran_common_initialize(FAR void *heapstart,
* losses of memory due to alignment and quantization waste.
*
* NOTE: The current implementation also restricts the maximum allocation
- * size to 32 granaules. That restriction could be eliminated with some
+ * size to 32 granules. That restriction could be eliminated with some
* additional coding effort.
*
* Input Parameters: