firmware: make lc_open_from_mem() optional

Define HAVE_LC_OPEN_FROM_MEM if the target implements
lc_open_from_mem(). Make HAVE_CODEC_BUFFERING depend
on this feature.

Change-Id: If5f70db58963dcdc33848b860c028841ac380ab2
This commit is contained in:
Aidan MacDonald 2026-01-04 14:21:43 +00:00 committed by Solomon Peachy
parent cb2b2a5021
commit e6e56ceb51
3 changed files with 7 additions and 12 deletions

View file

@ -689,8 +689,12 @@ Lyre prototype 1 */
# endif
#endif
#if CONFIG_BINFMT == BINFMT_ROCK
# define HAVE_LC_OPEN_FROM_MEM
#endif
/* Codec buffering requires the ability to load code from RAM */
#if CONFIG_PLATFORM & PLATFORM_NATIVE
#if defined(HAVE_LC_OPEN_FROM_MEM)
# define HAVE_CODEC_BUFFERING
#endif

View file

@ -27,15 +27,4 @@ void *lc_open(const char *filename, unsigned char *buf, size_t buf_size);
void *lc_get_header(void *handle);
void lc_close(void *handle);
#ifdef APPLICATION
/* App doesn't simulate code loading from a buffer */
static inline void * lc_open_from_mem(void *addr, size_t blob_size)
{
return NULL;
(void)addr; (void)blob_size;
}
#else
void *lc_open_from_mem(void* addr, size_t blob_size);
#endif
#endif /* __LC_DLOPEN_H__ */

View file

@ -25,6 +25,7 @@
void *lc_open(const char *filename, unsigned char *buf, size_t buf_size);
#if defined(HAVE_LC_OPEN_FROM_MEM)
/* header is always at the beginning of the blob, and handle actually points
* to the start of the blob (the header is there) */
static inline void *lc_open_from_mem(void* addr, size_t blob_size)
@ -34,6 +35,7 @@ static inline void *lc_open_from_mem(void* addr, size_t blob_size)
commit_discard_idcache();
return addr;
}
#endif /* HAVE_LC_OPEN_FROM_MEM */
static inline void *lc_get_header(void *handle)
{