diff --git a/SHARED_INT.C b/SHARED_INT.C deleted file mode 100644 index 7cdf152..0000000 --- a/SHARED_INT.C +++ /dev/null @@ -1,313 +0,0 @@ -//**************************************************************************** -// @Module Shared Interrupt Routines -// @Filename SHARED_INT.C -// @Project CL2.0.dav -//---------------------------------------------------------------------------- -// @Controller Infineon XC886CLM-8FF -// -// @Compiler Keil -// -// @Codegenerator 1.3 -// -// @Description This file contains the Shared interrupt routines. -// -//---------------------------------------------------------------------------- -// @Date 2025/6/24 15:47:34 -// -//**************************************************************************** - -// USER CODE BEGIN (SHARED_INT_General,1) - -// USER CODE END - - - -//**************************************************************************** -// @Project Includes -//**************************************************************************** - -#include "SHARED_INT.H" -#include "CAN.H" -// USER CODE BEGIN (SHARED_INT_General,2) - -// USER CODE END - - -//**************************************************************************** -// @Macros -//**************************************************************************** - -// USER CODE BEGIN (SHARED_INT_General,3) - -// USER CODE END - - -//**************************************************************************** -// @Defines -//**************************************************************************** - -// USER CODE BEGIN (SHARED_INT_General,4) - -// USER CODE END - - -//**************************************************************************** -// @Typedefs -//**************************************************************************** - -// USER CODE BEGIN (SHARED_INT_General,5) - -// USER CODE END - - -//**************************************************************************** -// @Imported Global Variables -//**************************************************************************** - -// USER CODE BEGIN (SHARED_INT_General,6) - -// USER CODE END - - -//**************************************************************************** -// @Global Variables -//**************************************************************************** - -// USER CODE BEGIN (SHARED_INT_General,7) - -// USER CODE END - - -//**************************************************************************** -// @External Prototypes -//**************************************************************************** - - -// USER CODE BEGIN (SHARED_INT_General,8) - -// USER CODE END - - -//**************************************************************************** -// @Prototypes Of Local Functions -//**************************************************************************** - -// USER CODE BEGIN (SHARED_INT_General,9) - -// USER CODE END - - -//**************************************************************************** -// @Function void SHINT_vInit(void) -// -//---------------------------------------------------------------------------- -// @Description This function initializes the shared interrupts. -// -//---------------------------------------------------------------------------- -// @Returnvalue None -// -//---------------------------------------------------------------------------- -// @Parameters None -// -//---------------------------------------------------------------------------- -// @Date 2025/6/24 -// -//**************************************************************************** - -// USER CODE BEGIN (SHINT_Init,1) - -// USER CODE END - -void SHINT_vInit(void) -{ - // USER CODE BEGIN (SHINT_Init,2) - - // USER CODE END - - /// ----------------------------------------------------------------------- - /// Configuration of the Shared Interrupts: - /// ----------------------------------------------------------------------- - /// - Timer 2 Interrupt is Selected - /// - MultiCAN Node 0 Interrupt is Selected - - - IEN0 |= 0x20; // load interrupt enable register 0 - - - - IEN1 |= 0x00; // load interrupt enable register 1 - - - // USER CODE BEGIN (SHINT_Init,3) - - // USER CODE END - - -} // End of function SHINT_vInit - - -//**************************************************************************** -// @Function void SHINT_viXINTR5Isr(void) -// -//---------------------------------------------------------------------------- -// @Description This is the service routine for the shared interrupt node -// XINTR5. XINTR5 ISR Node is shared by Timer 2, UART -// Fractional Divider(BRG Interrupt),MultiCAN Node 0 and LIN. -// Depending on the selected module interrupt it is called. -// T2 - Depending on the selected operating mode it is called -// when TF2 is set by an overflow or underflow of the timer 2 -// register or when EXF2 is set by a negative transition on -// T2EX. -// UART - It is called after the BRG timer overflows and sets -// the NDOV bit. -// CAN - It is called for the Service Request Node 0 of the -// MultiCAN module. -// Please note that you have to add application specific code -// to this function. -// -//---------------------------------------------------------------------------- -// @Returnvalue none -// -//---------------------------------------------------------------------------- -// @Parameters None -// -//---------------------------------------------------------------------------- -// @Date 2025/6/24 -// -//**************************************************************************** - -// You have two choices for interrupt type select in Project Settings Page -// under Global Settings Section. -// If you select CHOICE 1 then ISR will be generated with push and pop. -// If you select CHOICE 2 then ISR will be generated without push and pop. -// Default choice is CHOICE 2. -// Current selection is CHOICE 2 - -// USER CODE BEGIN (SHINT_XINTR5Isr,1) - -// USER CODE END - -void SHINT_viXINTR5Isr(void) interrupt XINTR5INT -{ -ubyte ubNSRL; -ubyte ubNSRH; -ubyte ubResetLEC = 0x3F; - - // USER CODE BEGIN (SHINT_XINTR5Isr,2) - - // USER CODE END - - CAN_pushAMRegs(); // push the CAN Access Mediator Registers - - SFR_PAGE(_su0, SST0); // switch to page 0 - - // Timer 2 interrupt handling section... - - if (TF2) - { - // a timer 2 overflow has occured - - TF2 = 0; - - // USER CODE BEGIN (SHINT_XINTR5Isr,3) -RTCProcess(); - // USER CODE END - - } - - // MultiCAN Node 0 (SRN0) interrupt handling section... - - - // Check Interrupt Request Register 2 Interrupt Flag 0 - if (((IRCON2 & 0x01) != 0)) - { - - IRCON2 &= ~(ubyte)0x01; // clear CANSRC0 - - // --------------------------------------------------------------------- - // Interrupts of CAN node 0 - // --------------------------------------------------------------------- - - CAN_vWriteCANAddress(CAN_NSR0); - CAN_vReadEN(); - ubNSRL = CAN_DATA0; - ubNSRH = CAN_DATA1; - - // USER CODE BEGIN (SRN0_NODE0,1) - - // USER CODE END - // --------------------------------------------------------------------- - // CAN node 0 Alert Interrupt - // --------------------------------------------------------------------- - if (ubNSRL & 0x20) // if ALERT - { - - /// Note: The ALERT bit is set upon the occurrence of one ofthe - /// following events. User need to handle these in user defined - /// section. - - // BOFF : ubNSRL & 0x80 - // Bus OFF - if(ubNSRL & 0x80) { - can_error_cnt = 0x80; - ubNSRL &= ~0x80; // 清除标志 - - } - // EWRN : ubNSRL & 0x40 - if(ubNSRL & 0x40) { - can_error_cnt = 0x40; - ubNSRL &= ~0x40; // 清除标志 - } - // One of the error counters REC or TEC reached the - // warning limit of 96. - // LLE : ubNSRH & 0x01 - // A list length error has been detected during message - // acceptance filtering. The number of elements in the list - // that belongs to this CAN node differs from the list SIZE - // given in the list termination pointer - // LOE : ubNSRH & 0x02 - // A list object error has been detected during message - // acceptance filtering. A message object with wrong LIST - // index entry in the Message Object Control Register has - // been detected - - // USER CODE BEGIN (SRN0_NODE_0_ALIE,2) - - // USER CODE END - } - - - // USER CODE BEGIN (SRN0_NODE0,8) - - // USER CODE END - - //// Reset LEC, TXOK, RXOK, ALERT, EWRN, BOFF, LLE, LOE (if set) - - CAN_vWriteCANAddress(CAN_NSR0); // Addressing CAN_NSR0 - CAN_DATA0 = ~(ubNSRL & ubResetLEC); // load CAN_NSR0 status register[7-0] - CAN_DATA1 = ~(ubNSRH); // load CAN_NSR0 status register[15-8] - CAN_vWriteEN(D0_VALID+D1_VALID); // Data0 and Data1 are Valid for - // transmission and Write is Enabled. - - // USER CODE BEGIN (SHINT_XINTR5Isr,6) - - // USER CODE END - - } - - - // USER CODE BEGIN (SHINT_XINTR5Isr,7) - - // USER CODE END - - SFR_PAGE(_su0, RST0); // restore the old SCU page - - CAN_popAMRegs(); // restore the CAN Access Mediator Registers -} // End of function SHINT_viXINTR5Isr - - -// USER CODE BEGIN (SHARED_INT_General,10) - -// USER CODE END - -