On Tue, Mar 23, 2010 at 9:29 PM, Guzman Lugo, Fernando <x0095840@xxxxxx> wrote: > I have tested just using an application (base on bridged code) which is registered for fatal events and once it receives an event it prints the received event: Ok, I ran your test and it works, however, I tried to modify it to fit what I'm doing in gst-dsp and it turns out it's very easy for this code to reboot the device. I'm attaching the test. Also, I found the exact reason why my code fails but yours not. I do something like this: while (!done) { dsp_wait_for_events(&index); if (index == 0) { /* node message */ while (true) { if (!dsp_node_get_message(&msg)) break; handle_message(msg); } } } So, before your patch, the get_message() failed, and the next wait_for_events() succeeded and returned the MMU fault. Now, the get_message() fails, and so does the wait_for_events(). The only way to make that code work with your patch is to remove the inner while, so wait_for_events() and get_message() are always run one after the other. That is breaking old behavior and should be fixed, right? -- Felipe Contreras
#include <stdio.h> #include <string.h> #include <dbapi.h> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) static char *e_name[] = { "MMU_FAULT", "SYS_ERROR", "PWR_ERROR", "STATE_CHANGE", "UNKNOWN" }; void bridge_listener(void) { DSP_HPROCESSOR proc; unsigned index = 0, i; long status; struct DSP_NOTIFICATION *events[3]; for (i = 0; i < ARRAY_SIZE(events); i++) events[i] = calloc(1, sizeof(**events)); status = DspManager_Open(0, NULL); if (status < 0) { printf("open failed\n"); goto out; } status = DSPProcessor_Attach(0, NULL, &proc); if (status < 0) { printf("attach failed\n"); goto out; } status = DSPProcessor_RegisterNotify(proc, DSP_MMUFAULT, DSP_SIGNALEVENT, events[0]); if (status < 0) { printf("register mmu fault failed\n"); goto out; } status = DSPProcessor_RegisterNotify(proc, DSP_SYSERROR, DSP_SIGNALEVENT, events[1]); if (status < 0) { printf("register sys error failed\n"); goto out; } status = DSPManager_WaitForEvents(events, ARRAY_SIZE(events), &index, DSP_FOREVER); if (status >= 0) printf("event received %s\n", e_name[index]); else printf("wait for events failed\n"); out: DSPProcessor_Detach(proc); DspManager_Close(0, NULL); for (i = 0; i < ARRAY_SIZE(events); i++) free(events[i]); } int main(void) { bridge_listener(); return 0; }