Example #1
0
void ping_received(const test3__a_array_impl test_data) {
   #ifdef __TB_OS_ECHRONOS
      debug_printf("receiver: ping received (");
      debug_printhex32(test_data[0]);
      debug_printf(", ");   
      debug_printhex32(test_data[1]);
      debug_printf(", ");   
      debug_printhex32(test_data[2]);
      debug_printf(", ");   
      debug_printhex32(test_data[3]);
      debug_printf(", ");   
      debug_println(")");
   #else
      printf("receiver: ping received (%d, %d, %d, %d)\n", test_data[0], test_data[1], test_data[2], test_data[3]);
   #endif
}
Example #2
0
void ping_received1(const uint32_t *periodic_100_ms) {
   debug_print("receiver1 ping received");
   debug_printhex32(*periodic_100_ms);
   debug_println("");
   uint32_t newValue = 2*(*periodic_100_ms);
   ping_Output2(&newValue);
}
Example #3
0
void
exec_periodic_thread_B(void)
{
    debug_println("Executing B (periodic)");
	thread_b_read_datap(&B_data); 
	debug_println("Value of B_data after read:"); 
	debug_printhex32(B_data.field); 
	debug_println("task B complete");
}
/* Fatal error function provided for debugging purposes. */
void
fatal(const RtosErrorId error_id)
{
    debug_print("FATAL ERROR: ");
    debug_printhex32(error_id);
    debug_println("");
    /* Disable interrupts */
    asm volatile("wrteei 0");
    for (;;) ;
}
Example #5
0
void
fatal(const RtosErrorId error_id)
{
    debug_print("FATAL ERROR: ");
    debug_printhex32(error_id);
    debug_println("");
    for (;;)
    {
    }
}
Example #6
0
void sender_periodic_ping(const int64_t *the_time) {

	#ifdef __TB_OS_VXWORKS__
		// VxWorks doesn't support long longs for printing.
		printf("sender: periodic dispatch received at time: %d.  Writing to receiver. \n", (int32_t)(*the_time));
	#elif __TB_OS_ECHRONOS__
		debug_print("sender: periodic dispatch received at time ");
		debug_printhex32((uint32_t)*the_time);
		debug_println(".  Writing to receiver.\n");
	#elif __TB_OS_LINUX__
		printf("sender: periodic dispatch received at time: %" PRId64 ".  Writing to receiver. \n", *the_time);
	#else
		printf("sender: periodic dispatch received at time: %lld.  Writing to receiver. \n", *the_time);
	#endif	
	
   uint32_t to_send = ((uint32_t)*the_time) + 1;
   ping_Output1(&to_send);
 	
}
/* Handler for external interrupts.
 * On the P2020, the various external interrupt sources are multiplexed onto the one external interrupt vector by a
 * Programmable Interrupt Controller (PIC).
 * For demo purposes, we just handle each interrupt by raising an interrupt event to a distinct task, for each
 * distinct interrupt source we are able to disambiguate by querying the P2020 PIC. */
bool
exti_interrupt(void)
{
    uint32_t inc_vector;

    debug_print("exti_interrupt: ");

    inc_vector = pic_iack_get();

    debug_printhex32(inc_vector);
    debug_print(": ");

    switch (inc_vector) {
    case PIC_IIV_DUART_EXAMPLE_VECTOR:
        /* The incoming character must be read to clear the interrupt condition */
        if (duart1_rx_ready()) {
            debug_print("DUART1: ");
            debug_putc(duart1_rx_get());
            rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_I);
            if (duart2_rx_ready()) {
                debug_print(", DUART2: ");
                debug_putc(duart2_rx_get());
                rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_K);
            }
        } else if (duart2_rx_ready()) {
            debug_print("DUART2: ");
            debug_putc(duart2_rx_get());
            rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_J);
        }
        debug_println("");
        break;
    case PIC_GT_EXAMPLE_VECTOR(0):
        debug_println("PIC timer A0");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_A);
        break;
    case PIC_GT_EXAMPLE_VECTOR(1):
        debug_println("PIC timer A1");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_B);
        break;
    case PIC_GT_EXAMPLE_VECTOR(2):
        debug_println("PIC timer A2");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_C);
        break;
    case PIC_GT_EXAMPLE_VECTOR(3):
        debug_println("PIC timer A3");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_D);
        break;
    case PIC_GT_EXAMPLE_VECTOR(4):
        debug_println("PIC timer B0");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_E);
        break;
    case PIC_GT_EXAMPLE_VECTOR(5):
        debug_println("PIC timer B1");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_F);
        break;
    case PIC_GT_EXAMPLE_VECTOR(6):
        debug_println("PIC timer B2");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_G);
        break;
    case PIC_GT_EXAMPLE_VECTOR(7):
        debug_println("PIC timer B3");
        rtos_interrupt_event_raise(RTOS_INTERRUPT_EVENT_ID_EVT_H);
        break;
    case PIC_SPURIOUS_VECTOR_CODE:
        debug_println("spurious vector!");
        break;
    default:
        debug_println("unknown vector!");
        break;
    }

    pic_eoi_put();

    return true;
}