Skip to content

Commit

Permalink
Update Zephyr MSDK Hal based on MSDK PR: analogdevicesinc/msdk#1179
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 15, 2024
1 parent 395841b commit 92d770f
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 1 deletion.
77 changes: 77 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32655/Source/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <malloc.h>

/*
sbrk
Expand Down Expand Up @@ -48,3 +49,79 @@ caddr_t _sbrk(int incr)

return (caddr_t)prev_heap_end;
}

// struct mallinfo {
// size_t arena; /* total space allocated from system */
// size_t ordblks; /* number of non-inuse chunks */
// size_t smblks; /* unused -- always zero */
// size_t hblks; /* number of mmapped regions */
// size_t hblkhd; /* total space in mmapped regions */
// size_t usmblks; /* unused -- always zero */
// size_t fsmblks; /* unused -- always zero */
// size_t uordblks; /* total allocated space */
// size_t fordblks; /* total non-inuse space */
// size_t keepcost; /* top-most, releasable (via malloc_trim) space */
// };

/*
The structure fields contain the following information:
arena The total amount of memory allocated by means other than
mmap(2) (i.e., memory allocated on the heap). This figure
includes both in-use blocks and blocks on the free list.
ordblks
The number of ordinary (i.e., non-fastbin) free blocks.
smblks The number of fastbin free blocks (see mallopt(3)).
hblks The number of blocks currently allocated using mmap(2).
(See the discussion of M_MMAP_THRESHOLD in mallopt(3).)
hblkhd The number of bytes in blocks currently allocated using
mmap(2).
usmblks
This field is unused, and is always 0. Historically, it
was the "highwater mark" for allocated space—that is, the
maximum amount of space that was ever allocated (in
bytes); this field was maintained only in nonthreading
environments.
fsmblks
The total number of bytes in fastbin free blocks.
uordblks
The total number of bytes used by in-use allocations.
fordblks
The total number of bytes in free blocks.
keepcost
The total amount of releasable free space at the top of
the heap. This is the maximum number of bytes that could
ideally (i.e., ignoring page alignment restrictions, and
so on) be released by malloc_trim(3).
*/

struct mallinfo mallinfo(void)
{
struct mallinfo temp_mallinfo;

if (heap_end == 0) {
heap_end = (caddr_t)&__HeapBase;
}

temp_mallinfo.arena = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
temp_mallinfo.ordblks = 0; /* Unused */
temp_mallinfo.smblks = 0; /* Unused */
temp_mallinfo.hblks = 0; /* Unused */
temp_mallinfo.hblkhd = 0; /* Unused */
temp_mallinfo.usmblks = 0; /* Unused */
temp_mallinfo.fsmblks = 0; /* Unused */
temp_mallinfo.uordblks = (size_t)heap_end - (size_t)&__HeapBase;
temp_mallinfo.fordblks = (size_t)&__HeapLimit - (size_t)heap_end;
temp_mallinfo.keepcost = 0 /* Unused */;

return temp_mallinfo;
}
77 changes: 77 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32665/Source/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <malloc.h>

/*
sbrk
Expand Down Expand Up @@ -48,3 +49,79 @@ caddr_t _sbrk(int incr)

return (caddr_t)prev_heap_end;
}

// struct mallinfo {
// size_t arena; /* total space allocated from system */
// size_t ordblks; /* number of non-inuse chunks */
// size_t smblks; /* unused -- always zero */
// size_t hblks; /* number of mmapped regions */
// size_t hblkhd; /* total space in mmapped regions */
// size_t usmblks; /* unused -- always zero */
// size_t fsmblks; /* unused -- always zero */
// size_t uordblks; /* total allocated space */
// size_t fordblks; /* total non-inuse space */
// size_t keepcost; /* top-most, releasable (via malloc_trim) space */
// };

/*
The structure fields contain the following information:
arena The total amount of memory allocated by means other than
mmap(2) (i.e., memory allocated on the heap). This figure
includes both in-use blocks and blocks on the free list.
ordblks
The number of ordinary (i.e., non-fastbin) free blocks.
smblks The number of fastbin free blocks (see mallopt(3)).
hblks The number of blocks currently allocated using mmap(2).
(See the discussion of M_MMAP_THRESHOLD in mallopt(3).)
hblkhd The number of bytes in blocks currently allocated using
mmap(2).
usmblks
This field is unused, and is always 0. Historically, it
was the "highwater mark" for allocated space—that is, the
maximum amount of space that was ever allocated (in
bytes); this field was maintained only in nonthreading
environments.
fsmblks
The total number of bytes in fastbin free blocks.
uordblks
The total number of bytes used by in-use allocations.
fordblks
The total number of bytes in free blocks.
keepcost
The total amount of releasable free space at the top of
the heap. This is the maximum number of bytes that could
ideally (i.e., ignoring page alignment restrictions, and
so on) be released by malloc_trim(3).
*/

