[五菱1.5代,同步奇瑞]
This commit is contained in:
parent
e9e959bf00
commit
b6ed8535ae
784
CORE/core_cm3.c
Normal file
784
CORE/core_cm3.c
Normal file
@ -0,0 +1,784 @@
|
||||
/**************************************************************************//**
|
||||
* @file core_cm3.c
|
||||
* @brief CMSIS Cortex-M3 Core Peripheral Access Layer Source File
|
||||
* @version V1.30
|
||||
* @date 30. October 2009
|
||||
*
|
||||
* @note
|
||||
* Copyright (C) 2009 ARM Limited. All rights reserved.
|
||||
*
|
||||
* @par
|
||||
* ARM Limited (ARM) is supplying this software for use with Cortex-M
|
||||
* processor based microcontrollers. This file can be freely distributed
|
||||
* within development tools that are supporting such ARM based processors.
|
||||
*
|
||||
* @par
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
||||
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
||||
* ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
||||
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* define compiler specific symbols */
|
||||
#if defined ( __CC_ARM )
|
||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
||||
|
||||
#elif defined ( __ICCARM__ )
|
||||
#define __ASM __asm /*!< asm keyword for IAR Compiler */
|
||||
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only avaiable in High optimization mode! */
|
||||
|
||||
#elif defined ( __GNUC__ )
|
||||
#define __ASM __asm /*!< asm keyword for GNU Compiler */
|
||||
#define __INLINE inline /*!< inline keyword for GNU Compiler */
|
||||
|
||||
#elif defined ( __TASKING__ )
|
||||
#define __ASM __asm /*!< asm keyword for TASKING Compiler */
|
||||
#define __INLINE inline /*!< inline keyword for TASKING Compiler */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* ################### Compiler specific Intrinsics ########################### */
|
||||
|
||||
#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
|
||||
/* ARM armcc specific functions */
|
||||
|
||||
/**
|
||||
* @brief Return the Process Stack Pointer
|
||||
*
|
||||
* @return ProcessStackPointer
|
||||
*
|
||||
* Return the actual process stack pointer
|
||||
*/
|
||||
__ASM uint32_t __get_PSP(void)
|
||||
{
|
||||
mrs r0, psp
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Process Stack Pointer
|
||||
*
|
||||
* @param topOfProcStack Process Stack Pointer
|
||||
*
|
||||
* Assign the value ProcessStackPointer to the MSP
|
||||
* (process stack pointer) Cortex processor register
|
||||
*/
|
||||
__ASM void __set_PSP(uint32_t topOfProcStack)
|
||||
{
|
||||
msr psp, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Main Stack Pointer
|
||||
*
|
||||
* @return Main Stack Pointer
|
||||
*
|
||||
* Return the current value of the MSP (main stack pointer)
|
||||
* Cortex processor register
|
||||
*/
|
||||
__ASM uint32_t __get_MSP(void)
|
||||
{
|
||||
mrs r0, msp
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Main Stack Pointer
|
||||
*
|
||||
* @param topOfMainStack Main Stack Pointer
|
||||
*
|
||||
* Assign the value mainStackPointer to the MSP
|
||||
* (main stack pointer) Cortex processor register
|
||||
*/
|
||||
__ASM void __set_MSP(uint32_t mainStackPointer)
|
||||
{
|
||||
msr msp, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reverse byte order in unsigned short value
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse byte order in unsigned short value
|
||||
*/
|
||||
__ASM uint32_t __REV16(uint16_t value)
|
||||
{
|
||||
rev16 r0, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reverse byte order in signed short value with sign extension to integer
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse byte order in signed short value with sign extension to integer
|
||||
*/
|
||||
__ASM int32_t __REVSH(int16_t value)
|
||||
{
|
||||
revsh r0, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
|
||||
/**
|
||||
* @brief Remove the exclusive lock created by ldrex
|
||||
*
|
||||
* Removes the exclusive lock which is created by ldrex.
|
||||
*/
|
||||
__ASM void __CLREX(void)
|
||||
{
|
||||
clrex
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Base Priority value
|
||||
*
|
||||
* @return BasePriority
|
||||
*
|
||||
* Return the content of the base priority register
|
||||
*/
|
||||
__ASM uint32_t __get_BASEPRI(void)
|
||||
{
|
||||
mrs r0, basepri
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Base Priority value
|
||||
*
|
||||
* @param basePri BasePriority
|
||||
*
|
||||
* Set the base priority register
|
||||
*/
|
||||
__ASM void __set_BASEPRI(uint32_t basePri)
|
||||
{
|
||||
msr basepri, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Priority Mask value
|
||||
*
|
||||
* @return PriMask
|
||||
*
|
||||
* Return state of the priority mask bit from the priority mask register
|
||||
*/
|
||||
__ASM uint32_t __get_PRIMASK(void)
|
||||
{
|
||||
mrs r0, primask
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Priority Mask value
|
||||
*
|
||||
* @param priMask PriMask
|
||||
*
|
||||
* Set the priority mask bit in the priority mask register
|
||||
*/
|
||||
__ASM void __set_PRIMASK(uint32_t priMask)
|
||||
{
|
||||
msr primask, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Fault Mask value
|
||||
*
|
||||
* @return FaultMask
|
||||
*
|
||||
* Return the content of the fault mask register
|
||||
*/
|
||||
__ASM uint32_t __get_FAULTMASK(void)
|
||||
{
|
||||
mrs r0, faultmask
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Fault Mask value
|
||||
*
|
||||
* @param faultMask faultMask value
|
||||
*
|
||||
* Set the fault mask register
|
||||
*/
|
||||
__ASM void __set_FAULTMASK(uint32_t faultMask)
|
||||
{
|
||||
msr faultmask, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Control Register value
|
||||
*
|
||||
* @return Control value
|
||||
*
|
||||
* Return the content of the control register
|
||||
*/
|
||||
__ASM uint32_t __get_CONTROL(void)
|
||||
{
|
||||
mrs r0, control
|
||||
bx lr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Control Register value
|
||||
*
|
||||
* @param control Control value
|
||||
*
|
||||
* Set the control register
|
||||
*/
|
||||
__ASM void __set_CONTROL(uint32_t control)
|
||||
{
|
||||
msr control, r0
|
||||
bx lr
|
||||
}
|
||||
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
|
||||
#elif (defined (__ICCARM__)) /*------------------ ICC Compiler -------------------*/
|
||||
/* IAR iccarm specific functions */
|
||||
#pragma diag_suppress=Pe940
|
||||
|
||||
/**
|
||||
* @brief Return the Process Stack Pointer
|
||||
*
|
||||
* @return ProcessStackPointer
|
||||
*
|
||||
* Return the actual process stack pointer
|
||||
*/
|
||||
uint32_t __get_PSP(void)
|
||||
{
|
||||
__ASM("mrs r0, psp");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Process Stack Pointer
|
||||
*
|
||||
* @param topOfProcStack Process Stack Pointer
|
||||
*
|
||||
* Assign the value ProcessStackPointer to the MSP
|
||||
* (process stack pointer) Cortex processor register
|
||||
*/
|
||||
void __set_PSP(uint32_t topOfProcStack)
|
||||
{
|
||||
__ASM("msr psp, r0");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Main Stack Pointer
|
||||
*
|
||||
* @return Main Stack Pointer
|
||||
*
|
||||
* Return the current value of the MSP (main stack pointer)
|
||||
* Cortex processor register
|
||||
*/
|
||||
uint32_t __get_MSP(void)
|
||||
{
|
||||
__ASM("mrs r0, msp");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Main Stack Pointer
|
||||
*
|
||||
* @param topOfMainStack Main Stack Pointer
|
||||
*
|
||||
* Assign the value mainStackPointer to the MSP
|
||||
* (main stack pointer) Cortex processor register
|
||||
*/
|
||||
void __set_MSP(uint32_t topOfMainStack)
|
||||
{
|
||||
__ASM("msr msp, r0");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reverse byte order in unsigned short value
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse byte order in unsigned short value
|
||||
*/
|
||||
uint32_t __REV16(uint16_t value)
|
||||
{
|
||||
__ASM("rev16 r0, r0");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reverse bit order of value
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse bit order of value
|
||||
*/
|
||||
uint32_t __RBIT(uint32_t value)
|
||||
{
|
||||
__ASM("rbit r0, r0");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LDR Exclusive (8 bit)
|
||||
*
|
||||
* @param *addr address pointer
|
||||
* @return value of (*address)
|
||||
*
|
||||
* Exclusive LDR command for 8 bit values)
|
||||
*/
|
||||
uint8_t __LDREXB(uint8_t *addr)
|
||||
{
|
||||
__ASM("ldrexb r0, [r0]");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LDR Exclusive (16 bit)
|
||||
*
|
||||
* @param *addr address pointer
|
||||
* @return value of (*address)
|
||||
*
|
||||
* Exclusive LDR command for 16 bit values
|
||||
*/
|
||||
uint16_t __LDREXH(uint16_t *addr)
|
||||
{
|
||||
__ASM("ldrexh r0, [r0]");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LDR Exclusive (32 bit)
|
||||
*
|
||||
* @param *addr address pointer
|
||||
* @return value of (*address)
|
||||
*
|
||||
* Exclusive LDR command for 32 bit values
|
||||
*/
|
||||
uint32_t __LDREXW(uint32_t *addr)
|
||||
{
|
||||
__ASM("ldrex r0, [r0]");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief STR Exclusive (8 bit)
|
||||
*
|
||||
* @param value value to store
|
||||
* @param *addr address pointer
|
||||
* @return successful / failed
|
||||
*
|
||||
* Exclusive STR command for 8 bit values
|
||||
*/
|
||||
uint32_t __STREXB(uint8_t value, uint8_t *addr)
|
||||
{
|
||||
__ASM("strexb r0, r0, [r1]");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief STR Exclusive (16 bit)
|
||||
*
|
||||
* @param value value to store
|
||||
* @param *addr address pointer
|
||||
* @return successful / failed
|
||||
*
|
||||
* Exclusive STR command for 16 bit values
|
||||
*/
|
||||
uint32_t __STREXH(uint16_t value, uint16_t *addr)
|
||||
{
|
||||
__ASM("strexh r0, r0, [r1]");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief STR Exclusive (32 bit)
|
||||
*
|
||||
* @param value value to store
|
||||
* @param *addr address pointer
|
||||
* @return successful / failed
|
||||
*
|
||||
* Exclusive STR command for 32 bit values
|
||||
*/
|
||||
uint32_t __STREXW(uint32_t value, uint32_t *addr)
|
||||
{
|
||||
__ASM("strex r0, r0, [r1]");
|
||||
__ASM("bx lr");
|
||||
}
|
||||
|
||||
#pragma diag_default=Pe940
|
||||
|
||||
|
||||
#elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
|
||||
/* GNU gcc specific functions */
|
||||
|
||||
/**
|
||||
* @brief Return the Process Stack Pointer
|
||||
*
|
||||
* @return ProcessStackPointer
|
||||
*
|
||||
* Return the actual process stack pointer
|
||||
*/
|
||||
uint32_t __get_PSP(void) __attribute__( ( naked ) );
|
||||
uint32_t __get_PSP(void)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("MRS %0, psp\n\t"
|
||||
"MOV r0, %0 \n\t"
|
||||
"BX lr \n\t" : "=r" (result) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Process Stack Pointer
|
||||
*
|
||||
* @param topOfProcStack Process Stack Pointer
|
||||
*
|
||||
* Assign the value ProcessStackPointer to the MSP
|
||||
* (process stack pointer) Cortex processor register
|
||||
*/
|
||||
void __set_PSP(uint32_t topOfProcStack) __attribute__( ( naked ) );
|
||||
void __set_PSP(uint32_t topOfProcStack)
|
||||
{
|
||||
__ASM volatile ("MSR psp, %0\n\t"
|
||||
"BX lr \n\t" : : "r" (topOfProcStack) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Main Stack Pointer
|
||||
*
|
||||
* @return Main Stack Pointer
|
||||
*
|
||||
* Return the current value of the MSP (main stack pointer)
|
||||
* Cortex processor register
|
||||
*/
|
||||
uint32_t __get_MSP(void) __attribute__( ( naked ) );
|
||||
uint32_t __get_MSP(void)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("MRS %0, msp\n\t"
|
||||
"MOV r0, %0 \n\t"
|
||||
"BX lr \n\t" : "=r" (result) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Main Stack Pointer
|
||||
*
|
||||
* @param topOfMainStack Main Stack Pointer
|
||||
*
|
||||
* Assign the value mainStackPointer to the MSP
|
||||
* (main stack pointer) Cortex processor register
|
||||
*/
|
||||
void __set_MSP(uint32_t topOfMainStack) __attribute__( ( naked ) );
|
||||
void __set_MSP(uint32_t topOfMainStack)
|
||||
{
|
||||
__ASM volatile ("MSR msp, %0\n\t"
|
||||
"BX lr \n\t" : : "r" (topOfMainStack) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Base Priority value
|
||||
*
|
||||
* @return BasePriority
|
||||
*
|
||||
* Return the content of the base priority register
|
||||
*/
|
||||
uint32_t __get_BASEPRI(void)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("MRS %0, basepri_max" : "=r" (result) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Base Priority value
|
||||
*
|
||||
* @param basePri BasePriority
|
||||
*
|
||||
* Set the base priority register
|
||||
*/
|
||||
void __set_BASEPRI(uint32_t value)
|
||||
{
|
||||
__ASM volatile ("MSR basepri, %0" : : "r" (value) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Priority Mask value
|
||||
*
|
||||
* @return PriMask
|
||||
*
|
||||
* Return state of the priority mask bit from the priority mask register
|
||||
*/
|
||||
uint32_t __get_PRIMASK(void)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("MRS %0, primask" : "=r" (result) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Priority Mask value
|
||||
*
|
||||
* @param priMask PriMask
|
||||
*
|
||||
* Set the priority mask bit in the priority mask register
|
||||
*/
|
||||
void __set_PRIMASK(uint32_t priMask)
|
||||
{
|
||||
__ASM volatile ("MSR primask, %0" : : "r" (priMask) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Fault Mask value
|
||||
*
|
||||
* @return FaultMask
|
||||
*
|
||||
* Return the content of the fault mask register
|
||||
*/
|
||||
uint32_t __get_FAULTMASK(void)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("MRS %0, faultmask" : "=r" (result) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Fault Mask value
|
||||
*
|
||||
* @param faultMask faultMask value
|
||||
*
|
||||
* Set the fault mask register
|
||||
*/
|
||||
void __set_FAULTMASK(uint32_t faultMask)
|
||||
{
|
||||
__ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the Control Register value
|
||||
*
|
||||
* @return Control value
|
||||
*
|
||||
* Return the content of the control register
|
||||
*/
|
||||
uint32_t __get_CONTROL(void)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("MRS %0, control" : "=r" (result) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Control Register value
|
||||
*
|
||||
* @param control Control value
|
||||
*
|
||||
* Set the control register
|
||||
*/
|
||||
void __set_CONTROL(uint32_t control)
|
||||
{
|
||||
__ASM volatile ("MSR control, %0" : : "r" (control) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Reverse byte order in integer value
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse byte order in integer value
|
||||
*/
|
||||
uint32_t __REV(uint32_t value)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reverse byte order in unsigned short value
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse byte order in unsigned short value
|
||||
*/
|
||||
uint32_t __REV16(uint16_t value)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reverse byte order in signed short value with sign extension to integer
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse byte order in signed short value with sign extension to integer
|
||||
*/
|
||||
int32_t __REVSH(int16_t value)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reverse bit order of value
|
||||
*
|
||||
* @param value value to reverse
|
||||
* @return reversed value
|
||||
*
|
||||
* Reverse bit order of value
|
||||
*/
|
||||
uint32_t __RBIT(uint32_t value)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LDR Exclusive (8 bit)
|
||||
*
|
||||
* @param *addr address pointer
|
||||
* @return value of (*address)
|
||||
*
|
||||
* Exclusive LDR command for 8 bit value
|
||||
*/
|
||||
uint8_t __LDREXB(uint8_t *addr)
|
||||
{
|
||||
uint8_t result=0;
|
||||
|
||||
__ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LDR Exclusive (16 bit)
|
||||
*
|
||||
* @param *addr address pointer
|
||||
* @return value of (*address)
|
||||
*
|
||||
* Exclusive LDR command for 16 bit values
|
||||
*/
|
||||
uint16_t __LDREXH(uint16_t *addr)
|
||||
{
|
||||
uint16_t result=0;
|
||||
|
||||
__ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LDR Exclusive (32 bit)
|
||||
*
|
||||
* @param *addr address pointer
|
||||
* @return value of (*address)
|
||||
*
|
||||
* Exclusive LDR command for 32 bit values
|
||||
*/
|
||||
uint32_t __LDREXW(uint32_t *addr)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("ldrex %0, [%1]" : "=r" (result) : "r" (addr) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief STR Exclusive (8 bit)
|
||||
*
|
||||
* @param value value to store
|
||||
* @param *addr address pointer
|
||||
* @return successful / failed
|
||||
*
|
||||
* Exclusive STR command for 8 bit values
|
||||
*/
|
||||
uint32_t __STREXB(uint8_t value, uint8_t *addr)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief STR Exclusive (16 bit)
|
||||
*
|
||||
* @param value value to store
|
||||
* @param *addr address pointer
|
||||
* @return successful / failed
|
||||
*
|
||||
* Exclusive STR command for 16 bit values
|
||||
*/
|
||||
uint32_t __STREXH(uint16_t value, uint16_t *addr)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief STR Exclusive (32 bit)
|
||||
*
|
||||
* @param value value to store
|
||||
* @param *addr address pointer
|
||||
* @return successful / failed
|
||||
*
|
||||
* Exclusive STR command for 32 bit values
|
||||
*/
|
||||
uint32_t __STREXW(uint32_t value, uint32_t *addr)
|
||||
{
|
||||
uint32_t result=0;
|
||||
|
||||
__ASM volatile ("strex %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
#elif (defined (__TASKING__)) /*------------------ TASKING Compiler ---------------------*/
|
||||
/* TASKING carm specific functions */
|
||||
|
||||
/*
|
||||
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
||||
* Please use "carm -?i" to get an up to date list of all instrinsics,
|
||||
* Including the CMSIS ones.
|
||||
*/
|
||||
|
||||
#endif
|
1818
CORE/core_cm3.h
Normal file
1818
CORE/core_cm3.h
Normal file
File diff suppressed because it is too large
Load Diff
368
CORE/startup_stm32f10x_cl.s
Normal file
368
CORE/startup_stm32f10x_cl.s
Normal file
@ -0,0 +1,368 @@
|
||||
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f10x_cl.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V3.5.0
|
||||
;* Date : 11-March-2011
|
||||
;* Description : STM32F10x Connectivity line devices vector table for MDK-ARM
|
||||
;* toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
;* - Set the vector table entries with the exceptions ISR address
|
||||
;* - Configure the clock system
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the CortexM3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;* <<< Use Configuration Wizard in Context Menu >>>
|
||||
;*******************************************************************************
|
||||
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
;*******************************************************************************
|
||||
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00002000
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00002000
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD PVD_IRQHandler ; PVD through EXTI Line detect
|
||||
DCD TAMPER_IRQHandler ; Tamper
|
||||
DCD RTC_IRQHandler ; RTC
|
||||
DCD FLASH_IRQHandler ; Flash
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_IRQHandler ; EXTI Line 0
|
||||
DCD EXTI1_IRQHandler ; EXTI Line 1
|
||||
DCD EXTI2_IRQHandler ; EXTI Line 2
|
||||
DCD EXTI3_IRQHandler ; EXTI Line 3
|
||||
DCD EXTI4_IRQHandler ; EXTI Line 4
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
|
||||
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
|
||||
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
|
||||
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
|
||||
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
|
||||
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
|
||||
DCD ADC1_2_IRQHandler ; ADC1 and ADC2
|
||||
DCD CAN1_TX_IRQHandler ; CAN1 TX
|
||||
DCD CAN1_RX0_IRQHandler ; CAN1 RX0
|
||||
DCD CAN1_RX1_IRQHandler ; CAN1 RX1
|
||||
DCD CAN1_SCE_IRQHandler ; CAN1 SCE
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD TIM1_BRK_IRQHandler ; TIM1 Break
|
||||
DCD TIM1_UP_IRQHandler ; TIM1 Update
|
||||
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
DCD I2C1_EV_IRQHandler ; I2C1 Event
|
||||
DCD I2C1_ER_IRQHandler ; I2C1 Error
|
||||
DCD I2C2_EV_IRQHandler ; I2C2 Event
|
||||
DCD I2C2_ER_IRQHandler ; I2C1 Error
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_IRQHandler ; USART3
|
||||
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
|
||||
DCD RTCAlarm_IRQHandler ; RTC alarm through EXTI line
|
||||
DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM5_IRQHandler ; TIM5
|
||||
DCD SPI3_IRQHandler ; SPI3
|
||||
DCD UART4_IRQHandler ; UART4
|
||||
DCD UART5_IRQHandler ; UART5
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
|
||||
DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
|
||||
DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
|
||||
DCD DMA2_Channel4_IRQHandler ; DMA2 Channel4
|
||||
DCD DMA2_Channel5_IRQHandler ; DMA2 Channel5
|
||||
DCD ETH_IRQHandler ; Ethernet
|
||||
DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line
|
||||
DCD CAN2_TX_IRQHandler ; CAN2 TX
|
||||
DCD CAN2_RX0_IRQHandler ; CAN2 RX0
|
||||
DCD CAN2_RX1_IRQHandler ; CAN2 RX1
|
||||
DCD CAN2_SCE_IRQHandler ; CAN2 SCE
|
||||
DCD OTG_FS_IRQHandler ; USB OTG FS
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT WWDG_IRQHandler [WEAK]
|
||||
EXPORT PVD_IRQHandler [WEAK]
|
||||
EXPORT TAMPER_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT RCC_IRQHandler [WEAK]
|
||||
EXPORT EXTI0_IRQHandler [WEAK]
|
||||
EXPORT EXTI1_IRQHandler [WEAK]
|
||||
EXPORT EXTI2_IRQHandler [WEAK]
|
||||
EXPORT EXTI3_IRQHandler [WEAK]
|
||||
EXPORT EXTI4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel5_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel6_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel7_IRQHandler [WEAK]
|
||||
EXPORT ADC1_2_IRQHandler [WEAK]
|
||||
EXPORT CAN1_TX_IRQHandler [WEAK]
|
||||
EXPORT CAN1_RX0_IRQHandler [WEAK]
|
||||
EXPORT CAN1_RX1_IRQHandler [WEAK]
|
||||
EXPORT CAN1_SCE_IRQHandler [WEAK]
|
||||
EXPORT EXTI9_5_IRQHandler [WEAK]
|
||||
EXPORT TIM1_BRK_IRQHandler [WEAK]
|
||||
EXPORT TIM1_UP_IRQHandler [WEAK]
|
||||
EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM1_CC_IRQHandler [WEAK]
|
||||
EXPORT TIM2_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM4_IRQHandler [WEAK]
|
||||
EXPORT I2C1_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C1_ER_IRQHandler [WEAK]
|
||||
EXPORT I2C2_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C2_ER_IRQHandler [WEAK]
|
||||
EXPORT SPI1_IRQHandler [WEAK]
|
||||
EXPORT SPI2_IRQHandler [WEAK]
|
||||
EXPORT USART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_IRQHandler [WEAK]
|
||||
EXPORT USART3_IRQHandler [WEAK]
|
||||
EXPORT EXTI15_10_IRQHandler [WEAK]
|
||||
EXPORT RTCAlarm_IRQHandler [WEAK]
|
||||
EXPORT OTG_FS_WKUP_IRQHandler [WEAK]
|
||||
EXPORT TIM5_IRQHandler [WEAK]
|
||||
EXPORT SPI3_IRQHandler [WEAK]
|
||||
EXPORT UART4_IRQHandler [WEAK]
|
||||
EXPORT UART5_IRQHandler [WEAK]
|
||||
EXPORT TIM6_IRQHandler [WEAK]
|
||||
EXPORT TIM7_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel5_IRQHandler [WEAK]
|
||||
EXPORT ETH_IRQHandler [WEAK]
|
||||
EXPORT ETH_WKUP_IRQHandler [WEAK]
|
||||
EXPORT CAN2_TX_IRQHandler [WEAK]
|
||||
EXPORT CAN2_RX0_IRQHandler [WEAK]
|
||||
EXPORT CAN2_RX1_IRQHandler [WEAK]
|
||||
EXPORT CAN2_SCE_IRQHandler [WEAK]
|
||||
EXPORT OTG_FS_IRQHandler [WEAK]
|
||||
|
||||
WWDG_IRQHandler
|
||||
PVD_IRQHandler
|
||||
TAMPER_IRQHandler
|
||||
RTC_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
RCC_IRQHandler
|
||||
EXTI0_IRQHandler
|
||||
EXTI1_IRQHandler
|
||||
EXTI2_IRQHandler
|
||||
EXTI3_IRQHandler
|
||||
EXTI4_IRQHandler
|
||||
DMA1_Channel1_IRQHandler
|
||||
DMA1_Channel2_IRQHandler
|
||||
DMA1_Channel3_IRQHandler
|
||||
DMA1_Channel4_IRQHandler
|
||||
DMA1_Channel5_IRQHandler
|
||||
DMA1_Channel6_IRQHandler
|
||||
DMA1_Channel7_IRQHandler
|
||||
ADC1_2_IRQHandler
|
||||
CAN1_TX_IRQHandler
|
||||
CAN1_RX0_IRQHandler
|
||||
CAN1_RX1_IRQHandler
|
||||
CAN1_SCE_IRQHandler
|
||||
EXTI9_5_IRQHandler
|
||||
TIM1_BRK_IRQHandler
|
||||
TIM1_UP_IRQHandler
|
||||
TIM1_TRG_COM_IRQHandler
|
||||
TIM1_CC_IRQHandler
|
||||
TIM2_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM4_IRQHandler
|
||||
I2C1_EV_IRQHandler
|
||||
I2C1_ER_IRQHandler
|
||||
I2C2_EV_IRQHandler
|
||||
I2C2_ER_IRQHandler
|
||||
SPI1_IRQHandler
|
||||
SPI2_IRQHandler
|
||||
USART1_IRQHandler
|
||||
USART2_IRQHandler
|
||||
USART3_IRQHandler
|
||||
EXTI15_10_IRQHandler
|
||||
RTCAlarm_IRQHandler
|
||||
OTG_FS_WKUP_IRQHandler
|
||||
TIM5_IRQHandler
|
||||
SPI3_IRQHandler
|
||||
UART4_IRQHandler
|
||||
UART5_IRQHandler
|
||||
TIM6_IRQHandler
|
||||
TIM7_IRQHandler
|
||||
DMA2_Channel1_IRQHandler
|
||||
DMA2_Channel2_IRQHandler
|
||||
DMA2_Channel3_IRQHandler
|
||||
DMA2_Channel4_IRQHandler
|
||||
DMA2_Channel5_IRQHandler
|
||||
ETH_IRQHandler
|
||||
ETH_WKUP_IRQHandler
|
||||
CAN2_TX_IRQHandler
|
||||
CAN2_RX0_IRQHandler
|
||||
CAN2_RX1_IRQHandler
|
||||
CAN2_SCE_IRQHandler
|
||||
OTG_FS_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
|
||||
;*******************************************************************************
|
||||
; User Stack and Heap initialization
|
||||
;*******************************************************************************
|
||||
IF :DEF:__MICROLIB
|
||||
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
ELSE
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, =(Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
ENDIF
|
||||
|
||||
END
|
||||
|
||||
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****
|
358
CORE/startup_stm32f10x_hd.s
Normal file
358
CORE/startup_stm32f10x_hd.s
Normal file
@ -0,0 +1,358 @@
|
||||
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f10x_hd.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V3.5.0
|
||||
;* Date : 11-March-2011
|
||||
;* Description : STM32F10x High Density Devices vector table for MDK-ARM
|
||||
;* toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
;* - Set the vector table entries with the exceptions ISR address
|
||||
;* - Configure the clock system and also configure the external
|
||||
;* SRAM mounted on STM3210E-EVAL board to be used as data
|
||||
;* memory (optional, to be enabled by user)
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the CortexM3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;* <<< Use Configuration Wizard in Context Menu >>>
|
||||
;*******************************************************************************
|
||||
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
;*******************************************************************************
|
||||
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD PVD_IRQHandler ; PVD through EXTI Line detect
|
||||
DCD TAMPER_IRQHandler ; Tamper
|
||||
DCD RTC_IRQHandler ; RTC
|
||||
DCD FLASH_IRQHandler ; Flash
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_IRQHandler ; EXTI Line 0
|
||||
DCD EXTI1_IRQHandler ; EXTI Line 1
|
||||
DCD EXTI2_IRQHandler ; EXTI Line 2
|
||||
DCD EXTI3_IRQHandler ; EXTI Line 3
|
||||
DCD EXTI4_IRQHandler ; EXTI Line 4
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
|
||||
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
|
||||
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
|
||||
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
|
||||
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
|
||||
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
|
||||
DCD ADC1_2_IRQHandler ; ADC1 & ADC2
|
||||
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
|
||||
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
|
||||
DCD CAN1_RX1_IRQHandler ; CAN1 RX1
|
||||
DCD CAN1_SCE_IRQHandler ; CAN1 SCE
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD TIM1_BRK_IRQHandler ; TIM1 Break
|
||||
DCD TIM1_UP_IRQHandler ; TIM1 Update
|
||||
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
DCD I2C1_EV_IRQHandler ; I2C1 Event
|
||||
DCD I2C1_ER_IRQHandler ; I2C1 Error
|
||||
DCD I2C2_EV_IRQHandler ; I2C2 Event
|
||||
DCD I2C2_ER_IRQHandler ; I2C2 Error
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_IRQHandler ; USART3
|
||||
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
|
||||
DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
|
||||
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
|
||||
DCD TIM8_BRK_IRQHandler ; TIM8 Break
|
||||
DCD TIM8_UP_IRQHandler ; TIM8 Update
|
||||
DCD TIM8_TRG_COM_IRQHandler ; TIM8 Trigger and Commutation
|
||||
DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare
|
||||
DCD ADC3_IRQHandler ; ADC3
|
||||
DCD FSMC_IRQHandler ; FSMC
|
||||
DCD SDIO_IRQHandler ; SDIO
|
||||
DCD TIM5_IRQHandler ; TIM5
|
||||
DCD SPI3_IRQHandler ; SPI3
|
||||
DCD UART4_IRQHandler ; UART4
|
||||
DCD UART5_IRQHandler ; UART5
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
|
||||
DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
|
||||
DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
|
||||
DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
IMPORT SystemInit
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT WWDG_IRQHandler [WEAK]
|
||||
EXPORT PVD_IRQHandler [WEAK]
|
||||
EXPORT TAMPER_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT RCC_IRQHandler [WEAK]
|
||||
EXPORT EXTI0_IRQHandler [WEAK]
|
||||
EXPORT EXTI1_IRQHandler [WEAK]
|
||||
EXPORT EXTI2_IRQHandler [WEAK]
|
||||
EXPORT EXTI3_IRQHandler [WEAK]
|
||||
EXPORT EXTI4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel5_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel6_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel7_IRQHandler [WEAK]
|
||||
EXPORT ADC1_2_IRQHandler [WEAK]
|
||||
EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
|
||||
EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
|
||||
EXPORT CAN1_RX1_IRQHandler [WEAK]
|
||||
EXPORT CAN1_SCE_IRQHandler [WEAK]
|
||||
EXPORT EXTI9_5_IRQHandler [WEAK]
|
||||
EXPORT TIM1_BRK_IRQHandler [WEAK]
|
||||
EXPORT TIM1_UP_IRQHandler [WEAK]
|
||||
EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM1_CC_IRQHandler [WEAK]
|
||||
EXPORT TIM2_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM4_IRQHandler [WEAK]
|
||||
EXPORT I2C1_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C1_ER_IRQHandler [WEAK]
|
||||
EXPORT I2C2_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C2_ER_IRQHandler [WEAK]
|
||||
EXPORT SPI1_IRQHandler [WEAK]
|
||||
EXPORT SPI2_IRQHandler [WEAK]
|
||||
EXPORT USART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_IRQHandler [WEAK]
|
||||
EXPORT USART3_IRQHandler [WEAK]
|
||||
EXPORT EXTI15_10_IRQHandler [WEAK]
|
||||
EXPORT RTCAlarm_IRQHandler [WEAK]
|
||||
EXPORT USBWakeUp_IRQHandler [WEAK]
|
||||
EXPORT TIM8_BRK_IRQHandler [WEAK]
|
||||
EXPORT TIM8_UP_IRQHandler [WEAK]
|
||||
EXPORT TIM8_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM8_CC_IRQHandler [WEAK]
|
||||
EXPORT ADC3_IRQHandler [WEAK]
|
||||
EXPORT FSMC_IRQHandler [WEAK]
|
||||
EXPORT SDIO_IRQHandler [WEAK]
|
||||
EXPORT TIM5_IRQHandler [WEAK]
|
||||
EXPORT SPI3_IRQHandler [WEAK]
|
||||
EXPORT UART4_IRQHandler [WEAK]
|
||||
EXPORT UART5_IRQHandler [WEAK]
|
||||
EXPORT TIM6_IRQHandler [WEAK]
|
||||
EXPORT TIM7_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
|
||||
|
||||
WWDG_IRQHandler
|
||||
PVD_IRQHandler
|
||||
TAMPER_IRQHandler
|
||||
RTC_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
RCC_IRQHandler
|
||||
EXTI0_IRQHandler
|
||||
EXTI1_IRQHandler
|
||||
EXTI2_IRQHandler
|
||||
EXTI3_IRQHandler
|
||||
EXTI4_IRQHandler
|
||||
DMA1_Channel1_IRQHandler
|
||||
DMA1_Channel2_IRQHandler
|
||||
DMA1_Channel3_IRQHandler
|
||||
DMA1_Channel4_IRQHandler
|
||||
DMA1_Channel5_IRQHandler
|
||||
DMA1_Channel6_IRQHandler
|
||||
DMA1_Channel7_IRQHandler
|
||||
ADC1_2_IRQHandler
|
||||
USB_HP_CAN1_TX_IRQHandler
|
||||
USB_LP_CAN1_RX0_IRQHandler
|
||||
CAN1_RX1_IRQHandler
|
||||
CAN1_SCE_IRQHandler
|
||||
EXTI9_5_IRQHandler
|
||||
TIM1_BRK_IRQHandler
|
||||
TIM1_UP_IRQHandler
|
||||
TIM1_TRG_COM_IRQHandler
|
||||
TIM1_CC_IRQHandler
|
||||
TIM2_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM4_IRQHandler
|
||||
I2C1_EV_IRQHandler
|
||||
I2C1_ER_IRQHandler
|
||||
I2C2_EV_IRQHandler
|
||||
I2C2_ER_IRQHandler
|
||||
SPI1_IRQHandler
|
||||
SPI2_IRQHandler
|
||||
USART1_IRQHandler
|
||||
USART2_IRQHandler
|
||||
USART3_IRQHandler
|
||||
EXTI15_10_IRQHandler
|
||||
RTCAlarm_IRQHandler
|
||||
USBWakeUp_IRQHandler
|
||||
TIM8_BRK_IRQHandler
|
||||
TIM8_UP_IRQHandler
|
||||
TIM8_TRG_COM_IRQHandler
|
||||
TIM8_CC_IRQHandler
|
||||
ADC3_IRQHandler
|
||||
FSMC_IRQHandler
|
||||
SDIO_IRQHandler
|
||||
TIM5_IRQHandler
|
||||
SPI3_IRQHandler
|
||||
UART4_IRQHandler
|
||||
UART5_IRQHandler
|
||||
TIM6_IRQHandler
|
||||
TIM7_IRQHandler
|
||||
DMA2_Channel1_IRQHandler
|
||||
DMA2_Channel2_IRQHandler
|
||||
DMA2_Channel3_IRQHandler
|
||||
DMA2_Channel4_5_IRQHandler
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
|
||||
;*******************************************************************************
|
||||
; User Stack and Heap initialization
|
||||
;*******************************************************************************
|
||||
IF :DEF:__MICROLIB
|
||||
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
ELSE
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, =(Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
ENDIF
|
||||
|
||||
END
|
||||
|
||||
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****
|
307
CORE/startup_stm32f10x_md.s
Normal file
307
CORE/startup_stm32f10x_md.s
Normal file
@ -0,0 +1,307 @@
|
||||
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f10x_md.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V3.5.0
|
||||
;* Date : 11-March-2011
|
||||
;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM
|
||||
;* toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
;* - Set the vector table entries with the exceptions ISR address
|
||||
;* - Configure the clock system
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the CortexM3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;* <<< Use Configuration Wizard in Context Menu >>>
|
||||
;*******************************************************************************
|
||||
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
;*******************************************************************************
|
||||
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD PVD_IRQHandler ; PVD through EXTI Line detect
|
||||
DCD TAMPER_IRQHandler ; Tamper
|
||||
DCD RTC_IRQHandler ; RTC
|
||||
DCD FLASH_IRQHandler ; Flash
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_IRQHandler ; EXTI Line 0
|
||||
DCD EXTI1_IRQHandler ; EXTI Line 1
|
||||
DCD EXTI2_IRQHandler ; EXTI Line 2
|
||||
DCD EXTI3_IRQHandler ; EXTI Line 3
|
||||
DCD EXTI4_IRQHandler ; EXTI Line 4
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
|
||||
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
|
||||
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
|
||||
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
|
||||
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
|
||||
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
|
||||
DCD ADC1_2_IRQHandler ; ADC1_2
|
||||
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
|
||||
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
|
||||
DCD CAN1_RX1_IRQHandler ; CAN1 RX1
|
||||
DCD CAN1_SCE_IRQHandler ; CAN1 SCE
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD TIM1_BRK_IRQHandler ; TIM1 Break
|
||||
DCD TIM1_UP_IRQHandler ; TIM1 Update
|
||||
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
DCD I2C1_EV_IRQHandler ; I2C1 Event
|
||||
DCD I2C1_ER_IRQHandler ; I2C1 Error
|
||||
DCD I2C2_EV_IRQHandler ; I2C2 Event
|
||||
DCD I2C2_ER_IRQHandler ; I2C2 Error
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_IRQHandler ; USART3
|
||||
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
|
||||
DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
|
||||
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
IMPORT SystemInit
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT WWDG_IRQHandler [WEAK]
|
||||
EXPORT PVD_IRQHandler [WEAK]
|
||||
EXPORT TAMPER_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT RCC_IRQHandler [WEAK]
|
||||
EXPORT EXTI0_IRQHandler [WEAK]
|
||||
EXPORT EXTI1_IRQHandler [WEAK]
|
||||
EXPORT EXTI2_IRQHandler [WEAK]
|
||||
EXPORT EXTI3_IRQHandler [WEAK]
|
||||
EXPORT EXTI4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel5_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel6_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel7_IRQHandler [WEAK]
|
||||
EXPORT ADC1_2_IRQHandler [WEAK]
|
||||
EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
|
||||
EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
|
||||
EXPORT CAN1_RX1_IRQHandler [WEAK]
|
||||
EXPORT CAN1_SCE_IRQHandler [WEAK]
|
||||
EXPORT EXTI9_5_IRQHandler [WEAK]
|
||||
EXPORT TIM1_BRK_IRQHandler [WEAK]
|
||||
EXPORT TIM1_UP_IRQHandler [WEAK]
|
||||
EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM1_CC_IRQHandler [WEAK]
|
||||
EXPORT TIM2_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM4_IRQHandler [WEAK]
|
||||
EXPORT I2C1_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C1_ER_IRQHandler [WEAK]
|
||||
EXPORT I2C2_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C2_ER_IRQHandler [WEAK]
|
||||
EXPORT SPI1_IRQHandler [WEAK]
|
||||
EXPORT SPI2_IRQHandler [WEAK]
|
||||
EXPORT USART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_IRQHandler [WEAK]
|
||||
EXPORT USART3_IRQHandler [WEAK]
|
||||
EXPORT EXTI15_10_IRQHandler [WEAK]
|
||||
EXPORT RTCAlarm_IRQHandler [WEAK]
|
||||
EXPORT USBWakeUp_IRQHandler [WEAK]
|
||||
|
||||
WWDG_IRQHandler
|
||||
PVD_IRQHandler
|
||||
TAMPER_IRQHandler
|
||||
RTC_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
RCC_IRQHandler
|
||||
EXTI0_IRQHandler
|
||||
EXTI1_IRQHandler
|
||||
EXTI2_IRQHandler
|
||||
EXTI3_IRQHandler
|
||||
EXTI4_IRQHandler
|
||||
DMA1_Channel1_IRQHandler
|
||||
DMA1_Channel2_IRQHandler
|
||||
DMA1_Channel3_IRQHandler
|
||||
DMA1_Channel4_IRQHandler
|
||||
DMA1_Channel5_IRQHandler
|
||||
DMA1_Channel6_IRQHandler
|
||||
DMA1_Channel7_IRQHandler
|
||||
ADC1_2_IRQHandler
|
||||
USB_HP_CAN1_TX_IRQHandler
|
||||
USB_LP_CAN1_RX0_IRQHandler
|
||||
CAN1_RX1_IRQHandler
|
||||
CAN1_SCE_IRQHandler
|
||||
EXTI9_5_IRQHandler
|
||||
TIM1_BRK_IRQHandler
|
||||
TIM1_UP_IRQHandler
|
||||
TIM1_TRG_COM_IRQHandler
|
||||
TIM1_CC_IRQHandler
|
||||
TIM2_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM4_IRQHandler
|
||||
I2C1_EV_IRQHandler
|
||||
I2C1_ER_IRQHandler
|
||||
I2C2_EV_IRQHandler
|
||||
I2C2_ER_IRQHandler
|
||||
SPI1_IRQHandler
|
||||
SPI2_IRQHandler
|
||||
USART1_IRQHandler
|
||||
USART2_IRQHandler
|
||||
USART3_IRQHandler
|
||||
EXTI15_10_IRQHandler
|
||||
RTCAlarm_IRQHandler
|
||||
USBWakeUp_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
|
||||
;*******************************************************************************
|
||||
; User Stack and Heap initialization
|
||||
;*******************************************************************************
|
||||
IF :DEF:__MICROLIB
|
||||
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
ELSE
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, =(Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
ENDIF
|
||||
|
||||
END
|
||||
|
||||
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****
|
24
Doc/reademe.txt
Normal file
24
Doc/reademe.txt
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
202210126-01
|
||||
|
||||
故障码列表:
|
||||
0、正常
|
||||
3、充电桩主动停机
|
||||
4、小程序主动停机
|
||||
5、
|
||||
6、
|
||||
7、3分钟充电桩无电流输出
|
||||
8、长时间收不到充电桩can数据
|
||||
9、充电桩输出中断或暂停
|
||||
10、主板或枪座充电过温
|
||||
11、充电桩输出电压超过最大保护电压360V
|
||||
12、充电电流超过最大需求电流
|
||||
13、充电桩辅助电源24V--不支持
|
||||
14、1分钟收不到车辆can数据--超时
|
||||
15、 电池包充电状态信号--不等于3(快充可充电)
|
||||
16、 VecOptMod模式不等于4 (Charging)
|
||||
17、二次启动
|
||||
18、充电桩1分钟无输出正常电流
|
||||
19、充电桩输出电压突增超过400V,断开充电
|
||||
|
324
HARDWARE/CAN/CanBusDrv.c
Normal file
324
HARDWARE/CAN/CanBusDrv.c
Normal file
@ -0,0 +1,324 @@
|
||||
/***********************************************************************
|
||||
* @file name: canbusdrv.c
|
||||
* @create date: 2022-11-12
|
||||
* @author
|
||||
* @version: V 1.0.0
|
||||
* @remark:
|
||||
这个模块对can外设进行统一管理,忽略MCU接口的不同,对外一个统一的接口
|
||||
MCU的更换不涉及到这里
|
||||
************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "canbusdrv.h"
|
||||
#include "candrvctrl.h"
|
||||
|
||||
/**
|
||||
* 这个模块对can外设进行统一管理,忽略MCU接口的不同,对外一个统一的接口
|
||||
* MCU的更换不涉及到这里
|
||||
*/
|
||||
/**
|
||||
* 模块统一完成,总线的中断收发,和异常处理
|
||||
*/
|
||||
|
||||
static st_cancb tpcb[2];
|
||||
|
||||
/*****************************************************************************************
|
||||
* can 接收发送队列的处理
|
||||
*****************************************************************************************/
|
||||
|
||||
|
||||
typedef struct{
|
||||
bsp_can_cfg_t bsp_cfg; /* can 的配置 */
|
||||
unsigned int open_flg; /* 打开标志 0 - 关闭 1-打开中 2-已打开*/
|
||||
unsigned int sending; /* 正在发送的flag */
|
||||
can_frame_t tmp_frame; /* 临时报文 */
|
||||
}can_bus_t;
|
||||
|
||||
|
||||
static can_bus_t canbus[BSP_CAN_CHANNEL_NUM]={0};
|
||||
|
||||
|
||||
static __inline void can_bus_ready_hook(unsigned char channel)
|
||||
{
|
||||
if (channel >= BSP_CAN_CHANNEL_NUM) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 接收到消息的HOOK
|
||||
*
|
||||
* @param channel: 通道号
|
||||
* @param pt_fram[IN]: 接收到的消息内容
|
||||
*
|
||||
* @return:
|
||||
*/
|
||||
void bsp_can_msg_receive_hook(unsigned char channel, const can_frame_t * pt_fram)
|
||||
{
|
||||
|
||||
if (channel >= BSP_CAN_CHANNEL_NUM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(tpcb[channel].hdlFrmReceve != NULL)
|
||||
{
|
||||
tpcb[channel].hdlFrmReceve(channel,(pt_fram->IDE == CAN_ID_EXT)?pt_fram->ExtId:pt_fram->StdId, pt_fram->Data, pt_fram->DLC);
|
||||
}
|
||||
can_bus_ready_hook(channel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 发送消息完成的hook
|
||||
*
|
||||
* @param channel: 通道号
|
||||
* @param fifo_id: 消息空的ID
|
||||
* @param success: true 发送成功, false 发送失败
|
||||
*
|
||||
* @return: void
|
||||
*
|
||||
* @remark: 发送FIFO空的hook
|
||||
*/
|
||||
void bsp_can_msg_sent_hook(unsigned char channel, unsigned char fifo_id, bool success)
|
||||
{
|
||||
unsigned char ret_id;
|
||||
|
||||
if (channel >= BSP_CAN_CHANNEL_NUM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* 判断是否正在发送 */
|
||||
if (canbus[channel].sending&(0x00000001<<fifo_id))
|
||||
{
|
||||
canbus[channel].sending &= ~(0x00000001<<fifo_id);
|
||||
can_bus_ready_hook(channel);
|
||||
if(tpcb[channel].SendSuccessCb != NULL)
|
||||
{
|
||||
tpcb[channel].SendSuccessCb(channel,fifo_id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* 下面是对总线异常的处理
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief: 总线BUS OFF错误的hook函数
|
||||
*
|
||||
* @param channel: can 通道, 应该是 CAN1_CHANNEL 或者 CAN2_CHANNEL
|
||||
*
|
||||
* @return: void
|
||||
*
|
||||
* @remark: 当总线打开成功时被调用
|
||||
*/
|
||||
void can_bus_off_hook(unsigned char channel)
|
||||
{
|
||||
|
||||
if (channel >= BSP_CAN_CHANNEL_NUM) {
|
||||
return;
|
||||
}
|
||||
|
||||
SYS_ENTER_CRITICAL();
|
||||
if(tpcb[channel].BusOffCb != NULL)
|
||||
{
|
||||
tpcb[channel].BusOffCb(channel);
|
||||
}
|
||||
SYS_EXIT_CRITICAL();
|
||||
if (canbus[channel].sending > 0)
|
||||
{
|
||||
/* 说明有发送失败的,针对发送失败的后续处理暂留 */
|
||||
canbus[channel].sending = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 总线切换错误消极回应状态hook函数
|
||||
*
|
||||
* @param channel: can 通道,
|
||||
*
|
||||
* @return: void
|
||||
*
|
||||
* @remark: 当总线应答切换未消极应答时触发,一般是
|
||||
*/
|
||||
void can_bus_err_passive_hook(unsigned char channel)
|
||||
{
|
||||
if (channel >= BSP_CAN_CHANNEL_NUM) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(tpcb[channel].BusErrorStsCb != NULL)
|
||||
{
|
||||
tpcb[channel].BusErrorStsCb(channel, canbus[channel].sending > 0?true:false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 异步发送数据报文
|
||||
*
|
||||
* @param chan: can 通道号
|
||||
* @param canid: 报文ID
|
||||
* @param data[IN]: 数据内容
|
||||
* @param len: 数据长度
|
||||
*
|
||||
* @return 返回是否成功。
|
||||
* true: 成功 false: 失败
|
||||
*/
|
||||
bool can_bus_send(unsigned char chan,unsigned int canid,const unsigned char *data, unsigned char len)
|
||||
{
|
||||
can_frame_t tmp;
|
||||
|
||||
if (chan >= BSP_CAN_CHANNEL_NUM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CAN_FRAME_INIT(&tmp, canid, data, len);
|
||||
|
||||
|
||||
bsp_can_msg_sent_hook(chan, 0, true);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 立即发送数据报文
|
||||
*
|
||||
* @param chan: can 通道号
|
||||
* @param canid: 报文ID
|
||||
* @param data[IN]: 数据内容
|
||||
* @param len: 数据长度
|
||||
*
|
||||
* @return 返回标识号,0xFF 标识失败
|
||||
*/
|
||||
unsigned char can_bus_send_rt(unsigned char chan,unsigned int canid,const unsigned char *data, unsigned char len)
|
||||
{
|
||||
unsigned char ret_id;
|
||||
|
||||
if (chan >= BSP_CAN_CHANNEL_NUM || canbus[chan].open_flg != 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CAN_FRAME_INIT(&canbus[chan].tmp_frame, canid, data, len);
|
||||
|
||||
ret_id = bsp_can_msg_send(chan, &canbus[chan].tmp_frame);
|
||||
|
||||
if (ret_id != 0xFF)
|
||||
{
|
||||
canbus[chan].sending |= (0x00000001<<ret_id);
|
||||
}
|
||||
|
||||
return ret_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 打开总线
|
||||
*
|
||||
* @param chan: can通道
|
||||
* @param krate: 速率
|
||||
* @param highdomain: 高电平信号
|
||||
* @param listen: 是否为监听模式
|
||||
*
|
||||
* @return:
|
||||
* true: 成功 false 失败
|
||||
*/
|
||||
bool can_bus_open(unsigned char chan,unsigned short krate, bool highdomain, bool listen)
|
||||
{
|
||||
if (chan >= BSP_CAN_CHANNEL_NUM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
canbus[chan].open_flg = 1;
|
||||
canbus[chan].bsp_cfg.abom = false;
|
||||
canbus[chan].bsp_cfg.sleep = listen;
|
||||
canbus[chan].bsp_cfg.domain_h = highdomain;
|
||||
canbus[chan].bsp_cfg.krate = krate;
|
||||
|
||||
canbus[chan].sending = 0;
|
||||
if (bsp_can_open(chan, &canbus[chan].bsp_cfg))
|
||||
{
|
||||
canbus[chan].open_flg = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
canbus[chan].open_flg = 0;
|
||||
}
|
||||
return canbus[chan].open_flg == 2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 关闭接口
|
||||
*
|
||||
* @return:
|
||||
* 返回结果: true - open 成功 false - open 失败
|
||||
*/
|
||||
bool can_bus_close(unsigned char channel)
|
||||
{
|
||||
canbus[channel].open_flg = 0;
|
||||
bsp_can_close(channel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const st_canif tpchan[] =
|
||||
{
|
||||
{
|
||||
0, //chan1
|
||||
can_bus_open, //ConfigCan
|
||||
can_bus_send_rt, //canSend
|
||||
can_bus_close, //canClose
|
||||
NULL, //canHwPowerDown
|
||||
NULL, //canHwPowerUp
|
||||
NULL, //canBusFilterInit
|
||||
NULL, //canCloseFilter
|
||||
},
|
||||
|
||||
{
|
||||
1, //chan2
|
||||
can_bus_open, //ConfigCan
|
||||
can_bus_send_rt, //canSend
|
||||
can_bus_close, //canClose
|
||||
NULL, //canHwPowerDown
|
||||
NULL, //canHwPowerUp
|
||||
NULL, //canBusFilterInit
|
||||
NULL, //canCloseFilter
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
void InitCanifToCanDrvCtrl(void)
|
||||
{
|
||||
st_cancb *pcb;
|
||||
|
||||
memset(&canbus[0], 0x00, sizeof(canbus));
|
||||
memset(&tpcb[0], 0x00, sizeof(tpcb));
|
||||
|
||||
pcb = RegisterCanIF(&tpchan[0]);
|
||||
if(pcb!=NULL)
|
||||
memcpy(&tpcb[0],pcb,sizeof(st_cancb)); /* 下标要与st_canif.chan 一致 */
|
||||
|
||||
pcb = RegisterCanIF(&tpchan[1]);
|
||||
if(pcb!=NULL)
|
||||
memcpy(&tpcb[1],pcb,sizeof(st_cancb)); /* 下标要与st_canif.chan 一致 */
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#endif
|
||||
|
267
HARDWARE/CAN/CanBusDrv.h
Normal file
267
HARDWARE/CAN/CanBusDrv.h
Normal file
@ -0,0 +1,267 @@
|
||||
/***********************************************************************
|
||||
* @file name: canbusdrv.h
|
||||
* @create date: 2022-11-12
|
||||
* @author
|
||||
* @version: V 1.0.0
|
||||
* @remark:
|
||||
定义了与MCU can接口之间的接口
|
||||
************************************************************************/
|
||||
#ifndef __CANBUSDRV_H__
|
||||
#define __CANBUSDRV_H__
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Can 驱动的配置信息
|
||||
**************************************************************************/
|
||||
|
||||
/* 支持的最多can MCU */
|
||||
#define BSP_CAN_CHANNEL_NUM (2)
|
||||
|
||||
/* 数据报文的最大长度 */
|
||||
#define BSP_CAN_DATA_LENGTH_MAX (8)
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* 所有使用的类型定义
|
||||
**************************************************************************/
|
||||
|
||||
/* 与MCU相关的类型定义 */
|
||||
#include "porting.h"
|
||||
#include "string.h"
|
||||
/* 定义类型,并且定义从一般信息转换为此结构的函数 */
|
||||
typedef CanTxMsg can_frame_t;
|
||||
|
||||
static __inline void CAN_FRAME_INIT(can_frame_t * pt_frame, unsigned int canid,const unsigned char *data, unsigned char len)
|
||||
{
|
||||
if (pt_frame != NULL)
|
||||
{
|
||||
pt_frame->IDE = 0;
|
||||
pt_frame->StdId = 0;
|
||||
pt_frame->ExtId = 0;
|
||||
if (canid >= 0x800)
|
||||
{
|
||||
pt_frame->IDE = CAN_ID_EXT;
|
||||
pt_frame->ExtId = canid;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_frame->IDE = CAN_ID_STD;
|
||||
pt_frame->StdId = canid;
|
||||
}
|
||||
|
||||
if (len == 0 || data == NULL)
|
||||
{
|
||||
pt_frame->DLC = 0;
|
||||
pt_frame->RTR = CAN_RTR_REMOTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_frame->RTR = CAN_RTR_DATA;
|
||||
pt_frame->DLC = len;
|
||||
memcpy(pt_frame->Data, data, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
/* 定义can报文类型 */
|
||||
typedef enum {
|
||||
E_CAN_FRAME_STD_MASK = 0x01,
|
||||
E_CAN_FRAME_EXT_MASK = 0x02,
|
||||
E_CAN_FRAME_RTR_MASK = 0x04,
|
||||
} can_frame_mask_e;
|
||||
|
||||
/* 定义统一的can消息报文 */
|
||||
typedef struct {
|
||||
unsigned int id;
|
||||
can_frame_mask_e frame_type;
|
||||
#if BSP_CAN_DATA_LENGTH_MAX > 255
|
||||
unsigned short data_len;
|
||||
#else
|
||||
unsigned char data_len;
|
||||
#endif
|
||||
|
||||
unsigned char data[BSP_CAN_DATA_LENGTH_MAX];
|
||||
} can_frame_t;
|
||||
|
||||
static __inline void CAN_FRAME_INIT(can_frame_t * pt_frame, unsigned int canid,const unsigned char *data, unsigned char len)
|
||||
{
|
||||
if (pt_frame != NULL)
|
||||
{
|
||||
pt_frame->id = canid;
|
||||
pt_frame->frame_type = 0;
|
||||
|
||||
pt_frame->frame_type |= (canid >= 0x800)?E_CAN_FRAME_EXT_MASK:E_CAN_FRAME_STD_MASK;
|
||||
if (len ==0 || data == NULL)
|
||||
{
|
||||
pt_frame->frame_type |= E_CAN_FRAME_RTR_MASK;
|
||||
pt_frame->data_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_frame->data_len = (len>BSP_CAN_DATA_LENGTH_MAX)?BSP_CAN_DATA_LENGTH_MAX:len;
|
||||
memcpy(pt_frame->data, data, pt_frame->data_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* 与具体MCU CAN 硬件相关的接口
|
||||
**************************************************************************/
|
||||
/**
|
||||
* 底层MCU 必须实现的接口
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned short krate; /* can的速率 */
|
||||
bool listen; /* 是否监听模式打开, true 监听, false 非监听 */
|
||||
bool domain_h; /* 显性为高,还是低, true 为高, false 为低 */
|
||||
bool sleep; /* 睡眠模式, true 为休眠, false 为非休眠 */
|
||||
bool abom; /* 总线是否恢复, true 为自动恢复 false 为非自动恢复 */
|
||||
}bsp_can_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief: 接口的配置信息
|
||||
*
|
||||
* @param channel: can 通道号, 不大于MCU_CAN_CHANNEL_NUM
|
||||
* @param pt_bsp_cfg[IN]: 总线自动配置
|
||||
*
|
||||
* @return:
|
||||
* 返回结果: true - open 成功 false - open 失败
|
||||
*/
|
||||
bool bsp_can_open(unsigned char channel, const bsp_can_cfg_t * pt_bsp_cfg);
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 关闭接口
|
||||
*
|
||||
* @return:
|
||||
* 返回结果: true - open 成功 false - open 失败
|
||||
*/
|
||||
bool bsp_can_close(unsigned char channel);
|
||||
|
||||
|
||||
|
||||
#define BSP_CAN_SEND_FAIL (0xFF)
|
||||
/**
|
||||
* @brief: 发送接口
|
||||
*
|
||||
* @param channel: 通道号
|
||||
* @param pt_fram[IN]: 发送的消息内容
|
||||
*
|
||||
* @return:
|
||||
* 返回结果: 发送成功(填充到寄存器)的FIFO id
|
||||
* 失败返回0xFF
|
||||
*/
|
||||
unsigned char bsp_can_msg_send(unsigned char channel, const can_frame_t * pt_fram);
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 接收到消息的HOOK
|
||||
*
|
||||
* @param channel: 通道号
|
||||
* @param pt_fram[IN]: 接收到的消息内容
|
||||
*
|
||||
* @return:
|
||||
*/
|
||||
void bsp_can_msg_receive_hook(unsigned char channel, const can_frame_t * pt_fram);
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 发送消息完成的hook
|
||||
*
|
||||
* @param channel: 通道号
|
||||
* @param fifo_id: 消息空的ID
|
||||
* @param success: true 发送成功, false 发送失败
|
||||
*
|
||||
* @return: void
|
||||
*
|
||||
* @remark: 发送FIFO空的hook
|
||||
*/
|
||||
void bsp_can_msg_sent_hook(unsigned char channel, unsigned char fifo_id, bool success);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 总线PASSIVE hook
|
||||
*
|
||||
* @param channel: 通道号
|
||||
*
|
||||
* @return: void
|
||||
*/
|
||||
void bsp_can_passive_err_hook(unsigned char channel);
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 总线切换错误消极回应状态hook函数
|
||||
*
|
||||
* @param channel: can 通道,
|
||||
*
|
||||
* @return: void
|
||||
*
|
||||
* @remark: 当总线应答切换未消极应答时触发,一般是
|
||||
*/
|
||||
void can_bus_err_passive_hook(unsigned char channel);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* 对外接口
|
||||
**************************************************************************/
|
||||
/**
|
||||
* @brief: 异步发送数据报文
|
||||
*
|
||||
* @param chan: can 通道号
|
||||
* @param canid: 报文ID
|
||||
* @param data[IN]: 数据内容
|
||||
* @param len: 数据长度
|
||||
*
|
||||
* @return 返回是否成功。
|
||||
* true: 成功 false: 失败
|
||||
*/
|
||||
bool can_bus_send(unsigned char chan,unsigned int canid,const unsigned char *data, unsigned char len);
|
||||
|
||||
/**
|
||||
* @brief: 立即发送数据报文
|
||||
*
|
||||
* @param chan: can 通道号
|
||||
* @param canid: 报文ID
|
||||
* @param data[IN]: 数据内容
|
||||
* @param len: 数据长度
|
||||
*
|
||||
* @return 返回标识号,0xFF 标识失败
|
||||
*/
|
||||
unsigned char can_bus_send_rt(unsigned char chan,unsigned int canid,const unsigned char *data, unsigned char len);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 打开总线
|
||||
*
|
||||
* @param chan: can通道
|
||||
* @param krate: 速率
|
||||
* @param highdomain: 高电平信号
|
||||
* @param listen: 是否为监听模式
|
||||
*
|
||||
* @return:
|
||||
* true: 成功 false 失败
|
||||
*/
|
||||
bool can_bus_open(unsigned char chan,unsigned short krate, bool highdomain, bool listen);
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 跟can总线有关的所有处理入口
|
||||
*/
|
||||
void can_bus_handle(void);
|
||||
#endif
|
||||
|
845
HARDWARE/CAN/CanDrvCtrl.c
Normal file
845
HARDWARE/CAN/CanDrvCtrl.c
Normal file
@ -0,0 +1,845 @@
|
||||
/***********************************************************************
|
||||
* @file name: candrvctrl.c
|
||||
* @create date: 2022-11-19
|
||||
* @author
|
||||
* @version: V 1.0.0
|
||||
* @remark:
|
||||
这个模块对can外设进行统一管理,忽略MCU接口的不同,对外一个统一的接口
|
||||
MCU的更换不涉及到这里
|
||||
************************************************************************/
|
||||
|
||||
/*********************************************************************************************************************
|
||||
//CANDRVCTRL 作为传输协议与can驱动之间的中间层,作为一个纽带来将两者进行连接
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CAN驱动<------> 驱动管理层
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//can通道id和can消息帧id两者之间的同事用canid来表示容易出现混淆,
|
||||
// 故用chan表示can通道
|
||||
// 用frmid表示can消息帧id
|
||||
//
|
||||
//
|
||||
//can驱动层将需要给传输层控制的接口通过st_cancb * RegisterCanIF(st_canif *if) 接口传给此模块
|
||||
//st_cancb * RegisterCanIF(st_canif *if) 驱动层将某接口的控制权交给CanDrvCtrl模块
|
||||
//参数st_canif 是驱动统一交给CanDrvCtrl 的接口列表,其中ConfigCan ,canSend和canid必须提供
|
||||
//返回回调函数,驱动必须在适当的时候对其进行调用
|
||||
*********************************************************************************************************************/
|
||||
|
||||
#include "porting.h"
|
||||
#include "candrvctrl.h"
|
||||
|
||||
#if 0
|
||||
#define M_DEBUGF printf
|
||||
#else
|
||||
#define M_DEBUGF(...) ;
|
||||
#endif
|
||||
|
||||
#define MAX_CAN_IF_NUM 2
|
||||
#define PROTOCOL_VALID(PL) (PL.prompt[0] !=0) //判断是否有协议安装在某个接口,通过协议名字来进行
|
||||
#define SET_PROTOCOL_INVALID(PL) (PL.prompt[0] =0)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
e_step_send_idle=0, //空闲等待发送条件到达,进入e_step_send,通过定时器操作
|
||||
e_step_send, //进行发送然后进入e_step_waitack等待, //通过消息触发
|
||||
e_step_waitack, //通过定时器
|
||||
e_step_resend, //进行重发,当超时或等应答过程出现异常的时候
|
||||
e_step_fail, //已经发送失败
|
||||
e_step_suc, //发送成功
|
||||
}st_sendstep;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int frmid; //can信息id
|
||||
unsigned char sendindex;
|
||||
unsigned char datalen;
|
||||
unsigned char data[8];
|
||||
unsigned int msgident;
|
||||
void(*cb)(unsigned int msgident,unsigned int result);
|
||||
}st_senditem;
|
||||
typedef struct
|
||||
{
|
||||
unsigned int frmid; //can信息id
|
||||
unsigned char datalen;
|
||||
unsigned char data[8];
|
||||
}st_recitem;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char stimes;
|
||||
st_sendstep step;
|
||||
st_senditem sending; //当前正在发送的数据
|
||||
unsigned char waittime; //等待的时间
|
||||
unsigned char retrytimes;
|
||||
}st_sendmsg;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
st_canif canif;
|
||||
st_pl pl;
|
||||
unsigned char linkSts;
|
||||
st_fifo_t rec;
|
||||
st_fifo_t send;
|
||||
unsigned char *prec;
|
||||
unsigned char *psend;
|
||||
st_sendmsg smsg; //当前发送消息
|
||||
}st_if;
|
||||
|
||||
static void hdlIfSendSuccessCb(unsigned char chan,unsigned int index);
|
||||
static void hdlIfBusErrorCb(unsigned char chan,bool sending);
|
||||
static void hdlIfBusErrorStsCb(unsigned char chan,bool sending);
|
||||
static bool hdlIfFrmReceve(unsigned char chan,unsigned int canid,const unsigned char *data,unsigned char len);
|
||||
static void HdlSendMsgSuccess(st_if* pif,unsigned char index);
|
||||
static void hdlIfBusOffCb(unsigned char chan);
|
||||
|
||||
static st_if CanIF[MAX_CAN_IF_NUM];
|
||||
static st_cancb canifcb ={
|
||||
hdlIfSendSuccessCb,
|
||||
hdlIfBusErrorCb,
|
||||
hdlIfBusErrorStsCb,
|
||||
hdlIfBusOffCb,
|
||||
hdlIfFrmReceve};
|
||||
|
||||
|
||||
static st_if* GetIfFromChanel(unsigned char chan)
|
||||
{
|
||||
unsigned char i;
|
||||
|
||||
for(i=0;(i<NELEMENTS(CanIF))&&(CanIF[i].canif.chan != 0xFF);i++)
|
||||
{
|
||||
|
||||
if(CanIF[i].canif.chan == chan)
|
||||
{
|
||||
return &CanIF[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void hdlIfSendSuccessCb(unsigned char chan,unsigned int index)
|
||||
{
|
||||
st_if* pif=GetIfFromChanel(chan);
|
||||
|
||||
if(pif != NULL)
|
||||
{
|
||||
HdlSendMsgSuccess(pif,index);
|
||||
}
|
||||
}
|
||||
static void hdlIfBusErrorCb(unsigned char chan,bool sending)
|
||||
{
|
||||
st_if* pif;
|
||||
|
||||
pif=GetIfFromChanel(chan);
|
||||
if(pif != NULL)
|
||||
{
|
||||
if(pif->linkSts <= e_sts_closed)
|
||||
{
|
||||
if(pif->canif.canClose != NULL) pif->canif.canClose(chan);
|
||||
}
|
||||
else if(pif->linkSts == e_err_sending && sending)
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]hdlIfBusErrorStsCb: 检测到总线发送异常!\n");
|
||||
pif->linkSts = e_err_sending;
|
||||
can_kill( E_CAN_MSG_SIG,e_err_sending,chan);
|
||||
}
|
||||
else if(pif->linkSts != e_err_sending && sending == false)
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]hdlIfBusErrorStsCb: 检测到总线接收异常!\n");
|
||||
pif->linkSts = e_err_receive;
|
||||
can_kill( E_CAN_MSG_SIG,e_err_receive,chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 其他情况忽略 */
|
||||
}
|
||||
}
|
||||
}
|
||||
static void hdlIfBusErrorStsCb(unsigned char chan,bool sending)
|
||||
{
|
||||
hdlIfBusErrorCb(chan,sending);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void hdlIfBusOffCb(unsigned char chan)
|
||||
{
|
||||
st_if* pif;
|
||||
|
||||
pif=GetIfFromChanel(chan);
|
||||
if(pif != NULL)
|
||||
{
|
||||
if(pif->linkSts <= e_sts_closed)
|
||||
{
|
||||
if(pif->canif.canClose != NULL) pif->canif.canClose(chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]hdlIfBusOffCb: 检测到总线BUSOFF!\n");
|
||||
pif->linkSts = e_err_bussoff;
|
||||
can_kill( E_CAN_MSG_SIG,e_err_bussoff,chan);
|
||||
}
|
||||
}
|
||||
}
|
||||
static st_recitem tmpRItem;
|
||||
static bool hdlIfFrmReceve(unsigned char chan,unsigned int canid,const unsigned char *data,unsigned char len)
|
||||
{
|
||||
st_if* pif;
|
||||
|
||||
pif = GetIfFromChanel(chan);
|
||||
|
||||
if(pif != NULL && pif->linkSts >= e_sts_working)
|
||||
{
|
||||
if(e_err_receive == pif->linkSts)
|
||||
{
|
||||
pif->linkSts=e_sts_working;
|
||||
}
|
||||
|
||||
if(pif->pl.flg&CAN_FLG_SYNCRECEIVE)
|
||||
{
|
||||
if(pif->pl.hdlRecCanMsg!=NULL) pif->pl.hdlRecCanMsg(canid,data,len);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpRItem.frmid = canid;
|
||||
tmpRItem.datalen = len;
|
||||
if(tmpRItem.datalen > 0 && tmpRItem.datalen<=8) CAN_COPY(tmpRItem.data,data,tmpRItem.datalen);
|
||||
|
||||
sfifo_write(&pif->rec,&tmpRItem);
|
||||
if(sfifo_full(&pif->rec))
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]hdlIfFrmReceve: 接收缓冲已满\n");
|
||||
pif->linkSts=e_err_overfllow;
|
||||
can_kill( E_CAN_MSG_SIG,e_err_overfllow,chan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//注册通信接口和初始化
|
||||
st_cancb * RegisterCanIF(const st_canif *IF)
|
||||
{
|
||||
unsigned char i;
|
||||
|
||||
if(IF == NULL || IF->ConfigCan == NULL || IF->canSend==NULL ) return NULL;
|
||||
|
||||
for(i=0;i<NELEMENTS(CanIF);i++)
|
||||
{
|
||||
if(CanIF[i].canif.chan == IF->chan) return NULL;
|
||||
}
|
||||
|
||||
for(i=0;i<NELEMENTS(CanIF);i++)
|
||||
{
|
||||
if(CanIF[i].canif.chan == 0xFF)
|
||||
{
|
||||
CAN_COPY((void*)&(CanIF[i].canif),(void*)IF,sizeof(st_canif));
|
||||
CanIF[i].linkSts = e_sts_unused;
|
||||
return &canifcb;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//处理发送工作
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//重发
|
||||
static TIMER waitSendAck=0;
|
||||
#define WAIT_ACK_TIME 2
|
||||
#define WAIT_ACK_INTERVAL 10
|
||||
static void waitSendMsgAck(TIMER tmr_id)
|
||||
{
|
||||
unsigned char i;
|
||||
|
||||
for(i=0;i<MAX_CAN_IF_NUM;i++)
|
||||
{
|
||||
if(CanIF[i].linkSts < e_sts_working)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//发送失败后大约10ms重新发送
|
||||
if(CanIF[i].smsg.step == e_step_send) can_kill( E_CAN_MSG_SIG,e_sts_needsend,CanIF[i].canif.chan);
|
||||
|
||||
if(CanIF[i].smsg.step == e_step_waitack)
|
||||
{
|
||||
CanIF[i].smsg.waittime++;
|
||||
if(CanIF[i].smsg.waittime>= WAIT_ACK_TIME)
|
||||
{
|
||||
CanIF[i].smsg.step = e_step_resend;
|
||||
can_kill( E_CAN_MSG_SIG,e_sts_needsend,CanIF[i].canif.chan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void StartResendMsgTmr(void)
|
||||
{
|
||||
if(waitSendAck == 0) waitSendAck = can_timer_create(waitSendMsgAck);
|
||||
if(can_timer_switch(waitSendAck) == false) can_timer_start(waitSendAck, WAIT_ACK_INTERVAL);
|
||||
}
|
||||
|
||||
|
||||
static void HdlAllSengMsgSts(st_if* pif)
|
||||
{
|
||||
bool flg = false;
|
||||
|
||||
#if CAN_SEND_FASET_MODE > 0
|
||||
do {
|
||||
flg = false;
|
||||
#endif
|
||||
switch(pif->smsg.step)
|
||||
{
|
||||
case e_step_send_idle: //空闲等待发送条件到达,进入e_step_send,通过定时器操作
|
||||
if(pif->linkSts >= e_sts_working)
|
||||
{
|
||||
if(sfifo_empty(&(pif->send))==false)
|
||||
{
|
||||
if(sfifo_read(&(pif->send),&(pif->smsg.sending)))
|
||||
{
|
||||
pif->smsg.step=e_step_send;
|
||||
pif->smsg.stimes = 0;
|
||||
pif->smsg.waittime = 0;
|
||||
}
|
||||
flg = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case e_step_send: //进行发送然后进入e_step_waitack等待, //通过消息触发
|
||||
pif->smsg.sending.sendindex = pif->canif.canSend(pif->canif.chan,pif->smsg.sending.frmid,pif->smsg.sending.data,pif->smsg.sending.datalen);
|
||||
|
||||
pif->smsg.stimes++;
|
||||
if(pif->smsg.sending.sendindex != 0xFF)
|
||||
{
|
||||
pif->smsg.step=e_step_waitack;
|
||||
pif->smsg.waittime = 0;
|
||||
flg = true;
|
||||
if(pif->linkSts == e_err_sending) pif->linkSts = e_sts_working;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pif->smsg.stimes >= pif->pl.resendTimes)
|
||||
{
|
||||
pif->smsg.step=e_step_fail;
|
||||
flg = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 1
|
||||
case e_step_waitack: //通过定时器
|
||||
break;
|
||||
case e_step_resend: //进行重发,当超时或等应答过程出现异常的时候
|
||||
if(pif->smsg.stimes >= pif->pl.resendTimes)
|
||||
{
|
||||
pif->smsg.step=e_step_fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
pif->smsg.step=e_step_send;
|
||||
}
|
||||
flg = true;
|
||||
break;
|
||||
case e_step_fail: //已经发送失败
|
||||
pif->smsg.step=e_step_send_idle;
|
||||
if(pif->smsg.sending.cb != NULL) {pif->smsg.sending.cb(pif->smsg.sending.msgident,_FAILURE);}
|
||||
else if (pif->pl.hdlCommSent != NULL) {pif->pl.hdlCommSent(pif->smsg.sending.msgident,_FAILURE);}
|
||||
flg = true;
|
||||
break;
|
||||
case e_step_suc: //发送成功
|
||||
pif->smsg.step=e_step_send_idle;
|
||||
#if CAN_SEND_FASET_MODE > 0
|
||||
if(pif->smsg.sending.cb != NULL) {can_kill(E_CAN_MSG_CB_SIG, (unsigned int)(pif->smsg.sending.cb),pif->smsg.sending.msgident);}
|
||||
else if (pif->pl.hdlCommSent != NULL) {can_kill(E_CAN_MSG_CB_SIG, (unsigned int)(pif->pl.hdlCommSent),pif->smsg.sending.msgident);}
|
||||
#else
|
||||
if(pif->smsg.sending.cb != NULL) {pif->smsg.sending.cb(pif->smsg.sending.msgident,_SUCCESS);}
|
||||
else if (pif->pl.hdlCommSent != NULL) {pif->pl.hdlCommSent(pif->smsg.sending.msgident,_SUCCESS);}
|
||||
#endif
|
||||
flg = true;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
#if CAN_SEND_FASET_MODE > 0
|
||||
}while(flg == true && (pif->smsg.step != e_step_fail));
|
||||
#endif
|
||||
if(flg) can_kill( E_CAN_MSG_SIG,e_sts_needsend,pif->canif.chan);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void HdlSendMsgError(st_if* pif)
|
||||
{
|
||||
if(pif->smsg.step == e_step_waitack)
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]chan%d第%d(%d)次发送失败\n",pif->canif.chan,pif->smsg.stimes,pif->pl.resendTimes);
|
||||
if(pif->smsg.stimes >= pif->pl.resendTimes)
|
||||
{
|
||||
pif->smsg.step = e_step_fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
pif->smsg.step = e_step_resend;
|
||||
}
|
||||
can_kill( E_CAN_MSG_SIG,e_sts_needsend,pif->canif.chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]HdlSendError,当前发送步骤%d!=%d\n",pif->smsg.step,e_step_waitack);
|
||||
}
|
||||
}
|
||||
|
||||
static void HdlSendMsgSuccess(st_if* pif,unsigned char index)
|
||||
{
|
||||
//M_DEBUGF("[CDCtrl]chan=%d,%o sendOK(%d)\n",pif->canif.chan,index,pif->smsg.step);
|
||||
|
||||
if(pif->smsg.step == e_step_waitack||pif->smsg.step ==e_step_resend)
|
||||
{
|
||||
if(pif->smsg.sending.sendindex == index)
|
||||
{
|
||||
pif->smsg.step = e_step_suc;
|
||||
|
||||
#if CAN_SEND_FASET_MODE > 0
|
||||
if(pif->linkSts >= e_sts_working) HdlAllSengMsgSts(pif);
|
||||
#else
|
||||
can_kill( E_CAN_MSG_SIG,e_sts_needsend,pif->canif.chan);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]chan %d,index :%o#%o\n",pif->canif.chan,index,pif->smsg.sending.sendindex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************************************
|
||||
//CANDRVCTRL 作为传输协议与can驱动之间的中间层,作为一个纽带来将两者进行连接
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 驱动管理层<------> 传输协议 **************************
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//bool InstallProtocalToIF(unsigned char canid, st_pl* pif, st_cl * pcanif); 将某个接口与协议之间进行连接
|
||||
// 同一时间,一个接口仅仅可以与一个协议进行连接
|
||||
//参数st_pl, 是协议层需要提供的接口,这些信息在需要的时候被CANDRVCTRL调用
|
||||
//参数st_cl, 是CANDRVCTRL 提供的接口, 协议层可以通过这些接口进行数据发送等
|
||||
*********************************************************************************************************************/
|
||||
|
||||
static bool plSend(unsigned char chan,unsigned int frmid,unsigned char *data,unsigned char len,unsigned int msgident,void(*cb)(unsigned int msgident,unsigned int result))//若长度为0则表示是远程帧。
|
||||
{
|
||||
st_senditem send;
|
||||
st_if* pif=NULL;
|
||||
|
||||
pif=GetIfFromChanel(chan);
|
||||
|
||||
if(pif ==NULL ||pif->linkSts<=e_sts_closed|| len>8 || sfifo_full(&pif->send)) return false;
|
||||
|
||||
SYS_ENTER_CRITICAL();
|
||||
if (pif->linkSts == e_err_bussoff || pif->linkSts < e_sts_working)
|
||||
{
|
||||
SYS_EXIT_CRITICAL();
|
||||
return false;
|
||||
}
|
||||
|
||||
send.cb = cb;
|
||||
send.frmid = frmid;
|
||||
send.datalen = len;
|
||||
send.msgident = msgident;
|
||||
if(data == NULL) send.datalen = 0;
|
||||
if(send.datalen>0 && send.datalen<=8) CAN_COPY(send.data,data,send.datalen);
|
||||
send.sendindex = 0xFF;
|
||||
|
||||
sfifo_write(&pif->send,&send);
|
||||
|
||||
if(pif->smsg.step == e_step_send_idle)
|
||||
{
|
||||
#if CAN_SEND_FASET_MODE > 0
|
||||
HdlAllSengMsgSts(pif);
|
||||
#else
|
||||
can_kill( E_CAN_MSG_SIG,e_sts_needsend,pif->canif.chan);
|
||||
#endif
|
||||
}
|
||||
SYS_EXIT_CRITICAL();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool plReceive(unsigned char chan,unsigned int* frmid,unsigned char *data,unsigned char* len)//若长度为0则表示是远程帧。
|
||||
{
|
||||
st_recitem rec;
|
||||
st_if* pif=GetIfFromChanel(chan);
|
||||
|
||||
if(pif ==NULL ||pif->linkSts<=e_sts_closed || data==NULL || (pif->pl.flg&CAN_FLG_SYNCRECEIVE)) return false;
|
||||
|
||||
if(sfifo_empty(&pif->rec)) return false;
|
||||
|
||||
if(sfifo_read(&pif->rec,&rec)==0) return false;
|
||||
*frmid = rec.frmid;
|
||||
*len = rec.datalen;
|
||||
if(rec.datalen > 0 && rec.datalen<=8) CAN_COPY(data,rec.data,rec.datalen);
|
||||
|
||||
if (pif->linkSts == e_err_overfllow)
|
||||
{
|
||||
pif->linkSts = e_sts_working;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static unsigned int plGetCurrentLinkSts(unsigned char chan) //获取当前链状态
|
||||
{
|
||||
st_if* pif=NULL;
|
||||
|
||||
|
||||
pif=GetIfFromChanel(chan);
|
||||
|
||||
if(pif !=NULL) return pif->linkSts;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool plConfigBus(unsigned char chan,unsigned short krate, bool highdomain,bool listen)
|
||||
{
|
||||
st_if* pif=GetIfFromChanel(chan);
|
||||
|
||||
if(pif ==NULL ||pif->linkSts<=e_sts_unused) return false;
|
||||
|
||||
if(pif->canif.ConfigCan != NULL)
|
||||
{
|
||||
if(pif->canif.ConfigCan(chan,krate,highdomain,listen))
|
||||
{
|
||||
if(pif->psend != NULL)
|
||||
{
|
||||
sfifo_init(&pif->send,pif->psend,sizeof(st_senditem),pif->pl.msgNumber);
|
||||
}
|
||||
if((pif->pl.flg&CAN_FLG_SYNCRECEIVE)==0 && (pif->prec != NULL))
|
||||
{
|
||||
sfifo_init(&pif->rec,pif->prec,sizeof(st_recitem),pif->pl.msgNumber);
|
||||
}
|
||||
pif->linkSts = e_sts_working;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool plcanBusFilterInit(unsigned char chan,unsigned int *filterID_array, unsigned short filterID_total)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool plCloseLink(unsigned char chan)
|
||||
{
|
||||
st_if* pif=GetIfFromChanel(chan);
|
||||
|
||||
if(pif ==NULL ||pif->linkSts<=e_sts_closed) return false;
|
||||
pif->linkSts = e_sts_closed;
|
||||
|
||||
if(pif->canif.canClose != NULL) pif->canif.canClose(chan);
|
||||
|
||||
if(pif->smsg.step != e_step_send_idle)
|
||||
{
|
||||
if(pif->smsg.sending.cb != NULL)
|
||||
{
|
||||
if(pif->smsg.step == e_step_suc)
|
||||
{
|
||||
pif->smsg.sending.cb(pif->smsg.sending.msgident,_SUCCESS);
|
||||
}
|
||||
else if(pif->smsg.step == e_step_fail)
|
||||
{
|
||||
pif->smsg.sending.cb(pif->smsg.sending.msgident,_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
pif->smsg.sending.cb(pif->smsg.sending.msgident,_ABANDON);
|
||||
}
|
||||
}
|
||||
else if (pif->pl.hdlCommSent != NULL)
|
||||
{
|
||||
if(pif->smsg.step == e_step_suc)
|
||||
{
|
||||
pif->pl.hdlCommSent(pif->smsg.sending.msgident,_SUCCESS);
|
||||
}
|
||||
else if(pif->smsg.step == e_step_fail)
|
||||
{
|
||||
pif->pl.hdlCommSent(pif->smsg.sending.msgident,_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
pif->pl.hdlCommSent(pif->smsg.sending.msgident,_ABANDON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while(sfifo_empty(&(pif->send))==false)
|
||||
{
|
||||
if(sfifo_read(&(pif->send),&(pif->smsg.sending)))
|
||||
{
|
||||
if(pif->smsg.sending.cb != NULL) pif->smsg.sending.cb(pif->smsg.sending.msgident,_ABANDON);
|
||||
else if (pif->pl.hdlCommSent != NULL) {pif->pl.hdlCommSent(pif->smsg.sending.msgident,_ABANDON);}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
memset(&pif->smsg,0x00,sizeof(pif->smsg));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//CanDrvCtrl 模块消息处理部分
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static void hdlCanCtrlMsg(e_link_sts msg,unsigned char chan)
|
||||
{
|
||||
st_if* pif=GetIfFromChanel(chan);
|
||||
if(pif == NULL) return;
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case e_sts_needsend:
|
||||
if(pif->linkSts >= e_sts_working) HdlAllSengMsgSts(pif);
|
||||
break;
|
||||
case e_err_overfllow:
|
||||
if(pif->linkSts >= e_sts_working && pif->pl.hdlBusError!= NULL)
|
||||
{
|
||||
pif->pl.hdlBusError(e_err_overfllow);
|
||||
}
|
||||
break;
|
||||
case e_err_receive:
|
||||
|
||||
if(pif->linkSts >= e_sts_working && pif->pl.hdlBusError!= NULL)
|
||||
{
|
||||
pif->pl.hdlBusError(e_err_receive);
|
||||
}
|
||||
|
||||
break;
|
||||
case e_err_sending:
|
||||
if(pif->linkSts >= e_sts_working)
|
||||
{
|
||||
HdlSendMsgError(pif);
|
||||
if(pif->pl.hdlBusError!= NULL)pif->pl.hdlBusError(e_err_sending);
|
||||
}
|
||||
break;
|
||||
case e_err_bussoff:
|
||||
if(pif->linkSts >= e_sts_working)
|
||||
{
|
||||
if(pif->smsg.step == e_step_waitack)
|
||||
{
|
||||
pif->smsg.step = e_step_fail;
|
||||
can_kill( E_CAN_MSG_SIG,e_sts_needsend,pif->canif.chan);
|
||||
}
|
||||
|
||||
if(pif->pl.hdlBusError!= NULL)
|
||||
{
|
||||
pif->pl.hdlBusError(e_err_bussoff);
|
||||
}
|
||||
else
|
||||
{
|
||||
plCloseLink(pif->canif.chan);
|
||||
plConfigBus(pif->canif.chan, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//达到这里则出错
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void CAN_MSG_SIG_FUNC(unsigned int signal, int para1, int para2)
|
||||
{
|
||||
hdlCanCtrlMsg(para1, para2);
|
||||
}
|
||||
|
||||
|
||||
static void CAN_MSG_CB_SIG_FUNC(unsigned int signal, int para1, int para2)
|
||||
{
|
||||
void (*hdlCommSent)(unsigned int canid, unsigned int result);
|
||||
|
||||
hdlCommSent = (void *)para1;
|
||||
|
||||
if (hdlCommSent != NULL)
|
||||
{
|
||||
hdlCommSent(para2, _SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//协议层需要提供能接口
|
||||
|
||||
bool InstallProtocalToIF(unsigned char chan, st_pl* ppl, st_cl * pcl)
|
||||
{
|
||||
st_if* pif = NULL;
|
||||
st_pl *p_pl;
|
||||
|
||||
pif=GetIfFromChanel(chan);
|
||||
|
||||
if(pif == NULL || ppl == NULL||pcl==NULL) return false;
|
||||
|
||||
if(ppl->prompt[0]== 0 || pif->linkSts != e_sts_unused)
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]InstallProtocalToIF:协议名字为空或接口已安装有协议(%d)\n",pif->linkSts);
|
||||
return false;
|
||||
}
|
||||
|
||||
if((ppl->flg&CAN_FLG_SYNCRECEIVE) && ppl->hdlRecCanMsg == NULL)
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]InstallProtocalToIF: 未提供hdlRecCanMsg 接口\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
pif->pl.msgNumber = ppl->msgNumber;
|
||||
if(pif->pl.msgNumber == 0) pif->pl.msgNumber=50; //默认是50
|
||||
|
||||
pif->psend = CAN_MALLOC(sizeof(st_senditem)*pif->pl.msgNumber);
|
||||
if(pif->psend != NULL)
|
||||
{
|
||||
sfifo_init(&pif->send,pif->psend,sizeof(st_senditem),pif->pl.msgNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
M_DEBUGF("[CDCtrl]InstallProtocalToIF:内存分配失败,请求分配内存空间%d*%d\n",sizeof(st_senditem),pif->pl.msgNumber);
|
||||
return false;
|
||||
}
|
||||
|
||||
if((ppl->flg&CAN_FLG_SYNCRECEIVE)==0)
|
||||
{
|
||||
pif->prec = CAN_MALLOC(sizeof(st_recitem)*pif->pl.msgNumber);
|
||||
if(pif->prec != NULL)
|
||||
{
|
||||
sfifo_init(&pif->rec,pif->prec,sizeof(st_recitem),pif->pl.msgNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
CAN_FREE(pif->psend);
|
||||
pif->psend = NULL;
|
||||
M_DEBUGF("[CDCtrl]InstallProtocalToIF:内存分配失败,请求分配内存空间%d*%d\n",sizeof(st_senditem),pif->pl.msgNumber);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
pif->pl.flg = ppl->flg;
|
||||
p_pl = &(pif->pl);
|
||||
|
||||
memset(p_pl->prompt,0x00,sizeof(ppl->prompt));
|
||||
CAN_COPY(p_pl->prompt,ppl->prompt,sizeof(ppl->prompt)-1);
|
||||
p_pl->hdlBusError = ppl->hdlBusError;
|
||||
p_pl->hdlRecCanMsg= ppl->hdlRecCanMsg;
|
||||
p_pl->resendTimes = ppl->resendTimes;
|
||||
p_pl->hdlCommSent = ppl->hdlCommSent;
|
||||
|
||||
pcl->canBusFilterInit = plcanBusFilterInit;
|
||||
pcl->ConfigBus = plConfigBus;
|
||||
pcl->GetCurrentLinkSts = plGetCurrentLinkSts;
|
||||
pcl->REC = plReceive;
|
||||
pcl->SEND = plSend;
|
||||
pcl->CloseLink = plCloseLink;
|
||||
|
||||
pif->linkSts = e_sts_closed;
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool UninstallProtocalToIF(unsigned char chan, st_pl* ppl)
|
||||
{
|
||||
st_if* pif=NULL;
|
||||
|
||||
pif=GetIfFromChanel(chan);
|
||||
|
||||
if(ppl == NULL || pif == NULL) return false;
|
||||
|
||||
if(CAN_CMPY(ppl->prompt,pif->pl.prompt,sizeof(ppl->prompt)-1) != 0)
|
||||
{
|
||||
M_DEBUGF("协议层接口指针不匹配\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
//将状态切换到未使用状态
|
||||
pif->linkSts = e_sts_unused;
|
||||
|
||||
if(pif->canif.canCloseFilter != NULL)
|
||||
{
|
||||
pif->canif.canCloseFilter(chan);
|
||||
}
|
||||
if(pif->canif.canClose != NULL)
|
||||
{
|
||||
pif->canif.canClose(chan);
|
||||
}
|
||||
|
||||
//释放空间
|
||||
if((pif->pl.flg&CAN_FLG_SYNCRECEIVE)==0 && pif->prec != NULL)
|
||||
{
|
||||
CAN_FREE(pif->prec);
|
||||
pif->prec = NULL;
|
||||
}
|
||||
if(pif->psend != NULL)
|
||||
{
|
||||
CAN_FREE(pif->psend);
|
||||
pif->psend = NULL;
|
||||
}
|
||||
|
||||
|
||||
memset(&pif->pl,0x00,sizeof(st_pl));
|
||||
memset(&pif->smsg,0x00,sizeof(st_sendmsg));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void InitCanDrvCtrlMode(void)
|
||||
{
|
||||
unsigned char i;
|
||||
|
||||
for(i=0;i<NELEMENTS(CanIF);i++)
|
||||
{
|
||||
memset(&CanIF[i],0x00,sizeof(st_if));
|
||||
CanIF[i].canif.chan = 0xFF;
|
||||
}
|
||||
StartResendMsgTmr();
|
||||
|
||||
can_signal(E_CAN_MSG_SIG, CAN_MSG_SIG_FUNC);
|
||||
can_signal(E_CAN_MSG_CB_SIG, CAN_MSG_CB_SIG_FUNC);
|
||||
}
|
||||
|
||||
//#if DBG_CANCTRL > 0
|
||||
#if 0
|
||||
const static char* stsprompt[]={
|
||||
"e_sts_empty",
|
||||
"e_sts_unused",
|
||||
"e_sts_closed",
|
||||
"e_sts_working",
|
||||
};
|
||||
const static char* errprompt[]={
|
||||
"e_err_receive",
|
||||
"e_err_sending",
|
||||
"e_err_overfllow",
|
||||
};
|
||||
|
||||
void DprintCanDrvCtrl(void)
|
||||
{
|
||||
unsigned char i;
|
||||
|
||||
for(i=0;i<NELEMENTS(CanIF);i++)
|
||||
{
|
||||
M_DEBUGF("[%d]:%d:%s\n",i,CanIF[i].canif.chan,(CanIF[i].linkSts<80)?stsprompt[CanIF[i].linkSts]:errprompt[CanIF[i].linkSts-80]);
|
||||
if(CanIF[i].linkSts > e_sts_unused)
|
||||
{
|
||||
M_DEBUGF("\tprotocol:%s\n",CanIF[i].pl.prompt);
|
||||
}
|
||||
M_DEBUGF("\tMsg Step:%d\n",CanIF[i].smsg.step);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
111
HARDWARE/CAN/CanDrvCtrl.h
Normal file
111
HARDWARE/CAN/CanDrvCtrl.h
Normal file
@ -0,0 +1,111 @@
|
||||
#ifndef __CANDRVCTRL_H__
|
||||
#define __CANDRVCTRL_H__
|
||||
/*********************************************************************************************************************
|
||||
//CANDRVCTRL 作为传输协议与can驱动之间的中间层,作为一个纽带来将两者进行连接
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CAN驱动<------> 驱动管理层
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//can通道id和can消息帧id两者之间的同事用canid来表示容易出现混淆,
|
||||
// 故用chan表示can通道
|
||||
// 用frmid表示can消息帧id
|
||||
//
|
||||
//
|
||||
//can驱动层将需要给传输层控制的接口通过st_cancb * RegisterCanIF(st_canif *if) 接口传给此模块
|
||||
//st_cancb * RegisterCanIF(st_canif *if) 驱动层将某接口的控制权交给CanDrvCtrl模块
|
||||
//参数st_canif 是驱动统一交给CanDrvCtrl 的接口列表,其中ConfigCan ,canSend和canid必须提供
|
||||
//返回回调函数,驱动必须在适当的时候对其进行调用
|
||||
*********************************************************************************************************************/
|
||||
#include "porting.h"
|
||||
|
||||
|
||||
typedef struct{
|
||||
unsigned char chan; //can接口标识
|
||||
|
||||
bool (*ConfigCan)(unsigned char chan,unsigned short krate, bool highdomain,bool listen);
|
||||
unsigned char (*canSend)(unsigned char chan,unsigned int canid,unsigned char *data,unsigned char len);//发送某个can msg,返回此信息流水码,0xFFFFFFFF为失败
|
||||
bool (*canClose)(unsigned char chan);
|
||||
bool (*canHwPowerDown)(unsigned char chan);
|
||||
bool (*canHwPowerUp)(unsigned char chan);
|
||||
bool (*canBusFilterInit) (unsigned char chan ,unsigned int *filterID_array, unsigned short filterID_total);
|
||||
bool (*canCloseFilter) (unsigned char chan);
|
||||
}st_canif;
|
||||
|
||||
//下面这些接口需要“can驱动管理层”实现。hdlRemoteFrm若为NULL,则不接收远程帧.
|
||||
typedef struct{
|
||||
void (*SendSuccessCb)(unsigned char chan,unsigned int index); //某个消息发送成功
|
||||
void (*BusErrorCb)(unsigned char chan,bool sending); //总线错误
|
||||
void (*BusErrorStsCb)(unsigned char chan,bool sending); //总线错误状态改变
|
||||
void (*BusOffCb)(unsigned char chan); //总线进入BUS OFF 的回调
|
||||
bool (*hdlFrmReceve)(unsigned char chan,unsigned int canid, const unsigned char *data,unsigned char len); //len = 0表示远程帧
|
||||
}st_cancb;
|
||||
st_cancb * RegisterCanIF(const st_canif *IF);
|
||||
|
||||
/*********************************************************************************************************************
|
||||
//CANDRVCTRL 作为传输协议与can驱动之间的中间层,作为一个纽带来将两者进行连接
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 驱动管理层<------> 传输协议 **************************
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//bool InstallProtocalToIF(unsigned char canid, st_pl* pif, st_cl * pcanif); 将某个接口与协议之间进行连接
|
||||
// 同一时间,一个接口仅仅可以与一个协议进行连接
|
||||
//参数st_pl, 是协议层需要提供的接口,这些信息在需要的时候被CANDRVCTRL调用
|
||||
//参数st_cl, 是CANDRVCTRL 提供的接口, 协议层可以通过这些接口进行数据发送等
|
||||
*********************************************************************************************************************/
|
||||
|
||||
//控制层提供给协议层的接口
|
||||
typedef struct{
|
||||
//void(*cb)(unsigned int result) result :#define _SUCCESS 0 #define _FAILURE 1 #define _OVERTIME 2 #define _ABANDON 3
|
||||
bool (*SEND)(unsigned char chan,unsigned int frmid,unsigned char *data,unsigned char len,unsigned int msgident,void(*cb)(unsigned int msgident,unsigned int result));//若长度为0则表示是远程帧。
|
||||
bool (*REC)(unsigned char chan,unsigned int* frmid,unsigned char *data,unsigned char* len);//若长度为0则表示是远程帧。
|
||||
unsigned int (*GetCurrentLinkSts)(unsigned char chan); //获取当前链状态
|
||||
bool (*ConfigBus)(unsigned char chan,unsigned short krate, bool highdomain,bool listen);
|
||||
bool (*canBusFilterInit) (unsigned char chan,unsigned int *filterID_array, unsigned short filterID_total);
|
||||
bool (*CloseLink)(unsigned char chan);
|
||||
}st_cl;
|
||||
|
||||
|
||||
#define CAN_SEND_FASET_MODE 1
|
||||
//协议层需要提供接口
|
||||
#define CAN_FLG_SYNCRECEIVE 1 //接收后立马通过hdlRecCanMsg接口返回给应用层
|
||||
//否则协议层通过REC接口来手动读取
|
||||
typedef enum
|
||||
{
|
||||
e_sts_empty=0, //此接口上是空未有接口与其匹配,当调用RegisterCanIF后会变成unused
|
||||
e_sts_unused,
|
||||
e_sts_closed,
|
||||
e_sts_working, //当前正在工作,未发送
|
||||
e_sts_needsend, //当前正在发送
|
||||
e_err_receive=0x80,
|
||||
e_err_sending,
|
||||
e_err_overfllow,
|
||||
e_err_bussoff,
|
||||
}e_link_sts;
|
||||
|
||||
|
||||
typedef struct{
|
||||
char prompt[32]; //提示
|
||||
unsigned int flg; //bit0 = can消息接收方式
|
||||
unsigned char resendTimes; //配置重发次数
|
||||
unsigned char msgNumber; //接收、发送缓存队列个数
|
||||
void (*hdlRecCanMsg)(unsigned int id, const unsigned char *data,unsigned char len); //len是0表示是远程帧
|
||||
void (*hdlBusError)(e_link_sts err);
|
||||
void (*hdlCommSent)(unsigned int msgident, unsigned int result); //通用发送结果的回调
|
||||
}st_pl;
|
||||
|
||||
|
||||
//st_pl* ppl, st_cl * pcl 这两个参数地址空间的分配应该在协议层调用的时候
|
||||
bool InstallProtocalToIF(unsigned char chan, st_pl* ppl, st_cl * pcl);
|
||||
bool UninstallProtocalToIF(unsigned char chan, st_pl* ppl);
|
||||
|
||||
|
||||
//在处理过程中的一些消息处理机制
|
||||
|
||||
void hdlCanCtrlMsg(e_link_sts msg,unsigned char chan);
|
||||
|
||||
void InitCanDrvCtrlMode(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
BIN
HARDWARE/CAN/bsp_can.c
Normal file
BIN
HARDWARE/CAN/bsp_can.c
Normal file
Binary file not shown.
62
HARDWARE/CAN/bsp_can.h
Normal file
62
HARDWARE/CAN/bsp_can.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef __BSP_CAN_H
|
||||
#define __BSP_CAN_H
|
||||
#include "sys.h"
|
||||
|
||||
#include "stm32f10x.h"
|
||||
#include "stm32f10x_can.h"
|
||||
|
||||
|
||||
//CAN接收RX0中断使能
|
||||
#define CAN_RX0_INT_ENABLE 1 //0,不使能;1,使能.
|
||||
|
||||
u8 CAN_Mode_Init(void);//CAN初始化
|
||||
|
||||
u8 Can_Send_Msg(u8* msg,u8 len); //发送数据
|
||||
|
||||
u8 Can_Receive_Msg(u8 *buf); //接收数据
|
||||
|
||||
|
||||
#define CAN_RX2_INT_ENABLE 1 //0,不使能;1,使能.
|
||||
|
||||
u8 CAN2_Mode_Init(void);//CAN初始化
|
||||
|
||||
u8 Can2_Send_Msg(u8* msg,u8 len); //发送数据
|
||||
u8 Can2_Send_Message( CanTxMsg msg);
|
||||
u8 Can2_Receive_Msg(u8 *buf); //接收数据
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 处理bus off的recovery操作
|
||||
*
|
||||
* @param : void
|
||||
*
|
||||
* @return: void
|
||||
*
|
||||
* @remark: 自动恢复总线,可放在定时器或在循环内,其被执行的间隔不能超过10ms。
|
||||
*/
|
||||
void can_bus_off_recovery(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 打印 can 总线状态
|
||||
*/
|
||||
void can_bus_off_status_printf(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
BIN
HARDWARE/CAN/can.c
Normal file
BIN
HARDWARE/CAN/can.c
Normal file
Binary file not shown.
BIN
HARDWARE/CAN/can.h
Normal file
BIN
HARDWARE/CAN/can.h
Normal file
Binary file not shown.
511
HARDWARE/CAN/can_app.c
Normal file
511
HARDWARE/CAN/can_app.c
Normal file
@ -0,0 +1,511 @@
|
||||
|
||||
/******************** (C) COPYRIGHT 2011 嵌入式开发工作室 ********************
|
||||
* 文件名 :can_app.c
|
||||
* 描述 :
|
||||
*
|
||||
* 版本 :V1.0
|
||||
**********************************************************************************/
|
||||
#include "Sys.h"
|
||||
#include "adc.h"
|
||||
#include "can.h"
|
||||
#include "CanBusDrv.h"
|
||||
#include "candrvctrl.h"
|
||||
|
||||
static st_cl candrv_if[2];
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* 记录每一个CAN ID的发送时间
|
||||
****************************************************************************/
|
||||
static struct
|
||||
{
|
||||
unsigned int frame_id; /* ID */
|
||||
unsigned int period; /* 发送周期 */
|
||||
unsigned int send_tick; /* 发送TICK */
|
||||
unsigned int sent_tick; /* 发送成功TICK */
|
||||
} CAN_ID_SENT_TICK_MAP[] =
|
||||
{
|
||||
{CANBMS65CINFOID_WULING, 1000, 0, 0},
|
||||
{CANBMS38AINFOID_WULING, 100, 0, 0},
|
||||
{CANBMS38BINFOID_WULING, 100, 0, 0},
|
||||
{CANBMS38CINFOID_WULING, 100, 0, 0},
|
||||
{CANBMS38DINFOID_WULING, 100, 0, 0},
|
||||
{CANBMS38EINFOID_WULING, 100, 0, 0},
|
||||
{CANBMS598INFOID_WULING, 1000, 0, 0},
|
||||
{CANBMS599INFOID_WULING, 1000, 0, 0},
|
||||
{CANBMS59AINFOID_WULING, 1000, 0, 0},
|
||||
};
|
||||
void can2_bus_error_cb(e_link_sts err);
|
||||
|
||||
/****************************************************************************
|
||||
* @brief: 检测can ID的实际发送时间是否超过指定时间
|
||||
*
|
||||
* @param frame_id: 要检测的CAN ID,
|
||||
* @param outtime: 超时时间,单位ms
|
||||
*
|
||||
* @return: bool
|
||||
* true: 周期超时
|
||||
* false: 未达到超时时间
|
||||
*/
|
||||
bool can_sent_cycle_timeout(unsigned int frame_id)
|
||||
{
|
||||
unsigned short i;
|
||||
|
||||
for (i=0; i < (sizeof(CAN_ID_SENT_TICK_MAP)/sizeof(CAN_ID_SENT_TICK_MAP[0])); i++)
|
||||
{
|
||||
if (CAN_ID_SENT_TICK_MAP[i].frame_id == frame_id)
|
||||
{
|
||||
if ( CAN_ID_SENT_TICK_MAP[i].sent_tick == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// if (CAN_ID_SENT_TICK_MAP[i].send_tick == 0 || CAN_ID_SENT_TICK_MAP[i].sent_tick == 0)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
#if 0
|
||||
else if (abs(CAN_ID_SENT_TICK_MAP[i].sent_tick - CAN_ID_SENT_TICK_MAP[i].send_tick) < 5)
|
||||
{
|
||||
/* 发送时间和发送成功时间相近,则表示肯定上一次发送成功了,用发送时间进行对比 */
|
||||
if (TickOut(&CAN_ID_SENT_TICK_MAP[i].send_tick, CAN_ID_SENT_TICK_MAP[i].period))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (TickOut(&CAN_ID_SENT_TICK_MAP[i].sent_tick, CAN_ID_SENT_TICK_MAP[i].period - 3))
|
||||
{
|
||||
/* 发送时间和发送成功时间不相近,则表示肯定上一次发送失败了,用上一次发送成功时间进行对比 */
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* @brief: 记录每一个CANid的发送成功的时间
|
||||
*
|
||||
* @param frame_id: 发送成功CAN ID
|
||||
*
|
||||
* @return: void
|
||||
*/
|
||||
static __inline void can_sent_tick_update(unsigned int frame_id)
|
||||
{
|
||||
unsigned short i;
|
||||
|
||||
for (i=0; i < (sizeof(CAN_ID_SENT_TICK_MAP)/sizeof(CAN_ID_SENT_TICK_MAP[0])); i++)
|
||||
{
|
||||
if (CAN_ID_SENT_TICK_MAP[i].frame_id == frame_id)
|
||||
{
|
||||
TickOut(&CAN_ID_SENT_TICK_MAP[i].sent_tick, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* @brief: 记录每一个CANid的发送的时间
|
||||
*
|
||||
* @param frame_id: 发送成功CAN ID
|
||||
*
|
||||
* @return: void
|
||||
*/
|
||||
static __inline void can_send_tick_update(unsigned int frame_id)
|
||||
{
|
||||
unsigned short i;
|
||||
|
||||
for (i=0; i < (sizeof(CAN_ID_SENT_TICK_MAP)/sizeof(CAN_ID_SENT_TICK_MAP[0])); i++)
|
||||
{
|
||||
if (CAN_ID_SENT_TICK_MAP[i].frame_id == frame_id)
|
||||
{
|
||||
TickOut(&CAN_ID_SENT_TICK_MAP[i].send_tick, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*can 包 发送*/
|
||||
int8_t can_write( CanTxMsg *TxMessage)
|
||||
{
|
||||
u16 time_up = 0;
|
||||
|
||||
if (candrv_if[0].SEND != NULL)
|
||||
{
|
||||
return candrv_if[0].SEND(0, (TxMessage->IDE == CAN_ID_EXT)?TxMessage->ExtId:TxMessage->StdId, \
|
||||
TxMessage->Data, (TxMessage->RTR == CAN_RTR_DATA)?TxMessage->DLC:0, \
|
||||
(TxMessage->IDE == CAN_ID_EXT)?TxMessage->ExtId:TxMessage->StdId,NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int8_t can_write2( CanTxMsg *TxMessage)
|
||||
{
|
||||
u16 time_up = 0;
|
||||
uint8_t TransmitMailbox;
|
||||
static u16 sendpoweronflag = 0;
|
||||
static u8 sendlowvoltflag = 0;
|
||||
static u8 sendhighvoltflag = 0;
|
||||
|
||||
#if 1
|
||||
if(sendpoweronflag++ < 12) //刚上电不判断输入电压
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sendpoweronflag > 100)sendpoweronflag =100;
|
||||
if(sendlowvoltflag == 0)
|
||||
{
|
||||
if (Sample_DataS.VIN_Input_Voltage < 5.90) {
|
||||
sendlowvoltflag = 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Sample_DataS.VIN_Input_Voltage < 6.40) {
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendlowvoltflag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(sendhighvoltflag == 0)
|
||||
{
|
||||
if (Sample_DataS.VIN_Input_Voltage > 18.1) {
|
||||
sendhighvoltflag = 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Sample_DataS.VIN_Input_Voltage > 17.6) {
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendhighvoltflag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
//UDS禁止发送
|
||||
if (!UdsApi_Is_UdsEnableNCMTx()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (candrv_if[1].SEND != NULL)
|
||||
{
|
||||
if (candrv_if[1].SEND(1, (TxMessage->IDE == CAN_ID_EXT)?TxMessage->ExtId:TxMessage->StdId, \
|
||||
TxMessage->Data, (TxMessage->RTR == CAN_RTR_DATA)?TxMessage->DLC:0, \
|
||||
(TxMessage->IDE == CAN_ID_EXT)?TxMessage->ExtId:TxMessage->StdId, NULL))
|
||||
{
|
||||
/* 暂时不需要更新 */
|
||||
//can_send_tick_update((TxMessage->IDE == CAN_ID_EXT)?TxMessage->ExtId:TxMessage->StdId);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************************************************
|
||||
* 总线异常BUSSOFF的处理
|
||||
***********************************************************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
E_BUS_NORMAL = 0,
|
||||
E_BUS_BUSOFF,
|
||||
E_BUS_RECOVERY_ACK,
|
||||
} bus_recovery_step_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char step; /* 0 - 正常 1 - bus off 延时 2-bus off recovery 确认 */
|
||||
unsigned int bus_off_tick; /* 触发bus off的时间 */
|
||||
unsigned int recovery_tick; /* recovery的时间 */
|
||||
unsigned short recovery_times; /* 连续recovey次数 */
|
||||
unsigned char first_frm;
|
||||
} bus_off_recovery_t;
|
||||
|
||||
static const unsigned short BUS_OFF_TIME_MS[] = {30, 198, 198, 198, 198, 198};
|
||||
|
||||
static bus_off_recovery_t canbus[BSP_CAN_CHANNEL_NUM];
|
||||
|
||||
/**
|
||||
* @brief: 处理bus off的recovery操作
|
||||
*
|
||||
* @param : void
|
||||
*
|
||||
* @return: void
|
||||
*
|
||||
* @remark: 自动恢复总线,可放在定时器或在循环内,其被执行的间隔不能超过10ms。
|
||||
*/
|
||||
#include "led.h"
|
||||
extern void WULING_DCDCSendBms2_force(void);
|
||||
extern u8 EntSlpFlag ;
|
||||
void can_bus_off_recovery(void)
|
||||
{
|
||||
unsigned char i;
|
||||
unsigned int timeout;
|
||||
unsigned char buffer[8]={0};
|
||||
|
||||
for (i = 0; i < BSP_CAN_CHANNEL_NUM; i++)
|
||||
{
|
||||
// if ((canbus[i].step == E_BUS_BUSOFF) && (EntSlpFlag==0)/* && 非休眠条件*/)
|
||||
if ((canbus[i].step == E_BUS_BUSOFF)/* && 非休眠条件*/)
|
||||
{
|
||||
if (canbus[i].recovery_times < (sizeof(BUS_OFF_TIME_MS)/sizeof(BUS_OFF_TIME_MS[0])))
|
||||
{
|
||||
timeout = BUS_OFF_TIME_MS[canbus[i].recovery_times];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reopen 超过指定次数则使用设定的最后一个间隔 */
|
||||
timeout = BUS_OFF_TIME_MS[(sizeof(BUS_OFF_TIME_MS)/sizeof(BUS_OFF_TIME_MS[0]))-1];
|
||||
}
|
||||
if (TickOut(&canbus[i].bus_off_tick, timeout))
|
||||
{
|
||||
|
||||
SYS_ENTER_CRITICAL();
|
||||
canbus[i].recovery_times++;
|
||||
if (candrv_if[i].ConfigBus != NULL) candrv_if[i].ConfigBus(i, 0,0,0);
|
||||
canbus[i].step = E_BUS_RECOVERY_ACK;
|
||||
// /* 模拟发送网络管理数据包 */
|
||||
// if(ChkPwrManageAccoff()!=0 )
|
||||
// {
|
||||
buffer[0]=1;
|
||||
// }
|
||||
if (candrv_if[i].SEND!= NULL) candrv_if[i].SEND(i, CANBMS65CINFOID_WULING, buffer, 8, CANBMS65CINFOID_WULING, NULL);
|
||||
|
||||
SYS_EXIT_CRITICAL();
|
||||
TickOut(&canbus[i].recovery_tick, 0);
|
||||
canbus[i].first_frm = 1;
|
||||
}
|
||||
}
|
||||
else if (canbus[i].step == E_BUS_RECOVERY_ACK)
|
||||
{
|
||||
if (TickOut(&canbus[i].recovery_tick, 103))
|
||||
{
|
||||
WULING_DCDCSendBms2_force();
|
||||
canbus[i].recovery_times = 0;
|
||||
canbus[i].step = E_BUS_NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 打印 can 总线状态
|
||||
*/
|
||||
void can_bus_off_status_printf(void)
|
||||
{
|
||||
printf("can 1: step(%d), recorvery(%d), last bus off tick(%d), last recovery tick(%d)!\n", \
|
||||
canbus[0].step, canbus[0].recovery_times, canbus[0].bus_off_tick, canbus[0].recovery_tick);
|
||||
printf("can 2: step(%d), recorvery(%d), last bus off tick(%d) last recovery tick(%d)!\n", \
|
||||
canbus[1].step, canbus[1].recovery_times, canbus[1].bus_off_tick, canbus[1].recovery_tick);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* 以下是应用层针对总线底层的接口
|
||||
**********************************************************************************************/
|
||||
void can2_bus_error_cb(e_link_sts err)
|
||||
{
|
||||
if (err != e_err_bussoff)
|
||||
{
|
||||
/* 不是BUSS OFF暂时不处理 */
|
||||
return;
|
||||
}
|
||||
|
||||
if (canbus[1].step != E_BUS_BUSOFF)
|
||||
{
|
||||
|
||||
if (candrv_if[1].CloseLink != NULL) candrv_if[1].CloseLink(1);
|
||||
canbus[1].step = E_BUS_BUSOFF;
|
||||
TickOut(&canbus[1].bus_off_tick, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void can2_comm_sent_cb(unsigned int canid, unsigned int result)
|
||||
{
|
||||
/* 发送回调 */
|
||||
if (result == _SUCCESS)
|
||||
{
|
||||
/* 发送成功 */
|
||||
can_sent_tick_update(canid);
|
||||
if (canbus[1].first_frm > 0 && canbus[1].step == E_BUS_RECOVERY_ACK)
|
||||
{
|
||||
canbus[1].first_frm = 0;
|
||||
TickOut(&canbus[1].recovery_tick, 0);
|
||||
}
|
||||
}
|
||||
else if (result == _ABANDON)
|
||||
{
|
||||
/* 因为异常恢复 */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 发送失败 */
|
||||
}
|
||||
}
|
||||
|
||||
static st_pl can2_protocol =
|
||||
{
|
||||
"整车协议",
|
||||
0,
|
||||
3,
|
||||
10,
|
||||
NULL,
|
||||
can2_bus_error_cb,
|
||||
can2_comm_sent_cb
|
||||
};
|
||||
|
||||
#if 0
|
||||
static void can1_bus_error_cb(e_link_sts err)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void can1_comm_sent_cb(unsigned int canid, unsigned int result)
|
||||
{
|
||||
/* 发送回调 */
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static st_pl can1_protocol =
|
||||
{
|
||||
"整车协议",
|
||||
0,
|
||||
3,
|
||||
10,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitCanDrvCtrlMode(void);
|
||||
void InitCanifToCanDrvCtrl(void);
|
||||
bool InstallProtocalToIF(unsigned char chan, st_pl* ppl, st_cl * pcl);
|
||||
/**
|
||||
* @brief: 初始化can 协议的基础功能
|
||||
*/
|
||||
void can_porting_init(void);
|
||||
|
||||
/**
|
||||
* @brief: 初始化can 协议的基础功能的调度
|
||||
*/
|
||||
void can_porting_schedule(void);
|
||||
|
||||
|
||||
|
||||
|
||||
void app_can_handle(void)
|
||||
{
|
||||
static uint8_t bms_rev_busy_flag = 0;
|
||||
static CanRxMsg MutliBMSCAN1Msg;
|
||||
CanRxMsg rec_message;
|
||||
unsigned int id;
|
||||
unsigned char data[8], len;
|
||||
|
||||
can_porting_schedule();
|
||||
|
||||
while (candrv_if[0].REC != NULL && candrv_if[0].REC(0,&id, data, &len) == true)
|
||||
{
|
||||
/* 数据接收 */
|
||||
CAN_FRAME_INIT((CanTxMsg *)(&rec_message), id, data, len);
|
||||
rec_message.FMI = 0;
|
||||
|
||||
bms_rev_busy_flag = 1;
|
||||
|
||||
if(bms_RcvCanSingleDataProc(rec_message) == 1)
|
||||
{
|
||||
MutliBMSCAN1Msg = rec_message;
|
||||
bms_RcvCanMutliData(MutliBMSCAN1Msg,0,&bms_rev_busy_flag);
|
||||
}
|
||||
|
||||
IWDG_Feed();
|
||||
}
|
||||
|
||||
while (candrv_if[1].REC != NULL && candrv_if[1].REC(1,&id, data, &len) == true)
|
||||
{
|
||||
/* 数据接收 */
|
||||
CAN_FRAME_INIT((CanTxMsg *)(&rec_message), id, data, len);
|
||||
rec_message.FMI = 0;
|
||||
|
||||
//UDS允许接收
|
||||
if (UdsApi_Is_UdsEnableNCMRx()) {
|
||||
bms_RcvCan2DataProc(rec_message);
|
||||
}
|
||||
UdsApi_MsgQueueIn(rec_message);
|
||||
memset(&rec_message,0,sizeof(rec_message));
|
||||
|
||||
// bms_RcvCan2DataProc(rec_message);
|
||||
|
||||
IWDG_Feed();
|
||||
}
|
||||
|
||||
can_bus_off_recovery();
|
||||
}
|
||||
|
||||
|
||||
void app_can_init(void)
|
||||
{
|
||||
memset(&canbus[0], 0x00, sizeof(canbus));
|
||||
memset(&candrv_if[0], 0x00, sizeof(candrv_if));
|
||||
can_porting_init();
|
||||
InitCanDrvCtrlMode();
|
||||
InitCanifToCanDrvCtrl();
|
||||
|
||||
if(InstallProtocalToIF(0,&can1_protocol,&candrv_if[0]) == true)
|
||||
{
|
||||
printf("can1 协议初始化成功\r\n");
|
||||
}
|
||||
if(InstallProtocalToIF(1,&can2_protocol,&candrv_if[1]) == true)
|
||||
{
|
||||
printf("can2 协议初始化成功\r\n");
|
||||
}
|
||||
|
||||
if (candrv_if[0].ConfigBus != NULL)
|
||||
{
|
||||
candrv_if[0].ConfigBus(0, 0, 0, 0);
|
||||
}
|
||||
if (candrv_if[1].ConfigBus != NULL)
|
||||
{
|
||||
candrv_if[1].ConfigBus(1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
539
HARDWARE/CAN/porting.c
Normal file
539
HARDWARE/CAN/porting.c
Normal file
@ -0,0 +1,539 @@
|
||||
/**********************************************************
|
||||
** porting.c *
|
||||
** 2022-11-15 *
|
||||
** V1.0 *
|
||||
**********************************************************/
|
||||
|
||||
#include "porting.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 初始化一个FIFO
|
||||
*
|
||||
*
|
||||
*/
|
||||
void sfifo_init(st_fifo_t *stfifo, void *array, unsigned short stsize, unsigned short deepth)
|
||||
{
|
||||
stfifo->deepth = deepth;
|
||||
stfifo->occupy = 0;
|
||||
stfifo->array = array;
|
||||
stfifo->stsize = stsize;
|
||||
stfifo->limit = (void*)((unsigned int)array + stsize*deepth);
|
||||
stfifo->wp = stfifo->array;
|
||||
stfifo->rp = stfifo->array;
|
||||
}
|
||||
|
||||
void sfifo_reset(st_fifo_t *stfifo)
|
||||
{
|
||||
stfifo->occupy = 0;
|
||||
stfifo->rp = stfifo->array;
|
||||
stfifo->wp = stfifo->array;
|
||||
}
|
||||
|
||||
|
||||
bool sfifo_write(st_fifo_t *stfifo, const void *stunit)
|
||||
{
|
||||
if (stfifo->occupy >= stfifo->deepth || stfifo->array == NULL) return false;
|
||||
|
||||
memcpy((unsigned char*)stfifo->wp,(unsigned char*)stunit,stfifo->stsize);
|
||||
stfifo->wp = (void*)((unsigned int)stfifo->wp + stfifo->stsize);
|
||||
if (stfifo->wp >= stfifo->limit) stfifo->wp = stfifo->array;
|
||||
|
||||
stfifo->occupy++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sfifo_empty(st_fifo_t *stfifo)
|
||||
{
|
||||
if (stfifo->occupy == 0 || stfifo->array == NULL) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool sfifo_full(st_fifo_t *stfifo)
|
||||
{
|
||||
if (stfifo->occupy >= stfifo->deepth) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
unsigned int sfifo_read(st_fifo_t *stfifo,void *stunit)
|
||||
{
|
||||
|
||||
if (stfifo->occupy == 0 || stfifo->array == NULL) return 0x0;
|
||||
|
||||
memcpy((unsigned char*)stunit,(unsigned char*)stfifo->rp,stfifo->stsize);
|
||||
stfifo->rp = (void*)((unsigned int)stfifo->rp + stfifo->stsize);
|
||||
if (stfifo->rp >= stfifo->limit) stfifo->rp = stfifo->array;
|
||||
|
||||
|
||||
stfifo->occupy--;
|
||||
|
||||
return stfifo->stsize;
|
||||
}
|
||||
|
||||
unsigned int sfifo_occupy_get(st_fifo_t *stfifo)
|
||||
{
|
||||
return stfifo->occupy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************
|
||||
QUEUE
|
||||
******************************************************************/
|
||||
bool CreateQueue(QUEUE *que)
|
||||
{
|
||||
if (que == 0) return FALSE;
|
||||
que->head = 0;
|
||||
que->tail = 0;
|
||||
que->item = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
unsigned short QueueItem(QUEUE *que)
|
||||
{
|
||||
if (que == 0) return 0;
|
||||
else return (que->item);
|
||||
}
|
||||
|
||||
QUEUEMEM *QueueHead(QUEUE *que)
|
||||
{
|
||||
if (que == 0 || que->item == 0) return 0;
|
||||
else return ((QUEUEMEM *)que->head);// + sizeof(NODE));
|
||||
}
|
||||
|
||||
QUEUEMEM *QueueTail(QUEUE *que)
|
||||
{
|
||||
if (que == 0 || que->item == 0) return 0;
|
||||
else return ((QUEUEMEM *)que->tail);// + sizeof(NODE));
|
||||
}
|
||||
|
||||
QUEUEMEM *QueueNext(QUEUEMEM *element)
|
||||
{
|
||||
QUEUENODE *curnode;
|
||||
|
||||
if (element == 0) return 0;
|
||||
curnode = (QUEUENODE *)(element);// - sizeof(NODE));
|
||||
if ((curnode = curnode->next) == 0) return 0;
|
||||
else return ((QUEUEMEM *)curnode);// + sizeof(NODE));
|
||||
}
|
||||
|
||||
QUEUEMEM *DelQueueElement(QUEUE *que, QUEUEMEM *element)
|
||||
{
|
||||
QUEUENODE *curnode, *prenode, *nextnode;
|
||||
|
||||
if (que == 0 || element == 0) return 0;
|
||||
if (que->item == 0) return 0;
|
||||
|
||||
que->item--;
|
||||
curnode = (QUEUENODE *)(element);// - sizeof(NODE));
|
||||
|
||||
if (curnode == que->head) {
|
||||
que->head = curnode->next;
|
||||
if (que->item == 0) {
|
||||
que->tail = 0;
|
||||
return 0;
|
||||
} else {
|
||||
return (QUEUEMEM *)(que->head);// + sizeof(NODE);
|
||||
}
|
||||
}
|
||||
|
||||
nextnode = curnode->next;
|
||||
prenode = que->head;
|
||||
while (prenode != 0) {
|
||||
if (prenode->next == curnode) {
|
||||
break;
|
||||
} else {
|
||||
prenode = prenode->next;
|
||||
}
|
||||
}
|
||||
if (prenode == 0) return 0;
|
||||
|
||||
prenode->next = nextnode;
|
||||
if (curnode == que->tail) {
|
||||
que->tail = prenode;
|
||||
return 0;
|
||||
} else {
|
||||
return ((QUEUEMEM *)nextnode);// + sizeof(NODE));
|
||||
}
|
||||
}
|
||||
|
||||
// Return: Queue head
|
||||
QUEUEMEM *DelQueueHead(QUEUE *que)
|
||||
{
|
||||
QUEUEMEM *element;
|
||||
|
||||
if (que == 0 || que->item == 0) return 0;
|
||||
|
||||
element = (QUEUEMEM *)que->head;//+ sizeof(NODE);
|
||||
DelQueueElement(que, element);
|
||||
return element;
|
||||
}
|
||||
|
||||
// Return: Queue tail
|
||||
QUEUEMEM *DelQueueTail(QUEUE *que)
|
||||
{
|
||||
QUEUEMEM *element;
|
||||
|
||||
if (que == 0 || que->item == 0) return 0;
|
||||
|
||||
element = (QUEUEMEM *)que->tail;// + sizeof(NODE);
|
||||
DelQueueElement(que, element);
|
||||
return element;
|
||||
}
|
||||
|
||||
bool AppendQueue(QUEUE *que, QUEUEMEM *element)
|
||||
{
|
||||
QUEUENODE *curnode;
|
||||
|
||||
if (que == 0 || element == 0) return FALSE;
|
||||
|
||||
curnode = (QUEUENODE *)(element);// - sizeof(NODE));
|
||||
if (que->item == 0) {
|
||||
que->head = curnode;
|
||||
} else {
|
||||
que->tail->next = curnode;
|
||||
}
|
||||
curnode->next = 0;
|
||||
que->tail = curnode;
|
||||
que->item++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//intsert element before curelement
|
||||
bool InsertBeforeQueue(QUEUE *que, QUEUEMEM *element,QUEUEMEM *curelement)
|
||||
{
|
||||
QUEUENODE *curnode, *prenode, *node;
|
||||
|
||||
if (que == 0 || element == 0 || curelement == 0) return FALSE;
|
||||
node = (QUEUENODE*)element;
|
||||
curnode = (QUEUENODE*)curelement;
|
||||
|
||||
if (que->head == curnode) {
|
||||
que->head = node;
|
||||
node->next = curnode;
|
||||
} else {
|
||||
prenode = que->head;
|
||||
while (prenode != 0) {
|
||||
if (prenode->next == curnode) {
|
||||
break;
|
||||
} else {
|
||||
prenode = prenode->next;
|
||||
}
|
||||
}
|
||||
if (prenode == 0) return false;
|
||||
prenode->next = node;
|
||||
node->next = curnode;
|
||||
}
|
||||
que->item++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************信号相关的操作*******************************************************/
|
||||
typedef struct {
|
||||
unsigned int signal_id;
|
||||
unsigned int para1;
|
||||
unsigned int para2;
|
||||
} signal_cell_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int signal;
|
||||
signal_callback cb;
|
||||
}signal_callback_t;
|
||||
|
||||
typedef struct {
|
||||
signal_callback_t signal_map[20]; /* 存储my_kill 注册的信号和回调 */
|
||||
signal_cell_t signal[40];
|
||||
st_fifo_t queue;
|
||||
} signal_queue_t;
|
||||
|
||||
|
||||
static signal_queue_t can_signal_queue = {0};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \brief: 发送一个消息给进程PID
|
||||
* \para:
|
||||
* signal: my_signal_e 类型的信号值
|
||||
* para1,para2: 参数,my_kill 与对应消息回调之间传递参数用
|
||||
*
|
||||
* 这里除了将消息存放到队列外,还会检查当前队列中的消息
|
||||
* 个数,当超过一定值时给与警告提示
|
||||
*/
|
||||
int can_kill(unsigned int signal, unsigned int para1, unsigned int para2)
|
||||
{
|
||||
signal_cell_t signal_cell;
|
||||
|
||||
|
||||
signal_cell.signal_id = signal;
|
||||
signal_cell.para1 = para1;
|
||||
signal_cell.para2 = para2;
|
||||
|
||||
return sfifo_write(&can_signal_queue.queue, (void *)&signal_cell);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief: 申明捕获进程PID 的消息signal
|
||||
* \para:
|
||||
* signal: 要捕获的消息
|
||||
* cb: 捕获函数
|
||||
* \return:
|
||||
* 0-成功 <0 失败
|
||||
*
|
||||
*检查要捕获的消息是否已在pSQueue->mass 中被申明,已申明则返回失败
|
||||
*将其添加到pSQueue->signal_map 中
|
||||
*/
|
||||
int can_signal(unsigned int signal, signal_callback cb)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (signal == E_CAN_SIGNAL_NULL) return -1;
|
||||
|
||||
|
||||
/*如果已经申明则用新的回调函数替换之前的回调函数*/
|
||||
for (i=0; i<NELEMENTS(can_signal_queue.signal_map); i++)
|
||||
{
|
||||
if (can_signal_queue.signal_map[i].signal == signal)
|
||||
{
|
||||
can_signal_queue.signal_map[i].cb = cb;
|
||||
if (can_signal_queue.signal_map[i].cb == NULL)
|
||||
{
|
||||
/* 删除回调 */
|
||||
can_signal_queue.signal_map[i].signal = E_CAN_SIGNAL_NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*如果没有申明则添加*/
|
||||
if (cb == NULL)
|
||||
{
|
||||
/* 添加新信号,则其处理函数必须不为NULL */
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=0; i<NELEMENTS(can_signal_queue.signal_map); i++)
|
||||
{
|
||||
if (can_signal_queue.signal_map[i].signal == E_CAN_SIGNAL_NULL || can_signal_queue.signal_map[i].cb == NULL)
|
||||
{
|
||||
can_signal_queue.signal_map[i].signal = signal;
|
||||
can_signal_queue.signal_map[i].cb = cb;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* 信号功能的初始化 */
|
||||
int can_signal_queue_init(void)
|
||||
{
|
||||
memset(&can_signal_queue, 0x00, sizeof(can_signal_queue));
|
||||
sfifo_init(&can_signal_queue.queue, &can_signal_queue.signal[0], sizeof(can_signal_queue.signal[0]), NELEMENTS(can_signal_queue.signal));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 处理CAN的信号调度
|
||||
*/
|
||||
int can_signal_schedule(void)
|
||||
{
|
||||
signal_callback cb;
|
||||
signal_cell_t signal_cell;
|
||||
unsigned int i;
|
||||
|
||||
while(sfifo_empty(&can_signal_queue.queue) == false)
|
||||
{
|
||||
sfifo_read(&can_signal_queue.queue, (void *)&signal_cell);
|
||||
|
||||
for (i=0; i<NELEMENTS(can_signal_queue.signal_map); i++)
|
||||
{
|
||||
if (can_signal_queue.signal_map[i].signal == signal_cell.signal_id)
|
||||
{
|
||||
cb = can_signal_queue.signal_map[i].cb;
|
||||
if (cb != NULL) cb(signal_cell.signal_id, signal_cell.para1, signal_cell.para2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************定时器********************************************************************/
|
||||
typedef struct tmr_st {
|
||||
unsigned int holdtime; //定时时间,为0表示停止;
|
||||
unsigned int optime;
|
||||
can_tmr_func tmrfunc; //定时执行任务的指针
|
||||
} timer_cell_t;;
|
||||
|
||||
static timer_cell_t can_timer[20];
|
||||
|
||||
|
||||
TIMER can_timer_create(can_tmr_func cb)
|
||||
{
|
||||
unsigned short i;
|
||||
|
||||
if (cb == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < NELEMENTS(can_timer); i++)
|
||||
{
|
||||
if (can_timer[i].tmrfunc == NULL)
|
||||
{
|
||||
can_timer[i].tmrfunc = cb;
|
||||
can_timer[i].holdtime = 0;
|
||||
return (TIMER)&can_timer[i];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void can_timer_remove(TIMER tmr)
|
||||
{
|
||||
timer_cell_t *pCur = (timer_cell_t *)tmr;
|
||||
|
||||
if ((NULL == pCur))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pCur->holdtime = 0;
|
||||
pCur->optime = 0;
|
||||
pCur->tmrfunc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
void can_timer_start(TIMER tmr,unsigned int ms)
|
||||
{
|
||||
timer_cell_t *pCur = (timer_cell_t *)tmr;
|
||||
|
||||
if (pCur == NULL) return;
|
||||
|
||||
pCur->holdtime = ms;
|
||||
|
||||
TickOut(&(pCur->optime), 0);
|
||||
}
|
||||
|
||||
|
||||
void can_timer_stop(TIMER tmr)
|
||||
{
|
||||
timer_cell_t *pCur = (timer_cell_t *)tmr;
|
||||
|
||||
if (pCur == NULL) return;
|
||||
|
||||
pCur->holdtime = 0;
|
||||
}
|
||||
|
||||
bool can_timer_switch(TIMER tmr)
|
||||
{
|
||||
timer_cell_t *pCur = (timer_cell_t *)tmr;
|
||||
|
||||
if (pCur == NULL) return false;
|
||||
|
||||
if (pCur->holdtime > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* 定时器功能的初始化 */
|
||||
int can_timer_init(void)
|
||||
{
|
||||
memset(can_timer, 0x00, sizeof(can_timer));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* 定时器功能的初始化 */
|
||||
int can_timer_schedule(void)
|
||||
{
|
||||
unsigned int tick, i, holdtime, last_tick = 0;
|
||||
can_tmr_func cb;
|
||||
|
||||
TickOut(&tick, 0);
|
||||
|
||||
if (tick == last_tick || tick == (last_tick+1))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
last_tick = tick;
|
||||
|
||||
for (i = 0; i < NELEMENTS(can_timer); i++)
|
||||
{
|
||||
cb = can_timer[i].tmrfunc;
|
||||
holdtime = can_timer[i].holdtime;
|
||||
|
||||
if (holdtime > 0 && cb != NULL)
|
||||
{
|
||||
|
||||
if (TickOut(&can_timer[i].optime,holdtime) == TRUE)
|
||||
{
|
||||
if (can_timer[i].tmrfunc != NULL)
|
||||
{
|
||||
can_timer[i].optime += ((tick - can_timer[i].optime)/holdtime*holdtime);
|
||||
}
|
||||
|
||||
if (cb != NULL)
|
||||
{
|
||||
cb((TIMER)&can_timer[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 初始化can 协议的基础功能
|
||||
*/
|
||||
void can_porting_init(void)
|
||||
{
|
||||
can_timer_init();
|
||||
can_signal_queue_init();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 初始化can 协议的基础功能的调度
|
||||
*/
|
||||
void can_porting_schedule(void)
|
||||
{
|
||||
can_signal_schedule();
|
||||
can_timer_schedule();
|
||||
}
|
||||
|
||||
|
170
HARDWARE/CAN/porting.h
Normal file
170
HARDWARE/CAN/porting.h
Normal file
@ -0,0 +1,170 @@
|
||||
/****************************************************************
|
||||
* porting.h *
|
||||
* 2022-11-15 *
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _PROTOCOL_PORTING_H_
|
||||
|
||||
#define _PROTOCOL_PORTING_H_
|
||||
|
||||
/* 类型定义 */
|
||||
#include <stdlib.h>
|
||||
#include "stdint.h"
|
||||
#include <stdbool.h>
|
||||
#include "sys.h"
|
||||
|
||||
#define NELEMENTS(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
#define _SUCCESS 0
|
||||
#define _FAILURE 1
|
||||
#define _OVERTIME 2
|
||||
#define _ABANDON 3
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned short deepth; /* 总共有多少元素 */
|
||||
unsigned short occupy; /* 已占用元素个数 */
|
||||
unsigned short stsize; /* 每个元素的大小 */
|
||||
void *array; /* 存放的缓存 */
|
||||
void *limit; /* 缓存末尾 */
|
||||
void *wp; /* 写指针 */
|
||||
void *rp; /* 读指针 */
|
||||
} st_fifo_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief: 初始化一个FIFO
|
||||
*
|
||||
*
|
||||
*/
|
||||
void sfifo_init(st_fifo_t *stfifo, void *array, unsigned short stsize, unsigned short deepth);
|
||||
|
||||
void sfifo_reset(st_fifo_t *stfifo);
|
||||
|
||||
|
||||
bool sfifo_write(st_fifo_t *stfifo, const void *stunit);
|
||||
|
||||
bool sfifo_empty(st_fifo_t *stfifo);
|
||||
|
||||
bool sfifo_full(st_fifo_t *stfifo);
|
||||
|
||||
unsigned int sfifo_read(st_fifo_t *stfifo,void *stunit);
|
||||
|
||||
unsigned int sfifo_occupy_get(st_fifo_t *stfifo);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define QUEUEMEM unsigned char
|
||||
#define QUEUENODE struct node
|
||||
|
||||
typedef struct node{
|
||||
QUEUENODE *next;
|
||||
} NODE;
|
||||
|
||||
typedef struct {
|
||||
QUEUENODE *head;
|
||||
QUEUENODE *tail;
|
||||
unsigned short item;
|
||||
} QUEUE;
|
||||
|
||||
bool CreateQueue(QUEUE *que);
|
||||
unsigned short QueueItem(QUEUE *que);
|
||||
QUEUEMEM *QueueHead(QUEUE *que);
|
||||
QUEUEMEM *QueueTail(QUEUE *que);
|
||||
QUEUEMEM *QueueNext(QUEUEMEM *element);
|
||||
QUEUEMEM *DelQueueElement(QUEUE *que, QUEUEMEM *element);
|
||||
QUEUEMEM *DelQueueHead(QUEUE *que);
|
||||
QUEUEMEM *DelQueueTail(QUEUE *que);
|
||||
bool AppendQueue(QUEUE *que, QUEUEMEM *element);
|
||||
bool InsertBeforeQueue(QUEUE *que, QUEUEMEM *element,QUEUEMEM *curelement);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* 内存相关的接口移植 */
|
||||
/*
|
||||
* void mem_cpy (void* dst, const void* src, int cnt); CAN_COPY
|
||||
* void mem_set (void* dst, int val, int cnt);
|
||||
* int mem_cmp (const void* dst, const void* src, int cnt);
|
||||
* void *mem_malloc(mem_size_t size);
|
||||
* void mem_free(void *mem);
|
||||
*/
|
||||
#define CAN_MALLOC(size) malloc(size)
|
||||
#define CAN_COPY(p_des, p_src, size) memcpy((p_des), (p_src), (size))
|
||||
#define CAN_CMPY(p_des, p_src, size) memcmp((p_des), (p_src), (size))
|
||||
#define CAN_FREE(p) free(p)
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 信号的回调
|
||||
* para:
|
||||
* signal: 信号标志
|
||||
* para1: 参数,与发送者定义
|
||||
* para2: 参数,与发送者定义
|
||||
*/
|
||||
typedef void (*signal_callback)(unsigned int signal, int para1, int para2);
|
||||
|
||||
/*
|
||||
* \brief: 发送一个消息给进程PID
|
||||
* \para:
|
||||
* signal: my_signal_e 类型的信号值
|
||||
* para1,para2: 参数,my_kill 与对应消息回调之间传递参数用
|
||||
*/
|
||||
int can_kill(unsigned int signal, unsigned int para1, unsigned int para2);
|
||||
|
||||
/*
|
||||
* \brief: 申明捕获进程PID 的消息signal
|
||||
* \para:
|
||||
* signal: 要捕获的消息
|
||||
* cb: 捕获函数
|
||||
* \return:
|
||||
* 0-成功 <0 失败
|
||||
* \remark:
|
||||
* 1) my_signal_queue_create 中已申明的消息ID,不能再my_signal
|
||||
* 2) 同一个消息可以多次my_signal,但只有最后一次有效
|
||||
* 但是不要这么用
|
||||
*/
|
||||
int can_signal(unsigned int signal, signal_callback cb);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 定义CAN信号类型
|
||||
*/
|
||||
typedef enum {
|
||||
E_CAN_SIGNAL_NULL = 0,
|
||||
E_CAN_MSG_SIG,
|
||||
E_CAN_MSG_CB_SIG, /* 用来处理信号的发送回调 */
|
||||
E_CAN_15765_NET_SIG,
|
||||
E_CAN_15765_SS_SIG,
|
||||
} can_signal_e;
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************定时器********************************************************/
|
||||
typedef unsigned int TIMER;
|
||||
typedef void (*can_tmr_func)(TIMER tmr_id); //定时执行任务的指针
|
||||
TIMER can_timer_create(can_tmr_func cb);
|
||||
|
||||
void can_timer_remove(TIMER tmr);
|
||||
|
||||
void can_timer_start(TIMER tmr,unsigned int ms);
|
||||
|
||||
|
||||
void can_timer_stop(TIMER tmr);
|
||||
|
||||
bool can_timer_switch(TIMER tmr);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
2
HARDWARE/CAN/readme.txt
Normal file
2
HARDWARE/CAN/readme.txt
Normal file
@ -0,0 +1,2 @@
|
||||
bsp_can 是对MCU的接口部分,相当于是MCU的移植部分
|
||||
CanBusDrv 提供对can的统一处理, 完成总线的异常处理等
|
BIN
HARDWARE/LED/led.c
Normal file
BIN
HARDWARE/LED/led.c
Normal file
Binary file not shown.
BIN
HARDWARE/LED/led.h
Normal file
BIN
HARDWARE/LED/led.h
Normal file
Binary file not shown.
BIN
HARDWARE/LOWPOWER/app_pwr_manage.c
Normal file
BIN
HARDWARE/LOWPOWER/app_pwr_manage.c
Normal file
Binary file not shown.
46
HARDWARE/LOWPOWER/app_pwr_manage.h
Normal file
46
HARDWARE/LOWPOWER/app_pwr_manage.h
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
#ifndef __app_pwr_manage_H
|
||||
#define __app_pwr_manage_H
|
||||
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
extern uint8_t NetworkManageFrameFlag;
|
||||
|
||||
|
||||
void PwrManageInit(void);
|
||||
void EnterSleepProcess(void);
|
||||
void PwrManageWork(void);
|
||||
void EXIT_Configuration(FunctionalState val);
|
||||
void BSP_BKP_Init(void);
|
||||
|
||||
/**
|
||||
* @breif: 返回是否接收到其他节点的网络管理帧 8s内
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return int: 0 - 已没有网络管理帧 < 0 还存在网络管理帧
|
||||
*/
|
||||
|
||||
int ChkNetworkManageoff(void);
|
||||
|
||||
/**
|
||||
* @breif: 返回满足休眠的物理条件状态
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return int: 0 - 满足 < 0 不满足
|
||||
*/
|
||||
int ChkPwrManageAccoff(void);
|
||||
|
||||
|
||||
/**
|
||||
* @breif: 返回是否满足应用程序需要静音
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return int: 0 - 满足 < 0 不满足
|
||||
*/
|
||||
int ChkPwrManageAppDataMute(void);
|
||||
#endif
|
||||
|
BIN
HARDWARE/TIMER/timer.c
Normal file
BIN
HARDWARE/TIMER/timer.c
Normal file
Binary file not shown.
BIN
HARDWARE/TIMER/timer.h
Normal file
BIN
HARDWARE/TIMER/timer.h
Normal file
Binary file not shown.
BIN
HARDWARE/uart_uart/uart_uart.c
Normal file
BIN
HARDWARE/uart_uart/uart_uart.c
Normal file
Binary file not shown.
BIN
HARDWARE/uart_uart/uart_uart.h
Normal file
BIN
HARDWARE/uart_uart/uart_uart.h
Normal file
Binary file not shown.
BIN
OBJ/24cxx.crf
Normal file
BIN
OBJ/24cxx.crf
Normal file
Binary file not shown.
19
OBJ/24cxx.d
Normal file
19
OBJ/24cxx.d
Normal file
@ -0,0 +1,19 @@
|
||||
..\obj\24cxx.o: ..\SYSTEM\24cxx.c
|
||||
..\obj\24cxx.o: ..\SYSTEM\24cxx.h
|
||||
..\obj\24cxx.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\24cxx.o: ..\USER\stm32f10x.h
|
||||
..\obj\24cxx.o: ..\CORE\core_cm3.h
|
||||
..\obj\24cxx.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\24cxx.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\24cxx.o: ..\USER\stm32f10x.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\24cxx.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\24cxx.o: ..\SYSTEM\bsp_i2c_gpio.h
|
||||
..\obj\24cxx.o: ..\HARDWARE\LED\led.h
|
||||
..\obj\24cxx.o: ..\SYSTEM\sys\sys.h
|
BIN
OBJ/24cxx.o
Normal file
BIN
OBJ/24cxx.o
Normal file
Binary file not shown.
BIN
OBJ/4g_ec200_handle.crf
Normal file
BIN
OBJ/4g_ec200_handle.crf
Normal file
Binary file not shown.
19
OBJ/4g_ec200_handle.d
Normal file
19
OBJ/4g_ec200_handle.d
Normal file
@ -0,0 +1,19 @@
|
||||
..\obj\4g_ec200_handle.o: ..\SYSTEM\4G_EC200_Handle.c
|
||||
..\obj\4g_ec200_handle.o: ..\SYSTEM\4G_EC200_Handle.h
|
||||
..\obj\4g_ec200_handle.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\4g_ec200_handle.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\4g_ec200_handle.o: ..\SYSTEM\usart\usart.h
|
||||
..\obj\4g_ec200_handle.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\4g_ec200_handle.o: ..\USER\stm32f10x.h
|
||||
..\obj\4g_ec200_handle.o: ..\CORE\core_cm3.h
|
||||
..\obj\4g_ec200_handle.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\4g_ec200_handle.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\4g_ec200_handle.o: ..\USER\stm32f10x.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\4g_ec200_handle.o: ..\STM32F10x_FWLib\inc\misc.h
|
BIN
OBJ/4g_ec200_handle.o
Normal file
BIN
OBJ/4g_ec200_handle.o
Normal file
Binary file not shown.
BIN
OBJ/App.bin
Normal file
BIN
OBJ/App.bin
Normal file
Binary file not shown.
6895
OBJ/DCBms.hex
Normal file
6895
OBJ/DCBms.hex
Normal file
File diff suppressed because it is too large
Load Diff
2
OBJ/ExtDll.iex
Normal file
2
OBJ/ExtDll.iex
Normal file
@ -0,0 +1,2 @@
|
||||
[EXTDLL]
|
||||
Count=0
|
BIN
OBJ/LED.axf
Normal file
BIN
OBJ/LED.axf
Normal file
Binary file not shown.
120
OBJ/LED.build_log.htm
Normal file
120
OBJ/LED.build_log.htm
Normal file
@ -0,0 +1,120 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>礦ision Build Log</h1>
|
||||
<h2>Tool Versions:</h2>
|
||||
IDE-Version: μVision V5.25.2.0
|
||||
Copyright (C) 2018 ARM Ltd and ARM Germany GmbH. All rights reserved.
|
||||
License Information: 1 1, 1, LIC=IK1BF-6MHY4-SBQEJ-UTZMV-J6CJE-FWQHP
|
||||
|
||||
Tool Versions:
|
||||
Toolchain: MDK-ARM Plus Version: 5.25.2.0
|
||||
Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin
|
||||
C Compiler: Armcc.exe V5.06 update 6 (build 750)
|
||||
Assembler: Armasm.exe V5.06 update 6 (build 750)
|
||||
Linker/Locator: ArmLink.exe V5.06 update 6 (build 750)
|
||||
Library Manager: ArmAr.exe V5.06 update 6 (build 750)
|
||||
Hex Converter: FromElf.exe V5.06 update 6 (build 750)
|
||||
CPU DLL: SARMCM3.DLL V5.25.2.0
|
||||
Dialog DLL: DCM.DLL V1.17.1.0
|
||||
Target DLL: Segger\JL2CM3.dll V2.99.29.0
|
||||
Dialog DLL: TCM.DLL V1.35.1.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\USER\LED.uvprojx
|
||||
Project File Date: 10/17/2024
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
|
||||
Rebuild target 'Target 1'
|
||||
compiling bsp_i2c_gpio.c...
|
||||
compiling stm32f10x_it.c...
|
||||
compiling 4G_EC200_Handle.c...
|
||||
compiling ads1015.c...
|
||||
compiling chipid.c...
|
||||
compiling system_stm32f10x.c...
|
||||
compiling bsp_cpu_flash.c...
|
||||
compiling 24cxx.c...
|
||||
compiling adc.c...
|
||||
compiling dc300.c...
|
||||
compiling main.c...
|
||||
compiling spi.c...
|
||||
compiling common.c...
|
||||
compiling led.c...
|
||||
compiling timer.c...
|
||||
compiling delay.c...
|
||||
compiling uart_uart.c...
|
||||
compiling porting.c...
|
||||
compiling CanBusDrv.c...
|
||||
compiling app_pwr_manage.c...
|
||||
compiling CanDrvCtrl.c...
|
||||
compiling can_app.c...
|
||||
compiling bsp_can.c...
|
||||
compiling sys.c...
|
||||
compiling can.c...
|
||||
assembling startup_stm32f10x_cl.s...
|
||||
compiling usart.c...
|
||||
compiling switch.c...
|
||||
compiling core_cm3.c...
|
||||
compiling stm32f10x_usart.c...
|
||||
compiling stm32f10x_gpio.c...
|
||||
compiling misc.c...
|
||||
compiling stm32f10x_adc.c...
|
||||
compiling stm32f10x_can.c...
|
||||
compiling stm32f10x_rcc.c...
|
||||
compiling stm32f10x_tim.c...
|
||||
compiling stm32f10x_dma.c...
|
||||
compiling stm32f10x_flash.c...
|
||||
compiling stm32f10x_iwdg.c...
|
||||
compiling stm32f10x_spi.c...
|
||||
compiling stm32f10x_bkp.c...
|
||||
compiling stm32f10x_pwr.c...
|
||||
compiling stm32f10x_rtc.c...
|
||||
compiling stm32f10x_exti.c...
|
||||
compiling crc.c...
|
||||
compiling bootloader.c...
|
||||
compiling diagnosis_mid.c...
|
||||
compiling tp_cca.c...
|
||||
compiling uds_api.c...
|
||||
compiling uds_can_interface.c...
|
||||
compiling uds_interface.c...
|
||||
compiling uds_did.c...
|
||||
compiling uds_manage.c...
|
||||
compiling uds_nvm.c...
|
||||
compiling uds_services.c...
|
||||
linking...
|
||||
Program Size: Code=78848 RO-data=5952 RW-data=3304 ZI-data=26576
|
||||
FromELF: creating hex file...
|
||||
After Build - User command #1: ..\OBJ\merge.cmd
|
||||
C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\USER>set "cmdDir=C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\OBJ\"
|
||||
C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\USER>copy C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\OBJ\boot.hex C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\OBJ\DCBms.hex
|
||||
已复制 1 个文件。
|
||||
C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\USER>type C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\OBJ\LED.hex 1>>C:\Users\ddouv\Desktop\产品\1.5代\DCBMSWulingH15S95UdsVersion\OBJ\DCBms.hex
|
||||
After Build - User command #2: fromelf --bin --output ..\OBJ\App.bin ..\OBJ\LED.axf
|
||||
"..\OBJ\LED.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
Package Vendor: ARM
|
||||
http://www.keil.com/pack/ARM.CMSIS.5.3.0.pack
|
||||
ARM.CMSIS.5.3.0
|
||||
CMSIS (Cortex Microcontroller Software Interface Standard)
|
||||
* Component: CORE Version: 5.1.1
|
||||
|
||||
Package Vendor: Keil
|
||||
http://www.keil.com/pack/Keil.STM32F1xx_DFP.2.3.0.pack
|
||||
Keil.STM32F1xx_DFP.2.3.0
|
||||
STMicroelectronics STM32F1 Series Device Support, Drivers and Examples
|
||||
|
||||
<h2>Collection of Component include folders:</h2>
|
||||
.\RTE\_Target_1
|
||||
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.3.0\CMSIS\Include
|
||||
C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include
|
||||
|
||||
<h2>Collection of Component Files used:</h2>
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.1.1
|
||||
Build Time Elapsed: 00:00:15
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
5413
OBJ/LED.hex
Normal file
5413
OBJ/LED.hex
Normal file
File diff suppressed because it is too large
Load Diff
5696
OBJ/LED.htm
Normal file
5696
OBJ/LED.htm
Normal file
File diff suppressed because it is too large
Load Diff
60
OBJ/LED.lnp
Normal file
60
OBJ/LED.lnp
Normal file
@ -0,0 +1,60 @@
|
||||
--cpu Cortex-M3
|
||||
"..\obj\main.o"
|
||||
"..\obj\stm32f10x_it.o"
|
||||
"..\obj\system_stm32f10x.o"
|
||||
"..\obj\ads1015.o"
|
||||
"..\obj\adc.o"
|
||||
"..\obj\4g_ec200_handle.o"
|
||||
"..\obj\dc300.o"
|
||||
"..\obj\bsp_cpu_flash.o"
|
||||
"..\obj\bsp_i2c_gpio.o"
|
||||
"..\obj\chipid.o"
|
||||
"..\obj\24cxx.o"
|
||||
"..\obj\spi.o"
|
||||
"..\obj\common.o"
|
||||
"..\obj\led.o"
|
||||
"..\obj\timer.o"
|
||||
"..\obj\can.o"
|
||||
"..\obj\app_pwr_manage.o"
|
||||
"..\obj\bsp_can.o"
|
||||
"..\obj\canbusdrv.o"
|
||||
"..\obj\porting.o"
|
||||
"..\obj\candrvctrl.o"
|
||||
"..\obj\can_app.o"
|
||||
"..\obj\uart_uart.o"
|
||||
"..\obj\delay.o"
|
||||
"..\obj\sys.o"
|
||||
"..\obj\usart.o"
|
||||
"..\obj\switch.o"
|
||||
"..\obj\core_cm3.o"
|
||||
"..\obj\startup_stm32f10x_cl.o"
|
||||
"..\obj\misc.o"
|
||||
"..\obj\stm32f10x_gpio.o"
|
||||
"..\obj\stm32f10x_rcc.o"
|
||||
"..\obj\stm32f10x_usart.o"
|
||||
"..\obj\stm32f10x_tim.o"
|
||||
"..\obj\stm32f10x_can.o"
|
||||
"..\obj\stm32f10x_adc.o"
|
||||
"..\obj\stm32f10x_dma.o"
|
||||
"..\obj\stm32f10x_flash.o"
|
||||
"..\obj\stm32f10x_iwdg.o"
|
||||
"..\obj\stm32f10x_spi.o"
|
||||
"..\obj\stm32f10x_bkp.o"
|
||||
"..\obj\stm32f10x_pwr.o"
|
||||
"..\obj\stm32f10x_rtc.o"
|
||||
"..\obj\stm32f10x_exti.o"
|
||||
"..\obj\bootloader.o"
|
||||
"..\obj\crc.o"
|
||||
"..\obj\diagnosis_mid.o"
|
||||
"..\obj\tp_cca.o"
|
||||
"..\obj\uds_api.o"
|
||||
"..\obj\uds_can_interface.o"
|
||||
"..\obj\uds_did.o"
|
||||
"..\obj\uds_interface.o"
|
||||
"..\obj\uds_manage.o"
|
||||
"..\obj\uds_nvm.o"
|
||||
"..\obj\uds_services.o"
|
||||
--library_type=microlib --strict --scatter "..\OBJ\LED.sct"
|
||||
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
|
||||
--info sizes --info totals --info unused --info veneers
|
||||
--list ".\LED.map" -o ..\OBJ\LED.axf
|
BIN
OBJ/LED.sct
Normal file
BIN
OBJ/LED.sct
Normal file
Binary file not shown.
1192
OBJ/LED_Target 1.dep
Normal file
1192
OBJ/LED_Target 1.dep
Normal file
File diff suppressed because it is too large
Load Diff
BIN
OBJ/adc.crf
Normal file
BIN
OBJ/adc.crf
Normal file
Binary file not shown.
21
OBJ/adc.d
Normal file
21
OBJ/adc.d
Normal file
@ -0,0 +1,21 @@
|
||||
..\obj\adc.o: ..\SYSTEM\adc.c
|
||||
..\obj\adc.o: ..\SYSTEM\adc.h
|
||||
..\obj\adc.o: ..\USER\stm32f10x.h
|
||||
..\obj\adc.o: ..\CORE\core_cm3.h
|
||||
..\obj\adc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\adc.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\adc.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\adc.o: ..\USER\stm32f10x.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_adc.h
|
||||
..\obj\adc.o: ..\STM32F10x_FWLib\inc\stm32f10x_dma.h
|
||||
..\obj\adc.o: ..\HARDWARE\CAN\can.h
|
||||
..\obj\adc.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\adc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
BIN
OBJ/ads1015.crf
Normal file
BIN
OBJ/ads1015.crf
Normal file
Binary file not shown.
18
OBJ/ads1015.d
Normal file
18
OBJ/ads1015.d
Normal file
@ -0,0 +1,18 @@
|
||||
..\obj\ads1015.o: ..\SYSTEM\ads1015.c
|
||||
..\obj\ads1015.o: ..\SYSTEM\ads1015.h
|
||||
..\obj\ads1015.o: ..\USER\stm32f10x.h
|
||||
..\obj\ads1015.o: ..\CORE\core_cm3.h
|
||||
..\obj\ads1015.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\ads1015.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\ads1015.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\ads1015.o: ..\USER\stm32f10x.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\ads1015.o: ..\STM32F10x_FWLib\inc\stm32f10x_i2c.h
|
||||
..\obj\ads1015.o: ..\SYSTEM\sys\sys.h
|
BIN
OBJ/ads1015.o
Normal file
BIN
OBJ/ads1015.o
Normal file
Binary file not shown.
BIN
OBJ/app_pwr_manage.crf
Normal file
BIN
OBJ/app_pwr_manage.crf
Normal file
Binary file not shown.
39
OBJ/app_pwr_manage.d
Normal file
39
OBJ/app_pwr_manage.d
Normal file
@ -0,0 +1,39 @@
|
||||
..\obj\app_pwr_manage.o: ..\HARDWARE\LOWPOWER\app_pwr_manage.c
|
||||
..\obj\app_pwr_manage.o: ..\HARDWARE\LED\led.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\app_pwr_manage.o: ..\USER\stm32f10x.h
|
||||
..\obj\app_pwr_manage.o: ..\CORE\core_cm3.h
|
||||
..\obj\app_pwr_manage.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\app_pwr_manage.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\app_pwr_manage.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\app_pwr_manage.o: ..\USER\stm32f10x.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\chipid.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\delay\delay.h
|
||||
..\obj\app_pwr_manage.o: ..\HARDWARE\TIMER\timer.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\usart\usart.h
|
||||
..\obj\app_pwr_manage.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\app_pwr_manage.o: ..\HARDWARE\CAN\can.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\adc.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\ADS1015.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\dc300.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\24cxx.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\sd.h
|
||||
..\obj\app_pwr_manage.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\common.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\fileSys.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\FATFS\src\ff.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\FATFS\src\integer.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\FATFS\src\ffconf.h
|
||||
..\obj\app_pwr_manage.o: ..\SYSTEM\FATFS\src\diskio.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_exti.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_pwr.h
|
||||
..\obj\app_pwr_manage.o: ..\STM32F10x_FWLib\inc\stm32f10x_rtc.h
|
||||
..\obj\app_pwr_manage.o: ..\HARDWARE\LOWPOWER\app_pwr_manage.h
|
BIN
OBJ/app_pwr_manage.o
Normal file
BIN
OBJ/app_pwr_manage.o
Normal file
Binary file not shown.
1482
OBJ/boot.hex
Normal file
1482
OBJ/boot.hex
Normal file
File diff suppressed because it is too large
Load Diff
BIN
OBJ/bootloader.crf
Normal file
BIN
OBJ/bootloader.crf
Normal file
Binary file not shown.
39
OBJ/bootloader.d
Normal file
39
OBJ/bootloader.d
Normal file
@ -0,0 +1,39 @@
|
||||
..\obj\bootloader.o: ..\UDS\bootloader.c
|
||||
..\obj\bootloader.o: ..\UDS\bootloader.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_config.h
|
||||
..\obj\bootloader.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\bootloader.o: ..\USER\stm32f10x.h
|
||||
..\obj\bootloader.o: ..\CORE\core_cm3.h
|
||||
..\obj\bootloader.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\bootloader.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\bootloader.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\bootloader.o: ..\USER\stm32f10x.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\bootloader.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\bootloader.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h
|
||||
..\obj\bootloader.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
..\obj\bootloader.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\bootloader.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h
|
||||
..\obj\bootloader.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_types.h
|
||||
..\obj\bootloader.o: ..\UDS\bootloader.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_did.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_config.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_dtc.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_can_interface.h
|
||||
..\obj\bootloader.o: ..\UDS\diagnosis_mid.h
|
||||
..\obj\bootloader.o: ..\UDS\tp_15765_2.h
|
||||
..\obj\bootloader.o: ..\UDS\tp_config.h
|
||||
..\obj\bootloader.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h
|
||||
..\obj\bootloader.o: ..\UDS\tp_config.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_interface.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_manage.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_services.h
|
||||
..\obj\bootloader.o: ..\UDS\uds_api.h
|
||||
..\obj\bootloader.o: ..\UDS\crc.h
|
BIN
OBJ/bootloader.o
Normal file
BIN
OBJ/bootloader.o
Normal file
Binary file not shown.
BIN
OBJ/bsp_can.crf
Normal file
BIN
OBJ/bsp_can.crf
Normal file
Binary file not shown.
42
OBJ/bsp_can.d
Normal file
42
OBJ/bsp_can.d
Normal file
@ -0,0 +1,42 @@
|
||||
..\obj\bsp_can.o: ..\HARDWARE\CAN\bsp_can.c
|
||||
..\obj\bsp_can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\bsp_can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
..\obj\bsp_can.o: ..\HARDWARE\CAN\can.h
|
||||
..\obj\bsp_can.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\bsp_can.o: ..\USER\stm32f10x.h
|
||||
..\obj\bsp_can.o: ..\CORE\core_cm3.h
|
||||
..\obj\bsp_can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\bsp_can.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\bsp_can.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\bsp_can.o: ..\USER\stm32f10x.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\bsp_can.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\bsp_can.o: ..\HARDWARE\CAN\bsp_can.h
|
||||
..\obj\bsp_can.o: ..\HARDWARE\CAN\canbusdrv.h
|
||||
..\obj\bsp_can.o: ..\HARDWARE\CAN\porting.h
|
||||
..\obj\bsp_can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h
|
||||
..\obj\bsp_can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_config.h
|
||||
..\obj\bsp_can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h
|
||||
..\obj\bsp_can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_types.h
|
||||
..\obj\bsp_can.o: ..\UDS\bootloader.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_config.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_did.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_dtc.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_can_interface.h
|
||||
..\obj\bsp_can.o: ..\UDS\diagnosis_mid.h
|
||||
..\obj\bsp_can.o: ..\UDS\tp_15765_2.h
|
||||
..\obj\bsp_can.o: ..\UDS\tp_config.h
|
||||
..\obj\bsp_can.o: ..\UDS\tp_config.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_interface.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_manage.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_services.h
|
||||
..\obj\bsp_can.o: ..\UDS\uds_api.h
|
||||
..\obj\bsp_can.o: ..\UDS\crc.h
|
BIN
OBJ/bsp_can.o
Normal file
BIN
OBJ/bsp_can.o
Normal file
Binary file not shown.
BIN
OBJ/bsp_cpu_flash.crf
Normal file
BIN
OBJ/bsp_cpu_flash.crf
Normal file
Binary file not shown.
18
OBJ/bsp_cpu_flash.d
Normal file
18
OBJ/bsp_cpu_flash.d
Normal file
@ -0,0 +1,18 @@
|
||||
..\obj\bsp_cpu_flash.o: ..\SYSTEM\bsp_cpu_flash.c
|
||||
..\obj\bsp_cpu_flash.o: ..\SYSTEM\sys\Sys.h
|
||||
..\obj\bsp_cpu_flash.o: ..\USER\stm32f10x.h
|
||||
..\obj\bsp_cpu_flash.o: ..\CORE\core_cm3.h
|
||||
..\obj\bsp_cpu_flash.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\bsp_cpu_flash.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\bsp_cpu_flash.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\bsp_cpu_flash.o: ..\USER\stm32f10x.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\bsp_cpu_flash.o: ..\STM32F10x_FWLib\inc\stm32f10x_flash.h
|
||||
..\obj\bsp_cpu_flash.o: ..\SYSTEM\bsp_cpu_flash.h
|
BIN
OBJ/bsp_cpu_flash.o
Normal file
BIN
OBJ/bsp_cpu_flash.o
Normal file
Binary file not shown.
BIN
OBJ/bsp_i2c_gpio.crf
Normal file
BIN
OBJ/bsp_i2c_gpio.crf
Normal file
Binary file not shown.
16
OBJ/bsp_i2c_gpio.d
Normal file
16
OBJ/bsp_i2c_gpio.d
Normal file
@ -0,0 +1,16 @@
|
||||
..\obj\bsp_i2c_gpio.o: ..\SYSTEM\bsp_i2c_gpio.c
|
||||
..\obj\bsp_i2c_gpio.o: ..\USER\stm32f10x.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\CORE\core_cm3.h
|
||||
..\obj\bsp_i2c_gpio.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\USER\stm32f10x.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\bsp_i2c_gpio.o: ..\SYSTEM\bsp_i2c_gpio.h
|
BIN
OBJ/bsp_i2c_gpio.o
Normal file
BIN
OBJ/bsp_i2c_gpio.o
Normal file
Binary file not shown.
BIN
OBJ/can.crf
Normal file
BIN
OBJ/can.crf
Normal file
Binary file not shown.
25
OBJ/can.d
Normal file
25
OBJ/can.d
Normal file
@ -0,0 +1,25 @@
|
||||
..\obj\can.o: ..\HARDWARE\CAN\can.c
|
||||
..\obj\can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
..\obj\can.o: ..\HARDWARE\CAN\can.h
|
||||
..\obj\can.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\can.o: ..\USER\stm32f10x.h
|
||||
..\obj\can.o: ..\CORE\core_cm3.h
|
||||
..\obj\can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\can.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\can.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\can.o: ..\USER\stm32f10x.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\can.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\can.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\can.o: ..\SYSTEM\usart\usart.h
|
||||
..\obj\can.o: ..\HARDWARE\LED\led.h
|
||||
..\obj\can.o: ..\SYSTEM\delay\delay.h
|
||||
..\obj\can.o: ..\SYSTEM\adc.h
|
||||
..\obj\can.o: ..\HARDWARE\LOWPOWER\app_pwr_manage.h
|
||||
..\obj\can.o: ..\SYSTEM\dc300.h
|
BIN
OBJ/can_app.crf
Normal file
BIN
OBJ/can_app.crf
Normal file
Binary file not shown.
25
OBJ/can_app.d
Normal file
25
OBJ/can_app.d
Normal file
@ -0,0 +1,25 @@
|
||||
..\obj\can_app.o: ..\HARDWARE\CAN\can_app.c
|
||||
..\obj\can_app.o: ..\SYSTEM\sys\Sys.h
|
||||
..\obj\can_app.o: ..\USER\stm32f10x.h
|
||||
..\obj\can_app.o: ..\CORE\core_cm3.h
|
||||
..\obj\can_app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\can_app.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\can_app.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\can_app.o: ..\USER\stm32f10x.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\can_app.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\can_app.o: ..\SYSTEM\adc.h
|
||||
..\obj\can_app.o: ..\HARDWARE\CAN\can.h
|
||||
..\obj\can_app.o: ..\HARDWARE\CAN\CanBusDrv.h
|
||||
..\obj\can_app.o: ..\HARDWARE\CAN\porting.h
|
||||
..\obj\can_app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h
|
||||
..\obj\can_app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
..\obj\can_app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
..\obj\can_app.o: ..\HARDWARE\CAN\candrvctrl.h
|
||||
..\obj\can_app.o: ..\HARDWARE\LED\led.h
|
BIN
OBJ/can_app.o
Normal file
BIN
OBJ/can_app.o
Normal file
Binary file not shown.
BIN
OBJ/canbusdrv.crf
Normal file
BIN
OBJ/canbusdrv.crf
Normal file
Binary file not shown.
23
OBJ/canbusdrv.d
Normal file
23
OBJ/canbusdrv.d
Normal file
@ -0,0 +1,23 @@
|
||||
..\obj\canbusdrv.o: ..\HARDWARE\CAN\CanBusDrv.c
|
||||
..\obj\canbusdrv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\canbusdrv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
..\obj\canbusdrv.o: ..\HARDWARE\CAN\canbusdrv.h
|
||||
..\obj\canbusdrv.o: ..\HARDWARE\CAN\porting.h
|
||||
..\obj\canbusdrv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h
|
||||
..\obj\canbusdrv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\canbusdrv.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\canbusdrv.o: ..\USER\stm32f10x.h
|
||||
..\obj\canbusdrv.o: ..\CORE\core_cm3.h
|
||||
..\obj\canbusdrv.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\canbusdrv.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\canbusdrv.o: ..\USER\stm32f10x.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\canbusdrv.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\canbusdrv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
..\obj\canbusdrv.o: ..\HARDWARE\CAN\candrvctrl.h
|
BIN
OBJ/canbusdrv.o
Normal file
BIN
OBJ/canbusdrv.o
Normal file
Binary file not shown.
BIN
OBJ/candrvctrl.crf
Normal file
BIN
OBJ/candrvctrl.crf
Normal file
Binary file not shown.
20
OBJ/candrvctrl.d
Normal file
20
OBJ/candrvctrl.d
Normal file
@ -0,0 +1,20 @@
|
||||
..\obj\candrvctrl.o: ..\HARDWARE\CAN\CanDrvCtrl.c
|
||||
..\obj\candrvctrl.o: ..\HARDWARE\CAN\porting.h
|
||||
..\obj\candrvctrl.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h
|
||||
..\obj\candrvctrl.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\candrvctrl.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
..\obj\candrvctrl.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\candrvctrl.o: ..\USER\stm32f10x.h
|
||||
..\obj\candrvctrl.o: ..\CORE\core_cm3.h
|
||||
..\obj\candrvctrl.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\candrvctrl.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\candrvctrl.o: ..\USER\stm32f10x.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\candrvctrl.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\candrvctrl.o: ..\HARDWARE\CAN\candrvctrl.h
|
BIN
OBJ/candrvctrl.o
Normal file
BIN
OBJ/candrvctrl.o
Normal file
Binary file not shown.
BIN
OBJ/chipid.crf
Normal file
BIN
OBJ/chipid.crf
Normal file
Binary file not shown.
18
OBJ/chipid.d
Normal file
18
OBJ/chipid.d
Normal file
@ -0,0 +1,18 @@
|
||||
..\obj\chipid.o: ..\SYSTEM\chipid.c
|
||||
..\obj\chipid.o: ..\SYSTEM\chipid.h
|
||||
..\obj\chipid.o: ..\USER\stm32f10x.h
|
||||
..\obj\chipid.o: ..\CORE\core_cm3.h
|
||||
..\obj\chipid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\chipid.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\chipid.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\chipid.o: ..\USER\stm32f10x.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\chipid.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\chipid.o: ..\HARDWARE\LED\led.h
|
||||
..\obj\chipid.o: ..\SYSTEM\sys\sys.h
|
BIN
OBJ/chipid.o
Normal file
BIN
OBJ/chipid.o
Normal file
Binary file not shown.
BIN
OBJ/common.crf
Normal file
BIN
OBJ/common.crf
Normal file
Binary file not shown.
24
OBJ/common.d
Normal file
24
OBJ/common.d
Normal file
@ -0,0 +1,24 @@
|
||||
..\obj\common.o: ..\SYSTEM\common.c
|
||||
..\obj\common.o: ..\SYSTEM\common.h
|
||||
..\obj\common.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\common.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
..\obj\common.o: ..\USER\stm32f10x.h
|
||||
..\obj\common.o: ..\CORE\core_cm3.h
|
||||
..\obj\common.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\common.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\common.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\common.o: ..\USER\stm32f10x.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\common.o: ..\SYSTEM\fileSys.h
|
||||
..\obj\common.o: ..\SYSTEM\FATFS\src\ff.h
|
||||
..\obj\common.o: ..\SYSTEM\FATFS\src\integer.h
|
||||
..\obj\common.o: ..\SYSTEM\FATFS\src\ffconf.h
|
||||
..\obj\common.o: ..\SYSTEM\FATFS\src\diskio.h
|
||||
..\obj\common.o: ..\STM32F10x_FWLib\inc\stm32f10x_flash.h
|
BIN
OBJ/common.o
Normal file
BIN
OBJ/common.o
Normal file
Binary file not shown.
BIN
OBJ/core_cm3.crf
Normal file
BIN
OBJ/core_cm3.crf
Normal file
Binary file not shown.
2
OBJ/core_cm3.d
Normal file
2
OBJ/core_cm3.d
Normal file
@ -0,0 +1,2 @@
|
||||
..\obj\core_cm3.o: ..\CORE\core_cm3.c
|
||||
..\obj\core_cm3.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
BIN
OBJ/core_cm3.o
Normal file
BIN
OBJ/core_cm3.o
Normal file
Binary file not shown.
BIN
OBJ/crc.crf
Normal file
BIN
OBJ/crc.crf
Normal file
Binary file not shown.
17
OBJ/crc.d
Normal file
17
OBJ/crc.d
Normal file
@ -0,0 +1,17 @@
|
||||
..\obj\crc.o: ..\UDS\crc.c
|
||||
..\obj\crc.o: ..\UDS\crc.h
|
||||
..\obj\crc.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\crc.o: ..\USER\stm32f10x.h
|
||||
..\obj\crc.o: ..\CORE\core_cm3.h
|
||||
..\obj\crc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\crc.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\crc.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\crc.o: ..\USER\stm32f10x.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\crc.o: ..\STM32F10x_FWLib\inc\misc.h
|
BIN
OBJ/dc300.crf
Normal file
BIN
OBJ/dc300.crf
Normal file
Binary file not shown.
22
OBJ/dc300.d
Normal file
22
OBJ/dc300.d
Normal file
@ -0,0 +1,22 @@
|
||||
..\obj\dc300.o: ..\SYSTEM\dc300.c
|
||||
..\obj\dc300.o: ..\SYSTEM\dc300.h
|
||||
..\obj\dc300.o: ..\USER\stm32f10x.h
|
||||
..\obj\dc300.o: ..\CORE\core_cm3.h
|
||||
..\obj\dc300.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\dc300.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\dc300.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\dc300.o: ..\USER\stm32f10x.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\dc300.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\dc300.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\dc300.o: ..\HARDWARE\CAN\can.h
|
||||
..\obj\dc300.o: ..\SYSTEM\adc.h
|
||||
..\obj\dc300.o: ..\HARDWARE\LED\led.h
|
||||
..\obj\dc300.o: ..\SYSTEM\usart\usart.h
|
||||
..\obj\dc300.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
BIN
OBJ/dc300.o
Normal file
BIN
OBJ/dc300.o
Normal file
Binary file not shown.
BIN
OBJ/delay.crf
Normal file
BIN
OBJ/delay.crf
Normal file
Binary file not shown.
17
OBJ/delay.d
Normal file
17
OBJ/delay.d
Normal file
@ -0,0 +1,17 @@
|
||||
..\obj\delay.o: ..\SYSTEM\delay\delay.c
|
||||
..\obj\delay.o: ..\SYSTEM\delay\delay.h
|
||||
..\obj\delay.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\delay.o: ..\USER\stm32f10x.h
|
||||
..\obj\delay.o: ..\CORE\core_cm3.h
|
||||
..\obj\delay.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\delay.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\delay.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\delay.o: ..\USER\stm32f10x.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\delay.o: ..\STM32F10x_FWLib\inc\misc.h
|
BIN
OBJ/delay.o
Normal file
BIN
OBJ/delay.o
Normal file
Binary file not shown.
BIN
OBJ/diagnosis_mid.crf
Normal file
BIN
OBJ/diagnosis_mid.crf
Normal file
Binary file not shown.
40
OBJ/diagnosis_mid.d
Normal file
40
OBJ/diagnosis_mid.d
Normal file
@ -0,0 +1,40 @@
|
||||
..\obj\diagnosis_mid.o: ..\UDS\diagnosis_mid.c
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_config.h
|
||||
..\obj\diagnosis_mid.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\diagnosis_mid.o: ..\USER\stm32f10x.h
|
||||
..\obj\diagnosis_mid.o: ..\CORE\core_cm3.h
|
||||
..\obj\diagnosis_mid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\diagnosis_mid.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\diagnosis_mid.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\diagnosis_mid.o: ..\USER\stm32f10x.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\diagnosis_mid.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\diagnosis_mid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h
|
||||
..\obj\diagnosis_mid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h
|
||||
..\obj\diagnosis_mid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\diagnosis_mid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h
|
||||
..\obj\diagnosis_mid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_types.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\bootloader.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_config.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_did.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_dtc.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_can_interface.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\diagnosis_mid.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\tp_15765_2.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\tp_config.h
|
||||
..\obj\diagnosis_mid.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\tp_config.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_interface.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_manage.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_services.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_api.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\crc.h
|
||||
..\obj\diagnosis_mid.o: ..\UDS\uds_nvm.h
|
||||
..\obj\diagnosis_mid.o: ..\HARDWARE\CAN\BSP_CAN.h
|
BIN
OBJ/diagnosis_mid.o
Normal file
BIN
OBJ/diagnosis_mid.o
Normal file
Binary file not shown.
BIN
OBJ/led.crf
Normal file
BIN
OBJ/led.crf
Normal file
Binary file not shown.
21
OBJ/led.d
Normal file
21
OBJ/led.d
Normal file
@ -0,0 +1,21 @@
|
||||
..\obj\led.o: ..\HARDWARE\LED\led.c
|
||||
..\obj\led.o: ..\HARDWARE\LED\led.h
|
||||
..\obj\led.o: ..\SYSTEM\sys\sys.h
|
||||
..\obj\led.o: ..\USER\stm32f10x.h
|
||||
..\obj\led.o: ..\CORE\core_cm3.h
|
||||
..\obj\led.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
|
||||
..\obj\led.o: ..\USER\system_stm32f10x.h
|
||||
..\obj\led.o: ..\USER\stm32f10x_conf.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
|
||||
..\obj\led.o: ..\USER\stm32f10x.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\misc.h
|
||||
..\obj\led.o: ..\STM32F10x_FWLib\inc\stm32f10x_iwdg.h
|
||||
..\obj\led.o: ..\SYSTEM\sd.h
|
||||
..\obj\led.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
|
||||
..\obj\led.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user