Skip to content
Snippets Groups Projects
Forked from card10 / firmware
1381 commits behind the upstream repository.
  • rahix's avatar
    3b9393fe
    feat(epicardium): Implement basic core 1 lifecycle · 3b9393fe
    rahix authored
    
    This commit introduces a way to control core 1.  This is archieved by a
    predefined API-Interrupt:  The reset interrupt.  When triggered, it will
    bring the core back into its default state and wait for a new vector
    address from Epicardium.  Once this vector address is transferred, it
    will start the new payload.
    
    This method only works as long as core 1 is responsive to the API
    interrupts.  Cases where this might not be the case:
    
      - During times where core 1 has interrupts disabled
      - When in a higher priority exception handler
      - When core 1 has corrupted its IVT
    
    Signed-off-by: default avatarRahix <rahix@rahix.de>
    Verified
    3b9393fe
    History
    feat(epicardium): Implement basic core 1 lifecycle
    rahix authored
    
    This commit introduces a way to control core 1.  This is archieved by a
    predefined API-Interrupt:  The reset interrupt.  When triggered, it will
    bring the core back into its default state and wait for a new vector
    address from Epicardium.  Once this vector address is transferred, it
    will start the new payload.
    
    This method only works as long as core 1 is responsive to the API
    interrupts.  Cases where this might not be the case:
    
      - During times where core 1 has interrupts disabled
      - When in a higher priority exception handler
      - When core 1 has corrupted its IVT
    
    Signed-off-by: default avatarRahix <rahix@rahix.de>
interrupt-receiver.c 418 B
#include "max32665.h"
#include "tmr.h"
#include "api/common.h"
#include "epicardium.h"

void __dispatch_isr(api_int_id_t);

/* Timer Interrupt used for control char notification */
void TMR5_IRQHandler(void)
{
	TMR_IntClear(MXC_TMR5);
	__dispatch_isr(API_CALL_MEM->int_id);
	API_CALL_MEM->int_id = (-1);
}

/* Reset Handler */
void __epic_isr_reset(void)
{
	API_CALL_MEM->int_id = (-1);
	API_CALL_MEM->reset_stub();
}