Hello,
with the following code I try to register a ISR in core 1, which is triggered by the software of core 2 in a 3 core system.
For some reason, the ISR is never entered, but core 1 wakes up again.
Thanks for your help.
-Flo
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <bcc/bcc.h>
#include "bcc/bcc_param.h"
#define nodeprintf(...) if (1) { \
printf("core%d:%s:%d: ", bcc_get_cpuid(), __func__, __LINE__); \
printf(__VA_ARGS__); \
}
void ISR (void *arg, int source) {
nodeprintf("This is an interrupt caused by source %d on %" PRIuPTR ". \n", source, (uintptr_t)arg);
}
int main (void)
{
uintptr_t id = bcc_get_cpuid();
if (id == 0) {
bcc_start_processor(id + 1);
bcc_power_down();
}
if (id == 1) {
void *ictx0 = bcc_isr_register(5, &ISR, (void*)id);
if (NULL == ictx0) {
return BCC_FAIL;
}
bcc_int_unmask(5);
bcc_start_processor(id + 1);
bcc_power_down();
puts("Somebody woke me up.\n");
} else {
for (int i=0; i< 1000000; i++) {
asm("nop");
}
bcc_send_interrupt(5, 1);
bcc_power_down(); // schlafen
}
return 0;
}