Mercurial > ecos
comparison packages/kernel/current/include/mfiximpl.inl @ 2:443894e2e912 ecos-v1_2_1-release
Block commit of eCos version 1.2.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 12:24:34 +0000 |
| parents | 3111d98ba7b3 |
| children | c38311975d4f |
comparison
equal
deleted
inserted
replaced
| 1:72f549f0d891 | 2:443894e2e912 |
|---|---|
| 1 #ifndef CYGONCE_KERNEL_MFIXIMPL_INL | 1 #ifndef CYGONCE_KERNEL_MFIXIMPL_INL |
| 2 #define CYGONCE_KERNEL_MFIXIMPL_INL | 2 #define CYGONCE_KERNEL_MFIXIMPL_INL |
| 3 | 3 |
| 4 //========================================================================== | 4 //========================================================================== |
| 5 // | 5 // |
| 6 // mfiximpl.inl | 6 // mfiximpl.inl |
| 7 // | 7 // |
| 8 // Memory pool with fixed block class declarations | 8 // Memory pool with fixed block class declarations |
| 9 // | 9 // |
| 10 //========================================================================== | 10 //========================================================================== |
| 11 //####COPYRIGHTBEGIN#### | 11 //####COPYRIGHTBEGIN#### |
| 12 // | 12 // |
| 13 // ------------------------------------------- | 13 // ------------------------------------------- |
| 23 // | 23 // |
| 24 // The Original Code is eCos - Embedded Cygnus Operating System, released | 24 // The Original Code is eCos - Embedded Cygnus Operating System, released |
| 25 // September 30, 1998. | 25 // September 30, 1998. |
| 26 // | 26 // |
| 27 // The Initial Developer of the Original Code is Cygnus. Portions created | 27 // The Initial Developer of the Original Code is Cygnus. Portions created |
| 28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | 28 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
| 29 // ------------------------------------------- | 29 // ------------------------------------------- |
| 30 // | 30 // |
| 31 //####COPYRIGHTEND#### | 31 //####COPYRIGHTEND#### |
| 32 //========================================================================== | 32 //========================================================================== |
| 33 //#####DESCRIPTIONBEGIN#### | 33 //#####DESCRIPTIONBEGIN#### |
| 34 // | 34 // |
| 35 // Author(s): hmt | 35 // Author(s): hmt |
| 36 // Contributors: hmt | 36 // Contributors: hmt |
| 37 // Date: 1998-03-23 | 37 // Date: 1998-03-23 |
| 38 // Purpose: Define Mfiximpl class interface | 38 // Purpose: Define Mfiximpl class interface |
| 39 // Description: Inline class for constructing a fixed block allocator | 39 // Description: Inline class for constructing a fixed block allocator |
| 40 // Usage: #include <cyg/kernel/mfiximpl.hxx> | 40 // Usage: #include <cyg/kernel/mfiximpl.hxx> |
| 41 // #include <cyg/kernel/mfiximpl.inl> | 41 // #include <cyg/kernel/mfiximpl.inl> |
| 42 // | 42 // |
| 43 //####DESCRIPTIONEND#### | 43 //####DESCRIPTIONEND#### |
| 44 // | 44 // |
| 45 //========================================================================== | 45 //========================================================================== |
| 46 | 46 |
| 53 CYG_ADDRWORD alloc_unit ) | 53 CYG_ADDRWORD alloc_unit ) |
| 54 { | 54 { |
| 55 cyg_int32 i; | 55 cyg_int32 i; |
| 56 bitmap = (cyg_uint32 *)base; | 56 bitmap = (cyg_uint32 *)base; |
| 57 blocksize = alloc_unit; | 57 blocksize = alloc_unit; |
| 58 numblocks = size / blocksize; | |
| 59 top = base + size; | |
| 60 | 58 |
| 61 CYG_ASSERT( blocksize > 0, "Bad blocksize" ); | 59 CYG_ASSERT( blocksize > 0, "Bad blocksize" ); |
| 62 CYG_ASSERT( size > 2, "Bad blocksize" ); | 60 CYG_ASSERT( size > 2, "Bad blocksize" ); |
| 63 CYG_ASSERT( blocksize < size, "blocksize, size bad" ); | 61 CYG_ASSERT( blocksize < size, "blocksize, size bad" ); |
| 62 | |
| 63 numblocks = size / blocksize; | |
| 64 top = base + size; | |
| 65 | |
| 64 CYG_ASSERT( numblocks >= 2, "numblocks bad" ); | 66 CYG_ASSERT( numblocks >= 2, "numblocks bad" ); |
| 65 | 67 |
| 66 i = (numblocks + 31)/32; // number of words to map blocks | 68 i = (numblocks + 31)/32; // number of words to map blocks |
| 67 while ( (i * 4 + numblocks * blocksize) > size ) { | 69 while ( (i * 4 + numblocks * blocksize) > size ) { |
| 68 numblocks --; // steal one block for admin | 70 numblocks --; // steal one block for admin |
