What is the purpose of the adi_mmu_Init() function?

I'm testing a second-stage loader (SSL). To aid my understanding I have read the EE-428: Tips and Tricks Using the ADSP-SC57x/ADSP-2157x Processor Boot ROM and tested the SSL_Code_Example from the EE-428: Associated Zip File. I managed to successfully test the examples.

And now I wonder, what's the purpose of the adi_mmu_Init() defined in the Bootloader_Core0.h file? I can't find any information about this function.

If I remove it the SSL won't work (but the compiler doesn't complain).

After some investigation I found adi_mmu.h, it says:

/*! Enumeration of different error codes returned by the MMU service */
typedef enum
  ADI_MMU_SUCCESS = 0,              /*!< Success */

  ADI_MMU_ERR_TABLE_ALIGN,          /*!< The supplied table memory is insufficiently aligned */
  ADI_MMU_ERR_TABLE_SIZE,           /*!< The supplied table memory is not a whole multiple of 1024 bytes in size */
  ADI_MMU_ERR_TABLE_SPACE,          /*!< The supplied table memory is too small */
  ADI_MMU_ERR_ORDERING,             /*!< The regions are not in ascending address order */
  ADI_MMU_ERR_TYPE,                 /*!< A region type is invalid */
  ADI_MMU_ERR_SIZE,                 /*!< A region is not a whole multiple of 4096 bytes in size */
  ADI_MMU_ERR_ALIGN,                /*!< A region start is not on a 4096 byte boundary */
  ADI_MMU_ERR_DESC                  /*!< A prototype descriptor is invalid */

extern ADI_MMU_RESULT adi_mmu_Init(void);

And in crt-sc573.S calls adi_mmu_Init() and checks the return value :

/* Call adi_mmu_Init() API to initialize page tables and the Memory-Management
   Unit (MMU). Branch to adi_fatal_error if an error is returned. */
	bl adi_mmu_Init
	mov r1, #_AFE_S_GNUadi_mmu_Init_failure
	/* Load lr with the adi_mmu_Init call address for accurate 
	   adi_fatal_error PC output. */
	ldr lr, =call_adi_mmu_Init
	movs r2, r0             /* check return is 0 for ADI_MMU_SUCCESS */
	bne call_fatal_error    /* branch if adi_mmu_Init returned an error */

So the adi_mmu_Init() should return ADI_MMU_SUCCESS.

All examples have the function defined as:

void adi_mmu_Init() {

It should instead be:

int adi_mmu_Init() {
	return 0; // return ADI_MMU_SUCCESS

Found more information
[edited by: masip at 8:16 AM (GMT -4) on 29 Apr 2021]