123 lines
4.6 KiB
C
123 lines
4.6 KiB
C
//============================================================================
|
||
// PROJECT = RL78/F14
|
||
//============================================================================
|
||
// C O P Y R I G H T
|
||
//============================================================================
|
||
// Copyright (c) 2002 by Renesas Electronics (EUROPE) GmbH. All rights reserved.
|
||
// Kanzlerstrasse 2
|
||
// D-40472 Duesseldorf
|
||
//============================================================================
|
||
//Purpose: RSCAN Interrupt Vectors
|
||
//
|
||
//Warranty Disclaimer
|
||
/*******************************************************************************
|
||
* DISCLAIMER
|
||
* This software is supplied by Renesas Electronics Corporation and is only
|
||
* intended for use with Renesas products. No other uses are authorized. This
|
||
* software is owned by Renesas Electronics Corporation and is protected under
|
||
* all applicable laws, including copyright laws.
|
||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
|
||
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
|
||
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
|
||
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
|
||
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||
* Renesas reserves the right, without notice, to make changes to this software
|
||
* and to discontinue the availability of this software. By using this software,
|
||
* you agree to the additional terms and conditions found by accessing the
|
||
* following link:
|
||
* http://www.renesas.com/disclaimer
|
||
*
|
||
* Copyright (C) 2013 Renesas Electronics Corporation. All rights reserved.
|
||
*******************************************************************************/
|
||
/*******************************************************************************
|
||
* File Name : RL78_RCAN.c
|
||
* Version : 1.0
|
||
* Description : This is source file for CAN configuration.
|
||
******************************************************************************/
|
||
/*****************************************************************************
|
||
* History : DD.MM.YYYY Version Description
|
||
* : 03.29.2013 1.00 First Release
|
||
******************************************************************************/
|
||
|
||
/*===========================================================================*/
|
||
/* Includes */
|
||
/*===========================================================================*/
|
||
#if 0
|
||
|
||
#pragma interrupt INTCANGERR RSCAN_INTCANGERR_interrupt
|
||
#pragma interrupt INTCANGRFR RSCAN_INTCANGRECC_interrupt
|
||
#pragma interrupt INTCAN0ERR RSCAN_INTCAN0ERR_interrupt
|
||
#pragma interrupt INTCAN0CFR RSCAN_INTCAN0REC_interrupt
|
||
#pragma interrupt INTCAN0TRM RSCAN_INTCAN0TRX_interrupt
|
||
|
||
#endif
|
||
|
||
#include "boot_macrodriver.h"
|
||
#include "boot_userdefine.h"
|
||
#include "r_rl78_can_sfr.h"
|
||
#include "r_rl78_can_drv.h"
|
||
#include "boot_can_user.h"
|
||
#include "api.h"
|
||
#include "CanTp_Cfg.h"
|
||
#include "Dcm_App.h"
|
||
|
||
unsigned char CAN_data_buf[8];
|
||
/*CAN global error*/
|
||
//__interrupt static
|
||
void RSCAN_INTCANGERR_interrupt(void)
|
||
{
|
||
|
||
}
|
||
|
||
/*CAN global reveive FIFO*/
|
||
//__interrupt static
|
||
void RSCAN_INTCANGRECC_interrupt(void)
|
||
{
|
||
//static uint8_t read_flag = 0;
|
||
//static uint8_t i;
|
||
R_CAN_ReadRxFIFO(CAN_RXFIFO1, &Boot_RxCanMessage);
|
||
if((Boot_RxCanMessage.IDL == CANTP_ADDR_PHY_REQ) || (Boot_RxCanMessage.IDL == CANTP_ADDR_FUNC_REQ))
|
||
{
|
||
if(Boot_RxCanMessage.IDL == CANTP_ADDR_FUNC_REQ && Boot_RxCanMessage.DB[1]==0x3E && Boot_RxCanMessage.DB[2]==0x80)
|
||
resetS3Server(); /*<2A><><EFBFBD><EFBFBD>S3server<65><72>ʱ*/
|
||
else
|
||
RxIndicationCanIf_Messages(0,Boot_RxCanMessage.IDL,Boot_RxCanMessage.DLC,Boot_RxCanMessage.DB);
|
||
}
|
||
//R_CAN_ReadTRFIFO0_CH0(&Boot_RxCanMessage);
|
||
//RFSTS1 &= ~CAN_CLR_WITHOUT_RX_INT;
|
||
/*if(Boot_RxCanMessage.IDL == 0xE5)
|
||
{
|
||
read_flag = 1;
|
||
}*/
|
||
}
|
||
|
||
/*CAN0 channel error*/
|
||
//__interrupt static
|
||
void RSCAN_INTCAN0ERR_interrupt(void)
|
||
{
|
||
/*if(C0ERFLL&0x08)
|
||
{
|
||
BusOff_flag=1;//clear after can transmit successfully
|
||
} */
|
||
//C0ERFLL=0;
|
||
}
|
||
|
||
/*CAN0 transmit/receive FIFO receive interrutp*/
|
||
//__interrupt static
|
||
void RSCAN_INTCAN0REC_interrupt(void)
|
||
{
|
||
|
||
}
|
||
|
||
/* CAN Channel transmit */
|
||
//__interrupt static
|
||
void RSCAN_INTCAN0TRX_interrupt(void)
|
||
{
|
||
CFSTS0 &=0xFFEF; /*Clear CFTXIF FIFO transmit interrupt request flag*/
|
||
}
|
||
|