Add custom isr.cpp to project

This commit is contained in:
Aadi Desai 2023-06-10 14:04:15 +01:00
parent eb55b06779
commit 4c8687014e
No known key found for this signature in database
2 changed files with 31 additions and 1 deletions

View file

@ -3,7 +3,7 @@ BUILD_DIR?=../build/gsd_orangecrab/
include $(BUILD_DIR)/software/include/generated/variables.mak include $(BUILD_DIR)/software/include/generated/variables.mak
include $(SOC_DIRECTORY)/software/common.mak include $(SOC_DIRECTORY)/software/common.mak
OBJECTS = audio.o can.o crt0.o donut.o led.o main.o OBJECTS = audio.o can.o crt0.o donut.o isr.o led.o main.o
CFLAGS += -DWITH_CXX CFLAGS += -DWITH_CXX

30
demo/isr.cpp Normal file
View file

@ -0,0 +1,30 @@
// This file is Copyright (c) 2013-2014 Sebastien Bourdeauducq <sb@m-labs.hk>
// This file is Copyright (c) 2019 Gabriel L. Somlo <gsomlo@gmail.com>
// This file is Copyright (c) 2020 Raptor Engineering, LLC <sales@raptorengineering.com>
// License: BSD
#include "can"
#include <generated/csr.h>
#include <generated/soc.h>
#include <irq.h>
#include <libbase/uart.h>
#include <stdio.h>
#ifdef CONFIG_CPU_HAS_INTERRUPT
void isr(void) {
__attribute__((unused)) unsigned int irqs;
irqs = irq_pending() & irq_getmask();
#ifdef CSR_UART_BASE
#ifndef UART_POLLING
if (irqs & (1 << UART_INTERRUPT))
uart_isr();
#endif
#ifdef CAN_INTERRUPT
if (irqs & (1 << CAN_INTERRUPT))
can_isr();
#endif
#endif
}
#endif