Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions cpu/src/kernel/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*----------------------------------------------------------------------

This file is part of Freetribe

https://github.com/bangcorrupt/freetribe

AGPL-3.0-or-later

----------------------------------------------------------------------*/

/**
* @file config.h
*
* @brief Central configuration for CPU interrupt channels.
*/

#ifndef FREETRIBE_CONFIG_H
#define FREETRIBE_CONFIG_H

#define FREETRIBE_DSP_SPI_INT_CHANNEL 5
#define FREETRIBE_LCD_SPI_INT_CHANNEL 8
#define FREETRIBE_MCU_UART_INT_CHANNEL 7
#define FREETRIBE_TRS_UART_INT_CHANNEL 6
#define FREETRIBE_CLOCK_INT_CHANNEL 5
#define FREETRIBE_SYSTICK_INT_CHANNEL 9

#endif
4 changes: 3 additions & 1 deletion cpu/src/kernel/device/dev_dsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ under the terms of the GNU Affero General Public License as published by

#include "dev_dsp.h"

#include "config.h"

#include "ring_buffer.h"

/*----- Macros -------------------------------------------------------*/
Expand All @@ -57,7 +59,7 @@ under the terms of the GNU Affero General Public License as published by

/// TODO: Centralised header for interrupt priorities.
// This should probably be lower priority than UART control input.
#define DSP_SPI_INT_CHANNEL 5
#define DSP_SPI_INT_CHANNEL FREETRIBE_DSP_SPI_INT_CHANNEL

#define DSP_SPI_INT_LEVEL SPI_INT_LEVEL_TX_RX_TIMEOUT_DESYNC

Expand Down
4 changes: 3 additions & 1 deletion cpu/src/kernel/device/dev_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ under the terms of the GNU Affero General Public License as published by

#include "dev_lcd.h"

#include "config.h"

#include "svc_delay.h"

/*----- Macros -------------------------------------------------------*/

#define LCD_SPI 0

#define LCD_SPI_INT_CHANNEL 8
#define LCD_SPI_INT_CHANNEL FREETRIBE_LCD_SPI_INT_CHANNEL
#define LCD_SPI_INT_LEVEL SPI_INT_LEVEL_TX
#define LCD_SPI_PIN_FUNC SPI_PIN_SIMO | SPI_PIN_CLK | SPI_PIN_CS0

Expand Down
4 changes: 3 additions & 1 deletion cpu/src/kernel/device/dev_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ under the terms of the GNU Affero General Public License as published by

#include "dev_mcu.h"

#include "config.h"

#include "ring_buffer.h"

/*----- Macros -------------------------------------------------------*/
Expand All @@ -53,7 +55,7 @@ under the terms of the GNU Affero General Public License as published by

#define MCU_UART UART_0

#define MCU_UART_INT_CHANNEL 7
#define MCU_UART_INT_CHANNEL FREETRIBE_MCU_UART_INT_CHANNEL

#define MCU_TX_BUF_LEN 0x200
#define MCU_RX_BUF_LEN 0x200
Expand Down
4 changes: 3 additions & 1 deletion cpu/src/kernel/device/dev_trs.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ under the terms of the GNU Affero General Public License as published by

#include "per_uart.h"

#include "config.h"

#include "ring_buffer.h"

/*----- Macros -------------------------------------------------------*/

/// TODO: Centralised header for interrupt priorities and queue sizes.

#define TRS_UART UART_1
#define TRS_UART_INT_CHANNEL 6
#define TRS_UART_INT_CHANNEL FREETRIBE_TRS_UART_INT_CHANNEL

#define TRS_TX_BUF_LEN 0x200
#define TRS_RX_BUF_LEN 0x200
Expand Down
4 changes: 3 additions & 1 deletion cpu/src/kernel/service/svc_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ under the terms of the GNU Affero General Public License as published by

#include "per_timer.h"

#include "config.h"

/*----- Macros -------------------------------------------------------*/

#define CLOCK_TIMER SOC_TMR_2_REGS
Expand All @@ -54,7 +56,7 @@ under the terms of the GNU Affero General Public License as published by
TMR_CFG_32BIT_UNCH_CLK_BOTH_INT & ~TMR_TGCR_TIM34RS & ~TMR_TGCR_PLUSEN

#define CLOCK_INT TMR_INT_TMR12_NON_CAPT_MODE
#define CLOCK_INT_CHAN 5
#define CLOCK_INT_CHAN FREETRIBE_CLOCK_INT_CHANNEL

/*----- Typedefs -----------------------------------------------------*/

Expand Down
4 changes: 3 additions & 1 deletion cpu/src/kernel/service/svc_systick.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ under the terms of the GNU Affero General Public License as published by

#include "per_timer.h"

#include "config.h"

/*----- Macros -------------------------------------------------------*/

#define SYSTICK_TIMER SOC_TMR_0_REGS
Expand All @@ -57,7 +59,7 @@ under the terms of the GNU Affero General Public License as published by
/// TODO: Single header file with interrupt priorities.
//
// Lowest priority. SPI0 is 8.
#define SYSTICK_INT_CHAN 9 // 8
#define SYSTICK_INT_CHAN FREETRIBE_SYSTICK_INT_CHANNEL

/*----- Typedefs -----------------------------------------------------*/

Expand Down