diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-09-12 00:12:18 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-09-12 00:12:18 +0000 |
commit | 675f37494ad7f096e0b4c42189fe224c54e4fdb1 (patch) | |
tree | f8d171198bb20d4dbec10a7a8d033163423f304c /nuttx/mm/mm_granalloc.c | |
parent | 7bb74973bd7a1839c12ddf2b1d9221007f31ebc6 (diff) | |
download | px4-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/mm_granalloc.c')
-rw-r--r-- | nuttx/mm/mm_granalloc.c | 14 |
1 files changed, 11 insertions, 3 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: |