From e8faf2f2adeb9066de3c968a57803bb262f61ee1 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 18 Jan 2022 18:57:06 +0000 Subject: buflib: add a common dummy callbacks struct & use it There are various allocations that can't be moved or shrunk. Provide a global callback struct for this use case instead of making each caller declare its own dummy struct. Also fixed ROLO and x1000 installer code which incorrectly used movable allocations. Change-Id: I00088396b9826e02e69a4a33477fe1a7816374f1 --- firmware/include/buflib.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'firmware/include/buflib.h') diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h index 7f534c6ce0..e805ebbf1b 100644 --- a/firmware/include/buflib.h +++ b/firmware/include/buflib.h @@ -129,6 +129,12 @@ struct buflib_callbacks { void (*sync_callback)(int handle, bool sync_on); }; +/** A set of all NULL callbacks for use with allocations that need to stay + * locked in RAM and not moved or shrunk. These type of allocations should + * be avoided as much as possible to avoid memory fragmentation but it can + * suitable for short-lived allocations. */ +extern struct buflib_callbacks buflib_ops_locked; + #define BUFLIB_SHRINK_SIZE_MASK (~BUFLIB_SHRINK_POS_MASK) #define BUFLIB_SHRINK_POS_FRONT (1u<<31) #define BUFLIB_SHRINK_POS_BACK (1u<<30) -- cgit v1.2.3