struct mallinfo mallinfo(void)
{
struct mallinfo temp_mallinfo;

if (heap_end == 0) {
heap_end = (caddr_t)&__HeapBase;
}

temp_mallinfo.arena = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
temp_mallinfo.ordblks = 0; /* Unused */
temp_mallinfo.smblks = 0; /* Unused */
temp_mallinfo.hblks = 0; /* Unused */
temp_mallinfo.hblkhd = 0; /* Unused */
temp_mallinfo.usmblks = 0; /* Unused */
temp_mallinfo.fsmblks = 0; /* Unused */
temp_mallinfo.uordblks = (size_t)heap_end - (size_t)&__HeapBase;
temp_mallinfo.fordblks = (size_t)&__HeapLimit - (size_t)heap_end;
temp_mallinfo.keepcost = 0 /* Unused */;

return temp_mallinfo;
}
77 changes: 77 additions & 0 deletions MAX/Libraries/CMSIS/Device/Maxim/MAX32690/Source/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <malloc.h>

/*
sbrk
Expand Down Expand Up @@ -48,3 +49,79 @@ caddr_t _sbrk(int incr)

return (caddr_t)prev_heap_end;
}

// struct mallinfo {
// size_t arena; /* total space allocated from system */
// size_t ordblks; /* number of non-inuse chunks */
// size_t smblks; /* unused -- always zero */
// size_t hblks; /* number of mmapped regions */
// size_t hblkhd; /* total space in mmapped regions */
// size_t usmblks; /* unused -- always zero */
// size_t fsmblks; /* unused -- always zero */
// size_t uordblks; /* total allocated space */
// size_t fordblks; /* total non-inuse space */
// size_t keepcost; /* top-most, releasable (via malloc_trim) space */
// };

/*
The structure fields contain the following information:
arena The total amount of memory allocated by means other than
mmap(2) (i.e., memory allocated on the heap). This figure
includes both in-use blocks and blocks on the free list.
ordblks
The number of ordinary (i.e., non-fastbin) free blocks.
smblks The number of fastbin free blocks (see mallopt(3)).
hblks The number of blocks currently allocated using mmap(2).
(See the discussion of M_MMAP_THRESHOLD in mallopt(3).)
hblkhd The number of bytes in blocks currently allocated using
mmap(2).
usmblks
This field is unused, and is always 0. Historically, it
was the "highwater mark" for allocated space—that is, the
maximum amount of space that was ever allocated (in
bytes); this field was maintained only in nonthreading
environments.
fsmblks
The total number of bytes in fastbin free blocks.
uordblks
The total number of bytes used by in-use allocations.
fordblks
The total number of bytes in free blocks.
keepcost
The total amount of releasable free space at the top of
the heap. This is the maximum number of bytes that could
ideally (i.e., ignoring page alignment restrictions, and
so on) be released by malloc_trim(3).
*/

struct mallinfo mallinfo(void)
{
struct mallinfo temp_mallinfo;

if (heap_end == 0) {
heap_end = (caddr_t)&__HeapBase;
}

temp_mallinfo.arena = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
temp_mallinfo.ordblks = 0; /* Unused */
temp_mallinfo.smblks = 0; /* Unused */
temp_mallinfo.hblks = 0; /* Unused */
temp_mallinfo.hblkhd = 0; /* Unused */
temp_mallinfo.usmblks = 0; /* Unused */
temp_mallinfo.fsmblks = 0; /* Unused */
temp_mallinfo.uordblks = (size_t)heap_end - (size_t)&__HeapBase;
temp_mallinfo.fordblks = (size_t)&__HeapLimit - (size_t)heap_end;
temp_mallinfo.keepcost = 0 /* Unused */;

return temp_mallinfo;
}
2 changes: 1 addition & 1 deletion MAX/msdk_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
679fc79d66f0f64a4a1b323c11b98fd9117d22a2
b0219d334e8b8ab3250885a7438975513cafa94d

0 comments on commit 92d770f

Please sign in to comment.