Update repo

This commit is contained in:
hangpersonal committed 2026-08-30 23:04:35 -07:00
1 parent 749dab5721
commit ce65a0f59a
14950 files changed
+4408250 -1

No files matched your search

@@ -0,0 +1,28 @@
<projectSpec>
<project
name="interrupt_ex1_external"
device="TMS320F28377D"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 "/>
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --define=_FLASH -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../interrupt_ex1_external.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,28 @@
<projectSpec>
<project
name="interrupt_ex2_with_i2c_sci_spi_loopback"
device="TMS320F28377D"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --define=_FLASH --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../interrupt_ex2_with_i2c_sci_spi_loopback.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,30 @@
<projectSpec>
<project
name="interrupt_ex3_sw_prioritization"
device="TMS320F28377D"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=0 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON_INCLUDE} -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 "/>
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=0 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON_INCLUDE} --define=_FLASH -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_COMMON_INCLUDE" path="../../../../../../device_support/f2837xd/common/include/" scope="project" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../interrupt_ex3_sw_prioritization.c" targetDirectory="" />
<file action="copy" path="../sw_prioritized_isr_levels.h" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,280 @@
//###########################################################################
//
// FILE: interrupt_ex1_external.c
//
// TITLE: External Interrupt test program.
//
//! \addtogroup driver_example_list
//! <h1>External Interrupts (ExternalInterrupt)</h1>
//!
//! This program sets up GPIO0 as XINT1 and GPIO1 as XINT2. Two other
//! GPIO signals are used to trigger the interrupt (GPIO30 triggers
//! XINT1 and GPIO31 triggers XINT2). The user is required to
//! externally connect these signals for the program to work
//! properly.
//!
//! XINT1 input is synced to SYSCLKOUT.
//!
//! XINT2 has a long qualification - 6 samples at 510*SYSCLKOUT each.
//!
//! GPIO34 will go high outside of the interrupts and low within the
//! interrupts. This signal can be monitored on a scope.
//!
//! Each interrupt is fired in sequence - XINT1 first and then XINT2
//!
//! \b External \b Connections \n
//! - Connect GPIO30 to GPIO0. GPIO0 will be assigned to XINT1
//! - Connect GPIO31 to GPIO1. GPIO1 will be assigned to XINT2
//!
//! Monitor GPIO34 with an oscilloscope. GPIO34 will be high outside of the
//! ISRs and low within each ISR.
//!
//! \b Watch \b Variables \n
//! - XINT1Count for the number of times through XINT1 interrupt
//! - XINT2Count for the number of times through XINT2 interrupt
//! - loopCount for the number of times through the idle loop
//!
//
//###########################################################################
//
//
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
//
// Defines
//
#define CPU_RATE 5.00L
#define DELAY (CPU_RATE/1000*6*510) //Qual period at 6 samples
//
// Globals
//
volatile uint32_t XINT1Count;
volatile uint32_t XINT2Count;
volatile uint32_t loopCount;
//
// Function Prototypes
//
interrupt void xint1_isr(void);
interrupt void xint2_isr(void);
//
// Main
//
void main(void)
{
uint32_t tempX1Count;
uint32_t tempX2Count;
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pullups
//
//Device_initGPIO(); // Skipped for this example
//
// Initialize PIE and clear PIE registers. Disables CPU interrups
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR)
//
Interrupt_initVectorTable();
//
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
//
Interrupt_register(INT_XINT1, &xint1_isr);
Interrupt_register(INT_XINT2, &xint2_isr);
//
// User specific code, enable interrupts:
//
// Clear the counters
//
XINT1Count = 0; // Count XINT1 interrupts
XINT2Count = 0; // Count XINT2 interrupts
loopCount = 0; // Count times through idle loop
//
// Enable XINT1 and XINT2 in the PIE: Group 1 interrupt 4 & 5
// Enable INT1 which is connected to WAKEINT:
//
Interrupt_enable(INT_XINT1);
Interrupt_enable(INT_XINT2);
EINT; // Enable Global Interrupts
//
// GPIO30 & GPIO31 are outputs, start GPIO30 high and GPIO31 low
//
// Load the output latch
GPIO_setPortPins(GPIO_PORT_A,GPIO_GPADIR_GPIO30);
GPIO_setDirectionMode(30,GPIO_DIR_MODE_OUT); // output
// Load the output latch
GPIO_clearPortPins(GPIO_PORT_A,GPIO_GPADIR_GPIO31);
GPIO_setDirectionMode(31,GPIO_DIR_MODE_OUT); // output
//
// GPIO0 and GPIO1 are inputs
//
GPIO_setDirectionMode(0,GPIO_DIR_MODE_IN); // input
// XINT1 Synch to SYSCLKOUT only
GPIO_setQualificationMode(0, GPIO_QUAL_SYNC);
GPIO_setDirectionMode(1,GPIO_DIR_MODE_IN); // input
// XINT2 Qual using 6 samples
GPIO_setQualificationMode(1, GPIO_QUAL_6SAMPLE);
// Set qualification period for GPIO0 to GPIO7
// Each sampling window is 510*SYSCLKOUT
GPIO_setQualificationPeriod(3,510);
//
// GPIO0 is XINT1, GPIO1 is XINT2
//
GPIO_setInterruptPin(0,GPIO_INT_XINT1);
GPIO_setInterruptPin(1,GPIO_INT_XINT2);
//
// Configure XINT1
//
// Falling edge interrupt
GPIO_setInterruptType(GPIO_INT_XINT1, GPIO_INT_TYPE_FALLING_EDGE);
// Rising edge interrupt
GPIO_setInterruptType(GPIO_INT_XINT2, GPIO_INT_TYPE_RISING_EDGE);
//
// Enable XINT1 and XINT2
//
GPIO_enableInterrupt(GPIO_INT_XINT1); // Enable XINT1
GPIO_enableInterrupt(GPIO_INT_XINT2); // Enable XINT2
//
// GPIO34 will go low inside each interrupt. Monitor this on a scope
//
GPIO_setDirectionMode(34,GPIO_DIR_MODE_OUT); // output
//
// IDLE loop:
//
for(;;)
{
tempX1Count = XINT1Count;
tempX2Count = XINT2Count;
//
// Trigger both XINT1
//
GPIO_setPortPins(GPIO_PORT_B,GPIO_GPBDIR_GPIO34); // GPIO34 is high
// Lower GPIO30, trigger XINT1
GPIO_clearPortPins(GPIO_PORT_A,GPIO_GPADIR_GPIO30);
while(XINT1Count == tempX1Count) {}
//
// Trigger both XINT2
//
GPIO_setPortPins(GPIO_PORT_B,GPIO_GPBDIR_GPIO34); // GPIO34 is high
DEVICE_DELAY_US(DELAY); // Wait for Qual period
// Raise GPIO31, trigger XINT2
GPIO_setPortPins(GPIO_PORT_A,GPIO_GPADIR_GPIO31);
while(XINT2Count == tempX2Count) {}
//
// Check that the counts were incremented properly and get ready
// to start over.
//
if(XINT1Count == tempX1Count + 1 && XINT2Count == tempX2Count + 1)
{
loopCount++;
//raise GPIO30
GPIO_setPortPins(GPIO_PORT_A,GPIO_GPADIR_GPIO30);
// lower GPIO31
GPIO_clearPortPins(GPIO_PORT_A,GPIO_GPADIR_GPIO31);
Example_PassCount++;
}
else
{
Example_Fail = 1;
asm(" ESTOP0"); // stop here
}
}
}
//
// xint1_isr - External Interrupt 1 ISR
//
interrupt void xint1_isr(void)
{
GPIO_clearPortPins(GPIO_PORT_B,GPIO_GPBDIR_GPIO34); //GPIO34 is low
XINT1Count++;
//
// Acknowledge this interrupt to get more from group 1
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
//
// xint2_isr - External Interrupt 2 ISR
//
interrupt void xint2_isr(void)
{
GPIO_clearPortPins(GPIO_PORT_B,GPIO_GPBDIR_GPIO34); // GPIO34 is low
XINT2Count++;
//
// Acknowledge this interrupt to get more from group 1
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
//
// End of file
//
@@ -0,0 +1,568 @@
//#############################################################################
//
// FILE: interrupt_ex2_with_i2c_sci_spi_loopback.c
//
// TITLE: Multiple interrupt handling of I2C, SCI & SPI Digital Loopback
//
//! \addtogroup driver_example_list
//! <h1>Multiple interrupt handling of I2C, SCI & SPI Digital Loopback</h1>
//!
//! This program is used to demonstrate how to handle multiple interrupts
//! when using multiple communication peripherals like I2C, SCI & SPI
//! Digital Loopback all in a single example. The data transfers would
//! be done with FIFO Interrupts.
//!
//! It uses the internal loopback test mode of these modules. Both
//! the TX and RX FIFOs and their interrupts are used.
//! Other than boot mode pin configuration, no other hardware configuration
//! is required.
//!
//! A stream of data is sent and then compared to the received stream.
//! The sent data looks like this for I2C and SCI: \n
//! 0000 0001 \n
//! 0001 0002 \n
//! 0002 0003 \n
//! .... \n
//! 00FE 00FF \n
//! 00FF 0000 \n
//! etc.. \n
//!
//! The sent data looks like this for SPI: \n
//! 0000 0001 \n
//! 0001 0002 \n
//! 0002 0003 \n
//! .... \n
//! FFFE FFFF \n
//! FFFF 0000 \n
//! etc.. \n
//!
//! This pattern is repeated forever.
//!
//! \b External \b Connections \n
//! - None
//!
//! \b Watch \b Variables \n
//! - \b sDatai2cA - Data to send through I2C
//! - \b rDatai2cA - Received I2C data
//! - \b rDataPoint - Used to keep track of the last position in the receive
//! I2C stream for error checking
//!
//! - \b sDataspiA - Data to send through SPI
//! - \b rDataspiA - Received SPI data
//! - \b rDataPointspiA - Used to keep track of the last position in the receive
//! SPI stream for error checking
//!
//! - \b sDatasciA - SCI Data being sent
//! - \b rDatasciA - SCI Data received
//! - \b rDataPointA - Keep track of where we are in the SCI data stream.
//! This is used to check the incoming data
//!
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
//
// Defines
//
#define SLAVE_ADDRESS 0x3C
//
// Globals
//
//
// I2C data Globals
//
uint16_t sDatai2cA[2]; // Send I2CA data buffer
uint16_t rDatai2cA[2]; // Receive I2CA data buffer
uint16_t rDataPoint = 0; // To keep track of where we are in the
// data stream to check received I2C data
//
// SCI data Globals
//
uint16_t sDatasciA[2]; // Send SCI-A data buffer
uint16_t rDatasciA[2]; // Receive SCI-A data buffer
uint16_t rDataPointA = 0; // Used for checking the received SCI data
//
// SPI data Globals
//
uint16_t sDataspiA[2]; // Send SPI data buffer
uint16_t rDataspiA[2]; // Receive SPI data buffer
uint16_t rDataPointspiA = 0; // To keep track of where we are in the
// data stream to check received SPI data
//
// Function Prototypes
//
void initI2CFIFO(void);
__interrupt void i2cFIFOISR(void);
__interrupt void sciaTXFIFOISR(void);
__interrupt void sciaRXFIFOISR(void);
void initSCIAFIFO(void);
void initSPIFIFO(void);
__interrupt void spiTxFIFOISR(void);
__interrupt void spiRxFIFOISR(void);
//
// Main
//
void main(void)
{
uint16_t i;
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Interrupts that are used in this example are re-mapped to ISR functions
// found within this file.
//
Interrupt_register(INT_I2CA_FIFO, &i2cFIFOISR);
Interrupt_register(INT_SCIA_RX, &sciaRXFIFOISR);
Interrupt_register(INT_SCIA_TX, &sciaTXFIFOISR);
Interrupt_register(INT_SPIA_TX, &spiTxFIFOISR);
Interrupt_register(INT_SPIA_RX, &spiRxFIFOISR);
//
// Set I2C use, initializing it for FIFO mode
//
initI2CFIFO();
//
// Set SCI use, initializing it for FIFO mode
//
initSCIAFIFO();
//
// Set up SPI, initializing it for FIFO mode
//
initSPIFIFO();
//
// Initialize the I2C data buffers
//
for(i = 0; i < 2; i++)
{
sDatai2cA[i] = i;
rDatai2cA[i]= 0;
}
//
// Init the SCI send data. After each transmission this data
// will be updated for the next transmission
//
for(i = 0; i < 2; i++)
{
sDatasciA[i] = i;
}
//
// Initialize the SPI data buffers
//
for(i = 0; i < 2; i++)
{
sDataspiA[i] = i;
rDataspiA[i]= 0;
}
//
// Enable interrupts required for this example
//
Interrupt_enable(INT_I2CA_FIFO);
Interrupt_enable(INT_SCIA_RX);
Interrupt_enable(INT_SCIA_TX);
Interrupt_enable(INT_SPIA_TX);
Interrupt_enable(INT_SPIA_RX);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop forever. Suspend or place breakpoints to observe the buffers.
//
while(1)
{
// A FIFO interrupt will be generated for each Tx and Rx based
// on the Interrupt levels configured for each of the modules.
}
}
//
// Function to configure I2C A in FIFO mode.
//
void initI2CFIFO()
{
//
// Must put I2C into reset before configuring it
//
I2C_disableModule(I2CA_BASE);
//
// I2C configuration. Use a 400kHz I2CCLK with a 50% duty cycle.
//
I2C_initMaster(I2CA_BASE, DEVICE_SYSCLK_FREQ, 400000, I2C_DUTYCYCLE_50);
I2C_setConfig(I2CA_BASE, I2C_MASTER_SEND_MODE);
I2C_setDataCount(I2CA_BASE, 2);
I2C_setBitCount(I2CA_BASE, I2C_BITCOUNT_8);
//
// Configure for internal loopback mode
//
I2C_setSlaveAddress(I2CA_BASE, SLAVE_ADDRESS);
I2C_setOwnSlaveAddress(I2CA_BASE, SLAVE_ADDRESS);
I2C_enableLoopback(I2CA_BASE);
I2C_setEmulationMode(I2CA_BASE, I2C_EMULATION_STOP_SCL_LOW);
//
// FIFO and interrupt configuration
//
I2C_enableFIFO(I2CA_BASE);
I2C_clearInterruptStatus(I2CA_BASE, I2C_INT_RXFF | I2C_INT_TXFF);
//
// Transmit FIFO interrupt levels are set to generate an interrupt
// when the 16 byte TX fifo contains 2 or lesser bytes of data.
// Receive FIFO interrupt levels are set to generate an interrupt
// when the 16 byte RX fifo contains 2 or greater bytes of data.
//
I2C_setFIFOInterruptLevel(I2CA_BASE, I2C_FIFO_TX2, I2C_FIFO_RX2);
I2C_enableInterrupt(I2CA_BASE, I2C_INT_RXFF | I2C_INT_TXFF);
//
// Configuration complete. Enable the module.
//
I2C_enableModule(I2CA_BASE);
}
//
// I2C A Transmit & Receive FIFO ISR.
// The ISR will handle pushing/pulling data to/from the TX and
// RX FIFOs resp.
//
__interrupt void i2cFIFOISR(void)
{
uint16_t i;
//
// If receive FIFO interrupt flag is set, read data
//
if((I2C_getInterruptStatus(I2CA_BASE) & I2C_INT_RXFF) != 0)
{
for(i = 0; i < 2; i++)
{
rDatai2cA[i] = I2C_getData(I2CA_BASE);
}
//
// Check received data
//
for(i = 0; i < 2; i++)
{
if(rDatai2cA[i] != ((rDataPoint + i) & 0xFF))
{
//
// Something went wrong. rDatai2cA doesn't contain expected data.
//
ESTOP0;
}
}
rDataPoint = (rDataPoint + 1) & 0xFF;
//
// Clear interrupt flag
//
I2C_clearInterruptStatus(I2CA_BASE, I2C_INT_RXFF);
}
//
// If transmit FIFO interrupt flag is set, put data in the buffer
//
else if((I2C_getInterruptStatus(I2CA_BASE) & I2C_INT_TXFF) != 0)
{
for(i = 0; i < 2; i++)
{
I2C_putData(I2CA_BASE, sDatai2cA[i]);
}
//
// Send the start condition
//
I2C_sendStartCondition(I2CA_BASE);
//
// Increment data for next cycle
//
for(i = 0; i < 2; i++)
{
sDatai2cA[i] = (sDatai2cA[i] + 1) & 0xFF;
}
//
// Clear interrupt flag
//
I2C_clearInterruptStatus(I2CA_BASE, I2C_INT_TXFF);
}
//
// Issue ACK
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP8);
}
//
// sciaTXFIFOISR - SCIA Transmit FIFO ISR
//
__interrupt void sciaTXFIFOISR(void)
{
uint16_t i;
SCI_writeCharArray(SCIA_BASE, sDatasciA, 2);
//
// Increment send data for next cycle
//
for(i = 0; i < 2; i++)
{
sDatasciA[i] = (sDatasciA[i] + 1) & 0x00FF;
}
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_TXFF);
//
// Issue PIE ACK
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
//
// sciaRXFIFOISR - SCIA Receive FIFO ISR
//
__interrupt void sciaRXFIFOISR(void)
{
uint16_t i;
SCI_readCharArray(SCIA_BASE, rDatasciA, 2);
//
// Check received data
//
for(i = 0; i < 2; i++)
{
if(rDatasciA[i] != ((rDataPointA + i) & 0x00FF))
{
//
// Something went wrong. rDatasciA doesn't contain expected data.
//
ESTOP0;
}
}
rDataPointA = (rDataPointA + 1) & 0x00FF;
SCI_clearOverflowStatus(SCIA_BASE);
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_RXFF);
//
// Issue PIE ack
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
//
// initSCIAFIFO - Configure SCIA FIFO
//
void initSCIAFIFO()
{
//
// 8 char bits, 1 stop bit, no parity. Baud rate is 9600.
//
SCI_setConfig(SCIA_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 |
SCI_CONFIG_STOP_ONE |
SCI_CONFIG_PAR_NONE));
SCI_enableModule(SCIA_BASE);
SCI_enableLoopback(SCIA_BASE);
SCI_resetChannels(SCIA_BASE);
SCI_enableFIFO(SCIA_BASE);
//
// RX and TX FIFO Interrupts Enabled
//
SCI_enableInterrupt(SCIA_BASE, (SCI_INT_RXFF | SCI_INT_TXFF));
SCI_disableInterrupt(SCIA_BASE, SCI_INT_RXERR);
//
// The transmit FIFO generates an interrupt when FIFO status
// bits are less than or equal to 2 out of 16 words
// The receive FIFO generates an interrupt when FIFO status
// bits are greater than equal to 2 out of 16 words
//
SCI_setFIFOInterruptLevel(SCIA_BASE, SCI_FIFO_TX2, SCI_FIFO_RX2);
SCI_performSoftwareReset(SCIA_BASE);
SCI_resetTxFIFO(SCIA_BASE);
SCI_resetRxFIFO(SCIA_BASE);
}
//
// Function to configure SPI A in FIFO mode.
//
void initSPIFIFO()
{
//
// Must put SPI into reset before configuring it
//
SPI_disableModule(SPIA_BASE);
//
// SPI configuration. Use a 500kHz SPICLK and 16-bit word size.
//
SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0,
SPI_MODE_MASTER, 500000, 16);
SPI_enableLoopback(SPIA_BASE);
SPI_setEmulationMode(SPIA_BASE, SPI_EMULATION_STOP_AFTER_TRANSMIT);
//
// FIFO and interrupt configuration
//
SPI_enableFIFO(SPIA_BASE);
SPI_clearInterruptStatus(SPIA_BASE, SPI_INT_RXFF | SPI_INT_TXFF);
SPI_setFIFOInterruptLevel(SPIA_BASE, SPI_FIFO_TX2, SPI_FIFO_RX2);
SPI_enableInterrupt(SPIA_BASE, SPI_INT_RXFF | SPI_INT_TXFF);
//
// Configuration complete. Enable the module.
//
SPI_enableModule(SPIA_BASE);
}
//
// SPI A Transmit FIFO ISR
//
__interrupt void spiTxFIFOISR(void)
{
uint16_t i;
//
// Send data
//
for(i = 0; i < 2; i++)
{
SPI_writeDataNonBlocking(SPIA_BASE, sDataspiA[i]);
}
//
// Increment data for next cycle
//
for(i = 0; i < 2; i++)
{
sDataspiA[i] = sDataspiA[i] + 1;
}
//
// Clear interrupt flag and issue ACK
//
SPI_clearInterruptStatus(SPIA_BASE, SPI_INT_TXFF);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP6);
}
//
// SPI A Receive FIFO ISR
//
__interrupt void spiRxFIFOISR(void)
{
uint16_t i;
//
// Read data
//
for(i = 0; i < 2; i++)
{
rDataspiA[i] = SPI_readDataNonBlocking(SPIA_BASE);
}
//
// Check received data
//
for(i = 0; i < 2; i++)
{
if(rDataspiA[i] != (rDataPointspiA + i))
{
// Something went wrong. rDataspiA doesn't contain expected data.
ESTOP0;
}
}
rDataPointspiA++;
//
// Clear interrupt flag and issue ACK
//
SPI_clearInterruptStatus(SPIA_BASE, SPI_INT_RXFF);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP6);
}
//
// End of File
//
@@ -0,0 +1,424 @@
//#############################################################################
//
// FILE: interrupt_ex3_sw_prioritization.c
//
// TITLE: CPU Timer Interrupt Software Prioritization
//
//! \addtogroup driver_example_list
//! <h1> CPU Timer Interrupt Software Prioritization </h1>
//!
//! This examples demonstrates the software prioritization of interrupts
//! through CPU Timer Interrupts. Software prioritization of interrupts is
//! achieved by enabling interrupt nesting.
//!
//! In this device, hardware priorities for CPU Timer 0, 1 and 2 are set
//! as timer 0 being highest priority and timer 2 being lowest priority.
//! This example configures CPU Timer0, 1, and 2 priority in software with
//! timer 2 priority being highest and timer 0 being lowest in software and
//! prints a trace for the order of execution.
//!
//! For most applications, the hardware prioritizing of the interrupts is
//! sufficient. For applications that need custom prioritizing, this example
//! illustrates how this can be done through software.User specific priorities
//! can be configured in sw_prioritized_isr_level.h header file.
//!
//! To enable interrupt nesting, following sequence needs to followed in ISRs.
//! <b>Step 1:</b> Set the global priority:
//! Modify the IER register to allow CPU interrupts with a higher user
//! priority to be serviced.
//! Note: at this time IER has already been saved on the stack.
//! <b>Step 2:</b> Set the group priority: (optional)
//! Modify the appropriate PIEIERx register to allow group interrupts with a
//! higher user set priority to be serviced. Do NOT clear PIEIER register bits
//! from another group other than that being serviced by this ISR. Doing so
//! can cause erroneous interrupts to occur.
//! <b>Step 3:</b> Enable interrupts: There are three steps to do this:
//! a. Clear the PIEACK bits
//! b. Wait at least one cycle
//! c. Clear the INTM bit.
//! <b>Step 4:</b> Run the main part of the ISR
//! <b>Step 5:</b> Set INTM to disable interrupts.
//! <b>Step 6:</b> Restore PIEIERx (optional depending on step 2)
//! <b>Step 7:</b> Return from ISR
//!
//! Refer to below link on more details on Interrupt nesting in C28x devices:
//! <C2000Ware>\docs\c28x_interrupt_nesting\html\index.html
//!
//! \b External \b Connections \n
//! - None
//!
//! \b Watch \b Variables \n
//! - traceISR - shows the order in which ISRs are executed.
//!
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
#include "sw_prioritized_isr_levels.h"
//
// Defines
//
#define TRACE_SIZE 51U
//
// Globals
//
uint16_t cpuTimer0IntCount;
uint16_t cpuTimer1IntCount;
uint16_t cpuTimer2IntCount;
//
// This array will be used as a trace to check the
// order that the interrupts were serviced
//
uint16_t traceISR[TRACE_SIZE];
//
// Index to update an element in the trace buffer
//
uint16_t traceISRIndex = 0;
//
// Function Prototypes
//
__interrupt void cpuTimer0ISR(void);
__interrupt void cpuTimer1ISR(void);
__interrupt void cpuTimer2ISR(void);
void initCPUTimers(void);
void configCPUTimer(uint32_t, float, float);
//
// Main
//
void main(void)
{
uint32_t i;
//
// Initializes device clock and peripherals
//
Device_init();
//
// Configures the GPIO pin as a push-pull output
//
Device_initGPIO();
GPIO_setPinConfig(DEVICE_GPIO_CFG_LED1);
GPIO_setMasterCore(DEVICE_GPIO_PIN_LED1, GPIO_CORE_CPU1);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
//
// Initializes PIE and clears PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initializes the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// ISRs for each CPU Timer interrupt
//
Interrupt_register(INT_TIMER0, &cpuTimer0ISR);
Interrupt_register(INT_TIMER1, &cpuTimer1ISR);
Interrupt_register(INT_TIMER2, &cpuTimer2ISR);
//
// Reset the ISR trace
//
for(i = 0; i < TRACE_SIZE; i++)
{
traceISR[i] = 0;
}
//
// Initializes the Device Peripheral. For this example, only initialize the
// Cpu Timers.
//
initCPUTimers();
//
// Configure CPU-Timer 0, 1, and 2 to interrupt every second:
// 1 second Period (in uSeconds)
//
configCPUTimer(CPUTIMER0_BASE, DEVICE_SYSCLK_FREQ, 1000000);
configCPUTimer(CPUTIMER1_BASE, DEVICE_SYSCLK_FREQ, 1000000);
configCPUTimer(CPUTIMER2_BASE, DEVICE_SYSCLK_FREQ, 1000000);
//
// To ensure precise timing, use write-only instructions to write to the
// entire register. Therefore, if any of the configuration bits are changed
// in configCPUTimer and initCPUTimers, the below settings must also
// be updated.
//
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
CPUTimer_enableInterrupt(CPUTIMER1_BASE);
CPUTimer_enableInterrupt(CPUTIMER2_BASE);
//
// Enables CPU int1, int13, and int14 which are connected to CPU-Timer 0,
// CPU-Timer 1, and CPU-Timer 2 respectively.
// Enable TINT0 in the PIE: Group 1 interrupt 7
//
Interrupt_enable(INT_TIMER0);
Interrupt_enable(INT_TIMER1);
Interrupt_enable(INT_TIMER2);
//
// Starts CPU-Timer 0, CPU-Timer 1, and CPU-Timer 2.
//
CPUTimer_startTimer(CPUTIMER0_BASE);
CPUTimer_startTimer(CPUTIMER1_BASE);
CPUTimer_startTimer(CPUTIMER2_BASE);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// IDLE loop. Just sit and loop forever (optional)
//
while(1)
{
}
}
//
// initCPUTimers - This function initializes all three CPU timers
// to a known state.
//
void
initCPUTimers(void)
{
//
// Initialize timer period to maximum
//
CPUTimer_setPeriod(CPUTIMER0_BASE, 0xFFFFFFFF);
CPUTimer_setPeriod(CPUTIMER1_BASE, 0xFFFFFFFF);
CPUTimer_setPeriod(CPUTIMER2_BASE, 0xFFFFFFFF);
//
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
//
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_setPreScaler(CPUTIMER1_BASE, 0);
CPUTimer_setPreScaler(CPUTIMER2_BASE, 0);
//
// Make sure timer is stopped
//
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_stopTimer(CPUTIMER1_BASE);
CPUTimer_stopTimer(CPUTIMER2_BASE);
//
// Reload all counter register with period value
//
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER1_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER2_BASE);
//
// Reset interrupt counter
//
cpuTimer0IntCount = 0;
cpuTimer1IntCount = 0;
cpuTimer2IntCount = 0;
}
//
// configCPUTimer - This function initializes the selected timer to the
// period specified by the "freq" and "period" parameters. The "freq" is
// entered as Hz and the period in uSeconds. The timer is held in the stopped
// state after configuration.
//
void
configCPUTimer(uint32_t cpuTimer, float freq, float period)
{
uint32_t temp;
//
// Initialize timer period:
//
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(cpuTimer, temp);
//
// Set pre-scale counter to divide by 1 (SYSCLKOUT):
//
CPUTimer_setPreScaler(cpuTimer, 0);
//
// Initializes timer control register. The timer is stopped, reloaded,
// free run disabled, and interrupt enabled.
// Additionally, the free and soft bits are set
//
CPUTimer_stopTimer(cpuTimer);
CPUTimer_reloadTimerCounter(cpuTimer);
CPUTimer_setEmulationMode(cpuTimer,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(cpuTimer);
//
// Resets interrupt counters for the three cpuTimers
//
if (cpuTimer == CPUTIMER0_BASE)
{
cpuTimer0IntCount = 0;
}
else if(cpuTimer == CPUTIMER1_BASE)
{
cpuTimer1IntCount = 0;
}
else if(cpuTimer == CPUTIMER2_BASE)
{
cpuTimer2IntCount = 0;
}
}
//
// cpuTimer0ISR - Counter for CpuTimer0
//
__interrupt void
cpuTimer0ISR(void)
{
//
// Save IER register on stack
//
volatile uint16_t tempPIEIER = HWREGH(PIECTRL_BASE + PIE_O_IER1);
//
// Set the global and group priority to allow CPU interrupts
// with higher priority
//
IER |= M_INT1;
IER &= MINT1;
HWREGH(PIECTRL_BASE + PIE_O_IER1) &= MG1_7;
//
// Enable Interrupts
//
Interrupt_clearACKGroup(0xFFFFU);
__asm(" NOP");
EINT;
//
// Insert ISR code here
//
cpuTimer0IntCount++;
//
// Disable interrupts and restore registers saved:
//
DINT;
HWREGH(PIECTRL_BASE + PIE_O_IER1) = tempPIEIER;
//
// Add ISR to Trace
//
traceISR[traceISRIndex % TRACE_SIZE] = 0x0017;
traceISRIndex++;
}
//
// cpuTimer1ISR - Counter for CpuTimer1
//
__interrupt void
cpuTimer1ISR(void)
{
//
// Set the global priority to allow CPU interrupts with higher priority
//
IER &= MINT13;
EINT;
//
// Insert ISR code here
//
cpuTimer1IntCount++;
//
// Disable Interrupts
//
DINT;
//
// Add ISR to Trace
//
traceISR[traceISRIndex % TRACE_SIZE] = 0x00D0;
traceISRIndex++;
}
//
// cpuTimer2ISR - Counter for CpuTimer2
//
__interrupt void
cpuTimer2ISR(void)
{
IER &= MINT14; // Set "global" priority
EINT;
//
// Insert ISR code here
//
cpuTimer2IntCount++;
//
// Disable interrupts
//
DINT;
//
// Add ISR to Trace
//
traceISR[traceISRIndex % TRACE_SIZE] = 0x00E0;
traceISRIndex++;
}
//
// End of File
//
@@ -0,0 +1,366 @@
//###########################################################################
//
// FILE: sw_prioritized_isr_levels.h
//
// TITLE: Software Prioritized Interrupt Service Routine Level
// definitions.
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2013-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
#ifndef SW_PRIORITZIED_ISR_LEVELS_H
#define SW_PRIORITZIED_ISR_LEVELS_H
#ifdef __cplusplus
extern "C" {
#endif
//
// Mask for interrupt groups
//
#define M_INT1 0x0001 // INT1 Mask
#define M_INT2 0x0002 // INT2 Mask
#define M_INT3 0x0004 // INT3 Mask
#define M_INT4 0x0008 // INT4 Mask
#define M_INT5 0x0010 // INT5 Mask
#define M_INT6 0x0020 // INT6 Mask
#define M_INT7 0x0040 // INT7 Mask
#define M_INT8 0x0080 // INT8 Mask
#define M_INT9 0x0100 // INT9 Mask
#define M_INT10 0x0200 // INT10 Mask
#define M_INT11 0x0400 // INT11 Mask
#define M_INT12 0x0800 // INT12 Mask
#define M_INT13 0x1000 // INT13 Mask
#define M_INT14 0x2000 // INT14 Mask
#define M_DLOG 0x4000 // DLOGINT Mask
#define M_RTOS 0x8000 // RTOSINT Mask
//
// Interrupt Enable Register Allocation:
// Interrupts can be enabled/disabled using the CPU interrupt enable register
// (IER) and the PIE interrupt enable registers (PIEIER1 to PIEIER12).
//
//
// Set "Global" Interrupt Priority Level (IER register):
//
// The user must set the appropriate priority level for each of the CPU
// interrupts. This is termed as the "global" priority. The priority level
// must be a number between 1 (highest) to 16 (lowest). A value of 0 must
// be entered for reserved interrupts or interrupts that are not used.
//
// Note: The priority levels below are used to calculate the IER register
// interrupt masks MINT1 to MINT16.
//
// Note: The priority levels shown here may not make sense in a
// real application. This is for demonstration purposes only!!!
//
// The user should change these to values that make sense for
// their application.
//
// 0 = not used
// 1 = highest priority
// ...
// 16 = lowest priority
//
#define INT1PL 16 // Global Priority for Group1 Interrupts
#define INT2PL 0 // Global Priority for Group2 Interrupts
#define INT3PL 0 // Global Priority for Group3 Interrupts
#define INT4PL 0 // Global Priority for Group4 Interrupts
#define INT5PL 0 // Global Priority for Group5 Interrupts
#define INT6PL 0 // Global Priority for Group6 Interrupts
#define INT7PL 0 // Global Priority for Group7 Interrupts
#define INT8PL 0 // Global Priority for Group8 Interrupts
#define INT9PL 0 // Global Priority for Group9 Interrupts
#define INT10PL 0 // Global Priority for Group10 Interrupts
#define INT11PL 0 // Global Priority for Group11 Interrupts
#define INT12PL 0 // Global Priority for Group12 Interrupts
#define INT13PL 7 // Global Priority for INT13 (TINT1)
#define INT14PL 1 // Global Priority for INT14 (TINT2)
#define INT15PL 0 // Global Priority for DATALOG
#define INT16PL 0 // Global Priority for RTOSINT
//
// Set "Group" Interrupt Priority Level (PIEIER1 to PIEIER12 registers):
//
// The user must set the appropriate priority level for each of the PIE
// interrupts. This is termed as the "group" priority. The priority level
// must be a number between 1 (highest) to 16 (lowest). A value of 0 must
// be entered for reserved interrupts or interrupts that are not used.
//
// Note: The priority levels below are used to calculate the following
// PIEIER register interrupt masks:
// MG1_1 to MG1_16
// MG2_1 to MG2_16
// MG3_1 to MG3_16
// MG4_1 to MG4_16
// MG5_1 to MG5_16
// MG6_1 to MG6_16
// MG7_1 to MG7_16
// MG8_1 to MG8_16
// MG9_1 to MG9_16
// MG10_1 to MG10_16
// MG11_1 to MG11_16
// MG12_1 to MG12_16
//
// Note: The priority levels shown here may not make sense in a
// real application. This is for demonstration purposes only!!!
//
// The user should change these to values that make sense for
// their application.
//
// 0 = not used
// 1 = highest priority
// ...
// 16 = lowest priority
//
#define G1_1PL 0 // ADCA1_INT
#define G1_2PL 0 // ADCB1_INT
#define G1_3PL 0 // ADCC1_INT
#define G1_4PL 0 // XINT1_INT
#define G1_5PL 0 // XINT2_INT
#define G1_6PL 0 // ADCD1_INT
#define G1_7PL 4 // TIMER0_INT
#define G1_8PL 0 // WAKE_INT
#define G1_9PL 0 // Reserved
#define G1_10PL 0 // Reserved
#define G1_11PL 0 // Reserved
#define G1_12PL 0 // Reserved
#define G1_13PL 0 // IPC1_INT
#define G1_14PL 0 // IPC2_INT
#define G1_15PL 0 // IPC3_INT
#define G1_16PL 0 // IPC4_INT
#define G2_1PL 0 // EPWM1_TZ_INT
#define G2_2PL 0 // EPWM2_TZ_INT
#define G2_3PL 0 // EPWM3_TZ_INT
#define G2_4PL 0 // EPWM4_TZ_INT
#define G2_5PL 0 // EPWM5_TZ_INT
#define G2_6PL 0 // EPWM6_TZ_INT
#define G2_7PL 0 // EPWM7_TZ_INT
#define G2_8PL 0 // EPWM8_TZ_INT
#define G2_9PL 0 // EPWM9_TZ_INT
#define G2_10PL 0 // EPWM10_TZ_INT
#define G2_11PL 0 // EPWM11_TZ_INT
#define G2_12PL 0 // EPWM12_TZ_INT
#define G2_13PL 0 // Reserved
#define G2_14PL 0 // Reserved
#define G2_15PL 0 // Reserved
#define G2_16PL 0 // Reserved
#define G3_1PL 0 // EPWM1_INT
#define G3_2PL 0 // EPWM2_INT
#define G3_3PL 0 // EPWM3_INT
#define G3_4PL 0 // EPWM4_INT
#define G3_5PL 0 // EPWM5_INT
#define G3_6PL 0 // EPWM6_INT
#define G3_7PL 0 // EPWM7_INT
#define G3_8PL 0 // EPWM8_INT
#define G3_9PL 0 // EPWM9_INT
#define G3_10PL 0 // EPWM10_INT
#define G3_11PL 0 // EPWM11_INT
#define G3_12PL 0 // EPWM12_INT
#define G3_13PL 0 // Reserved
#define G3_14PL 0 // Reserved
#define G3_15PL 0 // Reserved
#define G3_16PL 0 // Reserved
#define G4_1PL 0 // ECAP1_INT
#define G4_2PL 0 // ECAP2_INT
#define G4_3PL 0 // ECAP3_INT
#define G4_4PL 0 // ECAP4_INT
#define G4_5PL 0 // ECAP5_INT
#define G4_6PL 0 // ECAP6_INT
#define G4_7PL 0 // Reserved
#define G4_8PL 0 // Reserved
#define G4_9PL 0 // Reserved
#define G4_10PL 0 // Reserved
#define G4_11PL 0 // Reserved
#define G4_12PL 0 // Reserved
#define G4_13PL 0 // Reserved
#define G4_14PL 0 // Reserved
#define G4_15PL 0 // Reserved
#define G4_16PL 0 // Reserved
#define G5_1PL 0 // EQEP1_INT
#define G5_2PL 0 // EQEP2_INT
#define G5_3PL 0 // EQEP3_INT
#define G5_4PL 0 // Reserved
#define G5_5PL 0 // CLB1_INT
#define G5_6PL 0 // CLB2_INT
#define G5_7PL 0 // CLB3_INT
#define G5_8PL 0 // CLB4_INT
#define G5_9PL 0 // SD1_INT
#define G5_10PL 0 // SD2_INT
#define G5_11PL 0 // Reserved
#define G5_12PL 0 // Reserved
#define G5_13PL 0 // Reserved
#define G5_14PL 0 // Reserved
#define G5_15PL 0 // Reserved
#define G5_16PL 0 // Reserved
#define G6_1PL 0 // SPIA_RX_INT
#define G6_2PL 0 // SPIA_TX_INT
#define G6_3PL 0 // SPIB_RX_INT
#define G6_4PL 0 // SPIB_TX_INT
#define G6_5PL 0 // MCBSPA_RX_INT
#define G6_6PL 0 // MCBSPA_TX_INT
#define G6_7PL 0 // MCBSPB_RX_INT
#define G6_8PL 0 // MCBSPB_TX_INT
#define G6_9PL 0 // SPIC_RX_INT
#define G6_10PL 0 // SPIC_TX_INT
#define G6_11PL 0 // Reserved
#define G6_12PL 0 // Reserved
#define G6_13PL 0 // Reserved
#define G6_14PL 0 // Reserved
#define G6_15PL 0 // Reserved
#define G6_16PL 0 // Reserved
#define G7_1PL 0 // DMA_CH1_INT
#define G7_2PL 0 // DMA_CH2_INT
#define G7_3PL 0 // DMA_CH3_INT
#define G7_4PL 0 // DMA_CH4_INT
#define G7_5PL 0 // DMA_CH5_INT
#define G7_6PL 0 // DMA_CH6_INT
#define G7_7PL 0 // Reserved
#define G7_8PL 0 // Reserved
#define G7_9PL 0 // Reserved
#define G7_10PL 0 // Reserved
#define G7_11PL 0 // Reserved
#define G7_12PL 0 // Reserved
#define G7_13PL 0 // Reserved
#define G7_14PL 0 // Reserved
#define G7_15PL 0 // Reserved
#define G7_16PL 0 // Reserved
#define G8_1PL 0 // I2CA_INT
#define G8_2PL 0 // I2CA_FIFO_INT
#define G8_3PL 0 // I2CB_INT
#define G8_4PL 0 // I2CB_FIFO_INT
#define G8_5PL 0 // SCIC_RX_INT
#define G8_6PL 0 // SCIC_TX_INT
#define G8_7PL 0 // SCID_RX_INT
#define G8_8PL 0 // SCID_TX_INT
#define G8_9PL 0 // Reserved
#define G8_10PL 0 // Reserved
#define G8_11PL 0 // Reserved
#define G8_12PL 0 // Reserved
#define G8_13PL 0 // Reserved
#define G8_14PL 0 // Reserved
#define G8_15PL 0 // UPPA_INT
#define G8_16PL 0 // Reserved
#define G9_1PL 0 // SCIA_RX_INT
#define G9_2PL 0 // SCIA_TX_INT
#define G9_3PL 0 // SCIB_RX_INT
#define G9_4PL 0 // SCIB_TX_INT
#define G9_5PL 0 // CANA0_INT
#define G9_6PL 0 // CANA1_INT
#define G9_7PL 0 // CANB0_INT
#define G9_8PL 0 // CANB1_INT
#define G9_9PL 0 // Reserved
#define G9_10PL 0 // Reserved
#define G9_11PL 0 // Reserved
#define G9_12PL 0 // Reserved
#define G9_13PL 0 // Reserved
#define G9_14PL 0 // Reserved
#define G9_15PL 0 // USBA_INT
#define G9_16PL 0 // Reserved
#define G10_1PL 0 // ADCA_EVT_INT
#define G10_2PL 0 // ADCA2_INT
#define G10_3PL 0 // ADCA3_INT
#define G10_4PL 0 // ADCA4_INT
#define G10_5PL 0 // ADCB_EVT_INT
#define G10_6PL 0 // ADCB2_INT
#define G10_7PL 0 // ADCB3_INT
#define G10_8PL 0 // ADCB4_INT
#define G10_9PL 0 // ADCC_EVT_INT
#define G10_10PL 0 // ADCC2_INT
#define G10_11PL 0 // ADCC3_INT
#define G10_12PL 0 // ADCC4_INT
#define G10_13PL 0 // ADCD_EVT_INT
#define G10_14PL 0 // ADCD2_INT
#define G10_15PL 0 // ADCD3_INT
#define G10_16PL 0 // ADCD4_INT
#define G11_1PL 0 // CLA1_1_INT
#define G11_2PL 0 // CLA1_2_INT
#define G11_3PL 0 // CLA1_3_INT
#define G11_4PL 0 // CLA1_4_INT
#define G11_5PL 0 // CLA1_5_INT
#define G11_6PL 0 // CLA1_6_INT
#define G11_7PL 0 // CLA1_7_INT
#define G11_8PL 0 // CLA1_8_INT
#define G11_9PL 0 // Reserved
#define G11_10PL 0 // Reserved
#define G11_11PL 0 // Reserved
#define G11_12PL 0 // Reserved
#define G11_13PL 0 // Reserved
#define G11_14PL 0 // Reserved
#define G11_15PL 0 // Reserved
#define G11_16PL 0 // Reserved
#define G12_1PL 0 // XINT3_INT
#define G12_2PL 0 // XINT4_INT
#define G12_3PL 0 // XINT5_INT
#define G12_4PL 0 // Reserved
#define G12_5PL 0 // FMC_INT
#define G12_6PL 0 // VCU_INT
#define G12_7PL 0 // FPU_OVERFLOW_ISR
#define G12_8PL 0 // FPU_UNDERFLOW_ISR
#define G12_9PL 0 // EMIF_ERROR_ISR
#define G12_10PL 0 // RAM_CORRECTABLE_ERROR_ISR
#define G12_11PL 0 // FLASH_CORRECTABLE_ERROR_ISR
#define G12_12PL 0 // RAM_ACCESS_VIOLATION_INT
#define G12_13PL 0 // SYS_PLL_SLIP_INT
#define G12_14PL 0 // AUX_PLL_SLIP_INT
#define G12_15PL 0 // CLA_UNDERFLOW_INT
#define G12_16PL 0 // CLA_OVERFLOW_INT
//
// Include the header file with software interrupt prioritization logic
//
#include "sw_interrupt_prioritization_logic.h"
#ifdef __cplusplus
}
#endif /* extern "C" */
#endif // eof
//
// End of file
//