void c_irq_handler(volatile unsigned int* sp) { unsigned int pendingIrq = Arm_IrqGetPending(); switch (pendingIrq) { case interrupt_source_system_timer: { // Note IRQ has no acccess to peripherals? :( Scheduler_TimerTick((thread_regs*)(sp - 1)); break; } case interrupt_source_uart: { unsigned char read = Uart_Read(); // Echo it back Uart_Send(read); if (read == 'x') { Uart_SendString("\r\n* * * Rebooting. * * *\r\n"); reboot(); } break; } default: printf("Unhandled IRQ pending, id:%d.\n", pendingIrq); break; } }
int32_t irobotUARTReadRaw( const irobotUARTPort_t port, uint8_t * const data, const size_t nData ){ // catch NULL pointers if(!data){ return ERROR_INVALID_PARAMETER; } else{ return Uart_Read(port, data, nData); } }