Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: AvailableMemory_HelloWorld MCBBThermostat helloaabbc SP14P1_skeleton
AvailableMemory.h@12:3004855925ff, 2010-11-08 (annotated)
- Committer:
- segundo
- Date:
- Mon Nov 08 12:47:36 2010 +0000
- Revision:
- 12:3004855925ff
- Parent:
- 11:0f5d5918761a
- Child:
- 13:c8a20f79e011
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| segundo | 10:7474d5df69c2 | 1 | /** @file |
| segundo | 12:3004855925ff | 2 | * Return the memory available for a malloc call. |
| segundo | 10:7474d5df69c2 | 3 | * This is done by a binary search approach |
| segundo | 10:7474d5df69c2 | 4 | * calling malloc/free starting with a maximum |
| segundo | 3:9092256004a5 | 5 | */ |
| segundo | 0:a98bf0c96bf1 | 6 | #ifndef SEGUNDO_UTILITIES_AVAILABLEMEMORY_H |
| segundo | 0:a98bf0c96bf1 | 7 | #define SEGUNDO_UTILITIES_AVAILABLEMEMORY_H |
| segundo | 6:e94f3a11bad7 | 8 | |
| segundo | 9:caba868a4c1a | 9 | /** |
| segundo | 9:caba868a4c1a | 10 | * Segundo Equipo |
| segundo | 9:caba868a4c1a | 11 | */ |
| segundo | 0:a98bf0c96bf1 | 12 | namespace segundo { |
| segundo | 9:caba868a4c1a | 13 | /** |
| segundo | 9:caba868a4c1a | 14 | * A collection of utilities |
| segundo | 9:caba868a4c1a | 15 | */ |
| segundo | 0:a98bf0c96bf1 | 16 | namespace Utilities { |
| segundo | 0:a98bf0c96bf1 | 17 | |
| segundo | 10:7474d5df69c2 | 18 | /** Return the memory available for a malloc call |
| segundo | 11:0f5d5918761a | 19 | * @param resolution Resolution in number of bytes, |
| segundo | 11:0f5d5918761a | 20 | * 1 will return the exact value, |
| segundo | 12:3004855925ff | 21 | * default will return the available memory to the nearest 256 bytes |
| segundo | 12:3004855925ff | 22 | * @param maximum Maximum amount of memory to check, default is 32K (0x8000) |
| segundo | 11:0f5d5918761a | 23 | * @param disableInterrupts Disable interrupts whilst checking, default is true |
| segundo | 11:0f5d5918761a | 24 | * @return Available memory in bytes accurate to within resolution |
| segundo | 1:d8432d8a5b6d | 25 | */ |
| segundo | 11:0f5d5918761a | 26 | int AvailableMemory(int resolution = 256, int maximum = 0x8000, bool disableInterrupts = true); |
| segundo | 0:a98bf0c96bf1 | 27 | |
| segundo | 0:a98bf0c96bf1 | 28 | } // namespace Utilities |
| segundo | 0:a98bf0c96bf1 | 29 | } // namespace segundo |
| segundo | 0:a98bf0c96bf1 | 30 | |
| segundo | 0:a98bf0c96bf1 | 31 | using namespace segundo::Utilities; |
| segundo | 0:a98bf0c96bf1 | 32 | |
| segundo | 0:a98bf0c96bf1 | 33 | #endif // SEGUNDO_UTILITIES_AVAILABLEMEMORY_H |