Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
VC66_7C
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISUZU
VC66_7C
Commits
6a901326
Commit
6a901326
authored
Oct 17, 2023
by
hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整横展项
parent
c477b0fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
194 additions
and
99 deletions
+194
-99
Data_VehicleSpeed.c
source/Application/APP/Data_VehicleSpeed/Data_VehicleSpeed.c
+1
-1
Rscan.c
source/Driver/CAN/Rscan.c
+190
-95
Clock.c
source/Driver/Clock/Clock.c
+3
-3
No files found.
source/Application/APP/Data_VehicleSpeed/Data_VehicleSpeed.c
View file @
6a901326
...
...
@@ -146,7 +146,7 @@ void Speed_Processing_Service(void)
{
Vehicle_ACT_Speed
=
1400u
;
}
else
if
(
VehValCup
<=
4
0u
)
else
if
(
VehValCup
<=
3
0u
)
{
Vehicle_ACT_Speed
=
0u
;
}
...
...
source/Driver/CAN/Rscan.c
View file @
6a901326
...
...
@@ -15,26 +15,26 @@
#define RSCAN0_BASE_ADDRESS 0xFFD00000UL
/*--------------500K-----------------------------*/
#define RSCAN0_500K_BAUD_RATE 500U //波特率,单位kbps
#define RSCAN0_500K_T_SEG1 12U //时间段1的Tq数
#define RSCAN0_500K_T_SEG2 3U //时间段2的Tq数
#define RSCAN0_500K_SJW 3U //同步跳转宽度
#define RSCAN0_500K_BAUD_RATE 500U //
波特率,单位kbps
#define RSCAN0_500K_T_SEG1 12U //
时间段1的Tq数
#define RSCAN0_500K_T_SEG2 3U //
时间段2的Tq数
#define RSCAN0_500K_SJW 3U //
同步跳转宽度
#define RSCAN_500K_BIT_RATE_DIV (RSCAN_F_CAN / (RSCAN0_500K_BAUD_RATE) / (RSCAN0_500K_T_SEG1 + RSCAN0_500K_T_SEG2 + 1UL) / 1000UL)
/*-----------------250K---------------------------------*/
#define RSCAN0_250K_BAUD_RATE 250U //波特率,单位kbps
#define RSCAN0_250K_T_SEG1 13U //11 //时间段1的Tq数
#define RSCAN0_250K_T_SEG2 2U //4 //时间段2的Tq数
#define RSCAN0_250K_SJW 1U //2 //3
#define RSCAN0_250K_BAUD_RATE 250U //
波特率,单位kbps
#define RSCAN0_250K_T_SEG1 13U //
11 //时间段1的Tq数
#define RSCAN0_250K_T_SEG2 2U //
4 //时间段2的Tq数
#define RSCAN0_250K_SJW 1U //
2 //3
#define RSCAN_250K_BIT_RATE_DIV (RSCAN_F_CAN / (RSCAN0_250K_BAUD_RATE) / (RSCAN0_250K_T_SEG1 + RSCAN0_250K_T_SEG2 + 1UL) / 1000UL)
/*-----------------125K---------------------------------*/
#define RSCAN0_125K_BAUD_RATE 125U //波特率,单位kbps
#define RSCAN0_125K_T_SEG1 13U //11 //时间段1的Tq数
#define RSCAN0_125K_T_SEG2 2U //4 //时间段2的Tq数
#define RSCAN0_125K_SJW 1U //2 //3
#define RSCAN0_125K_BAUD_RATE 125U //
波特率,单位kbps
#define RSCAN0_125K_T_SEG1 13U //
11 //时间段1的Tq数
#define RSCAN0_125K_T_SEG2 2U //
4 //时间段2的Tq数
#define RSCAN0_125K_SJW 1U //
2 //3
#define RSCAN_125K_BIT_RATE_DIV (RSCAN_F_CAN / (RSCAN0_125K_BAUD_RATE) / (RSCAN0_125K_T_SEG1 + RSCAN0_125K_T_SEG2 + 1UL) / 1000UL)
/*------------------------------------------------*/
...
...
@@ -53,7 +53,7 @@
#endif
/*---------------------------------------*/
#define RSCAN_TIME_OUT_MAX 0X0000FFFFUL
/*---------------------------------------*/
/***************************************************/
...
...
@@ -174,6 +174,7 @@ uint8_t RSCAN0_CH_Init(const RSCANFD_Filter_st_t pstRSCANFilter[], RSCAN0_Config
uint32_t
u32CANFDCalBuf
=
0UL
;
uint8_t
u8Status
=
1U
;
uint32_t
u32RSCANChannelRuleTotal
=
0UL
;
uint32_t
u32RSCANTimeCount
=
0UL
;
volatile
RSCANFD_Filter_st_t
*
pstCANFDRule
;
...
...
@@ -211,18 +212,28 @@ uint8_t RSCAN0_CH_Init(const RSCANFD_Filter_st_t pstRSCANFilter[], RSCAN0_Config
if
(
u8Status
==
1U
)
{
/* Waiting for CAN RAM initialization is completed */
while
(
RSCAN0GSTS
&
0x08UL
)
u32RSCANTimeCount
=
0UL
;
while
((
RSCAN0GSTS
&
0x08UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
;
u8Status
=
0U
;
}
/* Waiting for CAN entry global reset mdoe */
RSCAN0GCTR
&=
0xfffffff9UL
;
RSCAN0GCTR
|=
0x01UL
;
while
((
RSCAN0GSTS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0GSTS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
/* Waiting for CAN entry channel reset mdoe */
...
...
@@ -246,23 +257,40 @@ uint8_t RSCAN0_CH_Init(const RSCANFD_Filter_st_t pstRSCANFilter[], RSCAN0_Config
/* waiting */
if
(
pstRSCANConfig
->
stRSCANCh0
.
u32RSCANChEn
)
{
while
((
RSCAN0C0STS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C0STS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
}
if
(
pstRSCANConfig
->
stRSCANCh1
.
u32RSCANChEn
)
{
while
((
RSCAN0C1STS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C1STS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
}
if
(
pstRSCANConfig
->
stRSCANCh2
.
u32RSCANChEn
)
{
while
((
RSCAN0C2STS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C2STS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
}
...
...
@@ -435,9 +463,15 @@ uint8_t RSCAN0_CH_Init(const RSCANFD_Filter_st_t pstRSCANFilter[], RSCAN0_Config
/*Transition to global operating mode*/
RSCAN0GCTR
&=
0xFFFFFFFCUL
;
while
((
RSCAN0GSTS
&
0x07UL
)
!=
0X00UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0GSTS
&
0x07UL
)
!=
0X00UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
/*Transition to channel communication mode*/
...
...
@@ -456,25 +490,45 @@ uint8_t RSCAN0_CH_Init(const RSCANFD_Filter_st_t pstRSCANFilter[], RSCAN0_Config
if
(
pstRSCANConfig
->
stRSCANCh0
.
u32RSCANChEn
)
{
while
((
RSCAN0C0STS
&
0x80UL
)
==
0x0UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C0STS
&
0x80UL
)
==
0x0UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
}
if
(
pstRSCANConfig
->
stRSCANCh1
.
u32RSCANChEn
)
{
while
((
RSCAN0C1STS
&
0x80UL
)
==
0x0UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C1STS
&
0x80UL
)
==
0x0UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
}
if
(
pstRSCANConfig
->
stRSCANCh2
.
u32RSCANChEn
)
{
while
((
RSCAN0C2STS
&
0x80UL
)
==
0x0UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C2STS
&
0x80UL
)
==
0x0UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
u32RSCANTimeCount
++
;
}
if
(
u32RSCANTimeCount
>=
RSCAN_TIME_OUT_MAX
)
{
u8Status
=
0U
;
}
}
/*Enable the applied receive FIFO buffer, transmit/receive
FIFO, transmit queue or transmit history buffer*/
FIFO, transmit queue or transmit history buffer*/
/*transmit/receive FIFO */
if
(
pstRSCANConfig
->
stRSCANCh0
.
u32RSCANChEn
)
...
...
@@ -540,7 +594,7 @@ RSCAN_SetState RSCAN0_CH0_Set_FIFO0_Data(CAN_Frame_st_t *pstCANFrame)
u32RSCANAddress
=
u32RSCANBufIndexK
*
4UL
+
0X178UL
+
RSCAN0_BASE_ADDRESS
;
if
(((
*
((
uint32_t
*
)(
u32RSCANAddress
)))
&
0x00000002UL
)
==
0x0U
)
//if ((RSCAN0CFSTS3 & 0x00000002UL) == 0x0U)
//
if ((RSCAN0CFSTS3 & 0x00000002UL) == 0x0U)
{
u32RSCANDataBuf
=
pstCANFrame
->
u8CANFrameIDE
;
...
...
@@ -549,23 +603,23 @@ RSCAN_SetState RSCAN0_CH0_Set_FIFO0_Data(CAN_Frame_st_t *pstCANFrame)
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE80UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
u32RSCANDataBuf
;
//RCFDC0CFDCFID3 = u32RSCANDataBuf;
//
RCFDC0CFDCFID3 = u32RSCANDataBuf;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANLEN
;
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE84UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
((
u32RSCANDataBuf
)
<<
28U
);
//RCFDC0CFDCFPTR3 = ((u32RSCANDataBuf) << 28U);
//
RCFDC0CFDCFPTR3 = ((u32RSCANDataBuf) << 28U);
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE88UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
pstCANFrame
->
unCANData
.
u32CANData
[
0U
];
//RCFDC0CFDCFDF0_3 = pstCANFrame->unCANData.u32CANData[0U];
//
RCFDC0CFDCFDF0_3 = pstCANFrame->unCANData.u32CANData[0U];
u32RSCANAddress
+=
0X04UL
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
pstCANFrame
->
unCANData
.
u32CANData
[
1U
];
//RCFDC0CFDCFDF1_3 = pstCANFrame->unCANData.u32CANData[1U];
//
RCFDC0CFDCFDF1_3 = pstCANFrame->unCANData.u32CANData[1U];
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x4UL
+
0X1D8UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
0XFFUL
;
//RCFDC0CFDCFPCTR3 = 0XFFUL;
//
RCFDC0CFDCFPCTR3 = 0XFFUL;
enRSCANStatus
=
RSCAN_SET_COMPLETE
;
}
...
...
@@ -595,7 +649,7 @@ RSCAN_SetState RSCAN0_CH1_Set_FIFO0_Data(CAN_Frame_st_t *pstCANFrame)
u32RSCANAddress
=
u32RSCANBufIndexK
*
4UL
+
0X178UL
+
RSCAN0_BASE_ADDRESS
;
if
(((
*
((
uint32_t
*
)(
u32RSCANAddress
)))
&
0x00000002UL
)
==
0x0U
)
//if ((RSCAN0CFSTS3 & 0x00000002UL) == 0x0U)
//
if ((RSCAN0CFSTS3 & 0x00000002UL) == 0x0U)
{
u32RSCANDataBuf
=
pstCANFrame
->
u8CANFrameIDE
;
...
...
@@ -604,23 +658,23 @@ RSCAN_SetState RSCAN0_CH1_Set_FIFO0_Data(CAN_Frame_st_t *pstCANFrame)
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE80UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
u32RSCANDataBuf
;
//RCFDC0CFDCFID3 = u32RSCANDataBuf;
//
RCFDC0CFDCFID3 = u32RSCANDataBuf;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANLEN
;
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE84UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
((
u32RSCANDataBuf
)
<<
28U
);
//RCFDC0CFDCFPTR3 = ((u32RSCANDataBuf) << 28U);
//
RCFDC0CFDCFPTR3 = ((u32RSCANDataBuf) << 28U);
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE88UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
pstCANFrame
->
unCANData
.
u32CANData
[
0U
];
//RCFDC0CFDCFDF0_3 = pstCANFrame->unCANData.u32CANData[0U];
//
RCFDC0CFDCFDF0_3 = pstCANFrame->unCANData.u32CANData[0U];
u32RSCANAddress
+=
0X04UL
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
pstCANFrame
->
unCANData
.
u32CANData
[
1U
];
//RCFDC0CFDCFDF1_3 = pstCANFrame->unCANData.u32CANData[1U];
//
RCFDC0CFDCFDF1_3 = pstCANFrame->unCANData.u32CANData[1U];
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x4UL
+
0X1D8UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
0XFFUL
;
//RCFDC0CFDCFPCTR3 = 0XFFUL;
//
RCFDC0CFDCFPCTR3 = 0XFFUL;
enRSCANStatus
=
RSCAN_SET_COMPLETE
;
}
...
...
@@ -649,7 +703,7 @@ RSCAN_SetState RSCAN0_CH2_Set_FIFO0_Data(CAN_Frame_st_t *pstCANFrame)
u32RSCANAddress
=
u32RSCANBufIndexK
*
4UL
+
0X178UL
+
RSCAN0_BASE_ADDRESS
;
if
(((
*
((
uint32_t
*
)(
u32RSCANAddress
)))
&
0x00000002UL
)
==
0x0U
)
//if ((RSCAN0CFSTS3 & 0x00000002UL) == 0x0U)
//
if ((RSCAN0CFSTS3 & 0x00000002UL) == 0x0U)
{
u32RSCANDataBuf
=
pstCANFrame
->
u8CANFrameIDE
;
...
...
@@ -658,23 +712,23 @@ RSCAN_SetState RSCAN0_CH2_Set_FIFO0_Data(CAN_Frame_st_t *pstCANFrame)
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE80UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
u32RSCANDataBuf
;
//RCFDC0CFDCFID3 = u32RSCANDataBuf;
//
RCFDC0CFDCFID3 = u32RSCANDataBuf;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANLEN
;
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE84UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
((
u32RSCANDataBuf
)
<<
28U
);
//RCFDC0CFDCFPTR3 = ((u32RSCANDataBuf) << 28U);
//
RCFDC0CFDCFPTR3 = ((u32RSCANDataBuf) << 28U);
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x10UL
+
0XE88UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
pstCANFrame
->
unCANData
.
u32CANData
[
0U
];
//RCFDC0CFDCFDF0_3 = pstCANFrame->unCANData.u32CANData[0U];
//
RCFDC0CFDCFDF0_3 = pstCANFrame->unCANData.u32CANData[0U];
u32RSCANAddress
+=
0X04UL
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
pstCANFrame
->
unCANData
.
u32CANData
[
1U
];
//RCFDC0CFDCFDF1_3 = pstCANFrame->unCANData.u32CANData[1U];
//
RCFDC0CFDCFDF1_3 = pstCANFrame->unCANData.u32CANData[1U];
u32RSCANAddress
=
u32RSCANBufIndexK
*
0x4UL
+
0X1D8UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)(
u32RSCANAddress
)))
=
0XFFUL
;
//RCFDC0CFDCFPCTR3 = 0XFFUL;
//
RCFDC0CFDCFPCTR3 = 0XFFUL;
enRSCANStatus
=
RSCAN_SET_COMPLETE
;
}
...
...
@@ -705,33 +759,33 @@ RSCAN_SetState RSCAN0_CH0_Set_TXBUF_Data(RSCAN_Channel_Buf_en_t enBufIndex, CAN_
{
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X2D0UL
+
RSCAN0_BASE_ADDRESS
;
if
(((
*
((
uint8_t
*
)
u32RSCANAddress
))
&
0x08U
)
==
0x0U
)
//if ((RSCAN0TMSTS0 & 0x08U) == 0x0U)
//
if ((RSCAN0TMSTS0 & 0x08U) == 0x0U)
{
(
*
((
uint8_t
*
)
u32RSCANAddress
))
=
0UL
;
//RSCAN0TMSTS0 = 0UL;
//
RSCAN0TMSTS0 = 0UL;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANFrameIDE
;
u32RSCANDataBuf
=
u32RSCANDataBuf
<<
31U
;
u32RSCANDataBuf
|=
pstCANFrame
->
u32CANID
;
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1000UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
u32RSCANDataBuf
;
//RCFDC0CFDTMID0 = u32RSCANDataBuf;
//
RCFDC0CFDTMID0 = u32RSCANDataBuf;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANLEN
;
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1004UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
(
uint32_t
)((
u32RSCANDataBuf
)
<<
28U
);
//RCFDC0CFDTMPTR0 = (uint32_t)((u32RSCANDataBuf) << 28U);
//
RCFDC0CFDTMPTR0 = (uint32_t)((u32RSCANDataBuf) << 28U);
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1008UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
pstCANFrame
->
unCANData
.
u32CANData
[
0U
];
//RCFDC0CFDTMDF0_0 = pstCANFrame->unCANData.u32CANData[0U];
//
RCFDC0CFDTMDF0_0 = pstCANFrame->unCANData.u32CANData[0U];
u32RSCANAddress
+=
0X04UL
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
pstCANFrame
->
unCANData
.
u32CANData
[
1U
];
//RCFDC0CFDTMDF1_0 = pstCANFrame->unCANData.u32CANData[1U];
//
RCFDC0CFDTMDF1_0 = pstCANFrame->unCANData.u32CANData[1U];
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X250UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint8_t
*
)
u32RSCANAddress
))
|=
0X01
;
//RCFDC0CFDTMC0 |= 0X01;
//
RCFDC0CFDTMC0 |= 0X01;
enRSCANStatus
=
RSCAN_SET_COMPLETE
;
}
...
...
@@ -761,33 +815,33 @@ RSCAN_SetState RSCAN0_CH1_Set_TXBUF_Data(RSCAN_Channel_Buf_en_t enBufIndex, CAN_
{
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X2D0UL
+
RSCAN0_BASE_ADDRESS
;
if
(((
*
((
uint8_t
*
)
u32RSCANAddress
))
&
0x08U
)
==
0x0U
)
//if ((RSCAN0TMSTS0 & 0x08U) == 0x0U)
//
if ((RSCAN0TMSTS0 & 0x08U) == 0x0U)
{
(
*
((
uint8_t
*
)
u32RSCANAddress
))
=
0UL
;
//RSCAN0TMSTS0 = 0UL;
//
RSCAN0TMSTS0 = 0UL;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANFrameIDE
;
u32RSCANDataBuf
=
u32RSCANDataBuf
<<
31U
;
u32RSCANDataBuf
|=
pstCANFrame
->
u32CANID
;
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1000UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
u32RSCANDataBuf
;
//RCFDC0CFDTMID0 = u32RSCANDataBuf;
//
RCFDC0CFDTMID0 = u32RSCANDataBuf;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANLEN
;
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1004UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
(
uint32_t
)((
u32RSCANDataBuf
)
<<
28U
);
//RCFDC0CFDTMPTR0 = (uint32_t)((u32RSCANDataBuf) << 28U);
//
RCFDC0CFDTMPTR0 = (uint32_t)((u32RSCANDataBuf) << 28U);
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1008UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
pstCANFrame
->
unCANData
.
u32CANData
[
0U
];
//RCFDC0CFDTMDF0_0 = pstCANFrame->unCANData.u32CANData[0U];
//
RCFDC0CFDTMDF0_0 = pstCANFrame->unCANData.u32CANData[0U];
u32RSCANAddress
+=
0X04UL
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
pstCANFrame
->
unCANData
.
u32CANData
[
1U
];
//RCFDC0CFDTMDF1_0 = pstCANFrame->unCANData.u32CANData[1U];
//
RCFDC0CFDTMDF1_0 = pstCANFrame->unCANData.u32CANData[1U];
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X250UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint8_t
*
)
u32RSCANAddress
))
|=
0X01
;
//RCFDC0CFDTMC0 |= 0X01;
//
RCFDC0CFDTMC0 |= 0X01;
enRSCANStatus
=
RSCAN_SET_COMPLETE
;
}
...
...
@@ -817,33 +871,33 @@ RSCAN_SetState RSCAN0_CH2_Set_TXBUF_Data(RSCAN_Channel_Buf_en_t enBufIndex, CAN_
{
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X2D0UL
+
RSCAN0_BASE_ADDRESS
;
if
(((
*
((
uint8_t
*
)
u32RSCANAddress
))
&
0x08U
)
==
0x0U
)
//if ((RSCAN0TMSTS0 & 0x08U) == 0x0U)
//
if ((RSCAN0TMSTS0 & 0x08U) == 0x0U)
{
(
*
((
uint8_t
*
)
u32RSCANAddress
))
=
0UL
;
//RSCAN0TMSTS0 = 0UL;
//
RSCAN0TMSTS0 = 0UL;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANFrameIDE
;
u32RSCANDataBuf
=
u32RSCANDataBuf
<<
31U
;
u32RSCANDataBuf
|=
pstCANFrame
->
u32CANID
;
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1000UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
u32RSCANDataBuf
;
//RCFDC0CFDTMID0 = u32RSCANDataBuf;
//
RCFDC0CFDTMID0 = u32RSCANDataBuf;
u32RSCANDataBuf
=
pstCANFrame
->
u8CANLEN
;
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1004UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
(
uint32_t
)((
u32RSCANDataBuf
)
<<
28U
);
//RCFDC0CFDTMPTR0 = (uint32_t)((u32RSCANDataBuf) << 28U);
//
RCFDC0CFDTMPTR0 = (uint32_t)((u32RSCANDataBuf) << 28U);
u32RSCANAddress
=
u32RSCANBufIndexP
*
0X10UL
+
0X1008UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
pstCANFrame
->
unCANData
.
u32CANData
[
0U
];
//RCFDC0CFDTMDF0_0 = pstCANFrame->unCANData.u32CANData[0U];
//
RCFDC0CFDTMDF0_0 = pstCANFrame->unCANData.u32CANData[0U];
u32RSCANAddress
+=
0X04UL
;
(
*
((
uint32_t
*
)
u32RSCANAddress
))
=
pstCANFrame
->
unCANData
.
u32CANData
[
1U
];
//RCFDC0CFDTMDF1_0 = pstCANFrame->unCANData.u32CANData[1U];
//
RCFDC0CFDTMDF1_0 = pstCANFrame->unCANData.u32CANData[1U];
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X250UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint8_t
*
)
u32RSCANAddress
))
|=
0X01
;
//RCFDC0CFDTMC0 |= 0X01;
//
RCFDC0CFDTMC0 |= 0X01;
enRSCANStatus
=
RSCAN_SET_COMPLETE
;
}
...
...
@@ -932,10 +986,15 @@ void RSCAN0_CH0_Busoff_Recover(void)
{
if
(
RSCAN0_CH0_Get_Busoff_Status
())
{
uint32_t
u32RSCANTimeCount
=
0UL
;
RSCAN0C0ERFL
&=
0xFFFFFFF7UL
;
RSCAN0C0CTR
&=
0xFFFFFFF8UL
;
/* CommunicationMode */
while
((
RSCAN0C0STS
&
0x87UL
)
!=
0x80UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C0STS
&
0x87UL
)
!=
0x80UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
u32RSCANTimeCount
++
;
}
}
}
...
...
@@ -943,10 +1002,14 @@ void RSCAN0_CH1_Busoff_Recover(void)
{
if
(
RSCAN0_CH1_Get_Busoff_Status
())
{
uint32_t
u32RSCANTimeCount
=
0UL
;
RSCAN0C1ERFL
&=
0xFFFFFFF7UL
;
RSCAN0C1CTR
&=
0xFFFFFFF8UL
;
/* CommunicationMode */
while
((
RSCAN0C1STS
&
0x87UL
)
!=
0x80UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C1STS
&
0x87UL
)
!=
0x80UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
u32RSCANTimeCount
++
;
}
}
}
...
...
@@ -954,10 +1017,14 @@ void RSCAN0_CH2_Busoff_Recover(void)
{
if
(
RSCAN0_CH2_Get_Busoff_Status
())
{
uint32_t
u32RSCANTimeCount
=
0UL
;
RSCAN0C2ERFL
&=
0xFFFFFFF7UL
;
RSCAN0C2CTR
&=
0xFFFFFFF8UL
;
/* CommunicationMode */
while
((
RSCAN0C2STS
&
0x87UL
)
!=
0x80UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C2STS
&
0x87UL
)
!=
0x80UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
u32RSCANTimeCount
++
;
}
}
}
...
...
@@ -977,7 +1044,7 @@ void RSCAN0_CH0_Abort(RSCAN_Channel_Buf_en_t enBufIndex)
{
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X250UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint8_t
*
)
u32RSCANAddress
))
|=
0X02U
;
//RCFDC0CFDTMC0 |= 0X02;
//
RCFDC0CFDTMC0 |= 0X02;
}
}
void
RSCAN0_CH1_Abort
(
RSCAN_Channel_Buf_en_t
enBufIndex
)
...
...
@@ -995,7 +1062,7 @@ void RSCAN0_CH1_Abort(RSCAN_Channel_Buf_en_t enBufIndex)
{
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X250UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint8_t
*
)
u32RSCANAddress
))
|=
0X02U
;
//RCFDC0CFDTMC0 |= 0X02;
//
RCFDC0CFDTMC0 |= 0X02;
}
}
void
RSCAN0_CH2_Abort
(
RSCAN_Channel_Buf_en_t
enBufIndex
)
...
...
@@ -1013,7 +1080,7 @@ void RSCAN0_CH2_Abort(RSCAN_Channel_Buf_en_t enBufIndex)
{
u32RSCANAddress
=
u32RSCANBufIndexP
+
0X250UL
+
RSCAN0_BASE_ADDRESS
;
(
*
((
uint8_t
*
)
u32RSCANAddress
))
|=
0X02U
;
//RCFDC0CFDTMC0 |= 0X02;
//
RCFDC0CFDTMC0 |= 0X02;
}
}
...
...
@@ -1022,65 +1089,82 @@ void RSCAN0_CH2_Abort(RSCAN_Channel_Buf_en_t enBufIndex)
*/
void
RSCAN0_CH0_Sleep_Init
(
void
)
{
uint32_t
u32RSCANTimeCount
=
0UL
;
RSCAN0C0CTR
&=
0xfffffff9UL
;
RSCAN0C0CTR
|=
0x01UL
;
while
((
RSCAN0C0STS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C0STS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
RSCAN0C0CTR
|=
0x04UL
;
while
((
RSCAN0C0STS
&
0x07UL
)
!=
0X04UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C0STS
&
0x07UL
)
!=
0X04UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
}
void
RSCAN0_CH1_Sleep_Init
(
void
)
{
uint32_t
u32RSCANTimeCount
=
0UL
;
RSCAN0C1CTR
&=
0xfffffff9UL
;
RSCAN0C1CTR
|=
0x01UL
;
while
((
RSCAN0C1STS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C1STS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
RSCAN0C1CTR
|=
0x04UL
;
while
((
RSCAN0C1STS
&
0x07UL
)
!=
0X04UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C1STS
&
0x07UL
)
!=
0X04UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
}
void
RSCAN0_CH2_Sleep_Init
(
void
)
{
uint32_t
u32RSCANTimeCount
=
0UL
;
RSCAN0C2CTR
&=
0xfffffff9UL
;
RSCAN0C2CTR
|=
0x01UL
;
while
((
RSCAN0C2STS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C2STS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
RSCAN0C2CTR
|=
0x04UL
;
while
((
RSCAN0C2STS
&
0x07UL
)
!=
0X04UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0C2STS
&
0x07UL
)
!=
0X04UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
}
void
RSCAN0_Sleep_Init
(
void
)
{
uint32_t
u32RSCANTimeCount
=
0UL
;
RSCAN0GCTR
&=
0xfffffff9UL
;
RSCAN0GCTR
|=
0x01UL
;
while
((
RSCAN0GSTS
&
0x07UL
)
!=
0X01UL
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0GSTS
&
0x07UL
)
!=
0X01UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
))
{
;
u32RSCANTimeCount
++
;
}
RSCAN0GCTR
|=
0x04UL
;
// while ( (RSCAN0GSTS & 0x07UL) != 0X04UL )
while
((
RSCAN0GSTS
&
0x04UL
)
!=
0X04UL
)
u32RSCANTimeCount
=
0UL
;
while
((
(
RSCAN0GSTS
&
0x04UL
)
!=
0X04UL
)
&&
(
u32RSCANTimeCount
<
RSCAN_TIME_OUT_MAX
)
)
{
;
u32RSCANTimeCount
++
;
}
}
...
...
@@ -1130,11 +1214,15 @@ void RSCAN0_CH0_RX_ISR(void)
{
if
(
RSCAN0CFSTS2
&
0X08UL
)
{
uint32_t
u32RSCANTimeCount
=
0UL
;
CAN_Frame_Receive_st_t
stCANFrameReceive
;
RSCAN0CFSTS2
&=
0xFFFFFFF7UL
;
while
((
RSCAN0CFSTS2
&
0x01UL
)
==
0U
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0CFSTS2
&
0x01UL
)
==
0U
)
&&
(
u32RSCANTimeCount
<
128U
))
{
u32RSCANTimeCount
++
;
stCANFrameReceive
.
stReceiveContent
.
u32CANID
=
(
uint32_t
)(
RSCAN0CFID2
&
0x1FFFFFFFUL
);
stCANFrameReceive
.
stReceiveContent
.
u8CANLEN
=
(
uint8_t
)(
RSCAN0CFPTR2
>>
28U
);
stCANFrameReceive
.
stReceiveContent
.
u8CANFrameIDE
=
(
uint8_t
)((
RSCAN0CFID2
>>
31U
));
...
...
@@ -1152,11 +1240,15 @@ void RSCAN0_CH1_RX_ISR(void)
{
if
(
RSCAN0CFSTS5
&
0X08UL
)
{
uint32_t
u32RSCANTimeCount
=
0UL
;
CAN_Frame_Receive_st_t
stCANFrameReceive
;
RSCAN0CFSTS5
&=
0xFFFFFFF7UL
;
while
((
RSCAN0CFSTS5
&
0x01UL
)
==
0U
)
u32RSCANTimeCount
=
0UL
;
while
(((
RSCAN0CFSTS5
&
0x01UL
)
==
0U
)
&&
(
u32RSCANTimeCount
<
128U
))
{
u32RSCANTimeCount
++
;
stCANFrameReceive
.
stReceiveContent
.
u32CANID
=
(
uint32_t
)(
RSCAN0CFID5
&
0x1FFFFFFFUL
);
stCANFrameReceive
.
stReceiveContent
.
u8CANLEN
=
(
uint8_t
)(
RSCAN0CFPTR5
>>
28U
);
stCANFrameReceive
.
stReceiveContent
.
u8CANFrameIDE
=
(
uint8_t
)((
RSCAN0CFID5
>>
31U
));
...
...
@@ -1175,11 +1267,14 @@ void RSCAN0_CH2_RX_ISR(void)
if
(
RSCAN0CFSTS8
&
0X08UL
)
{
uint32_t
u32RSCANTimeCount
=
0UL
;
CAN_Frame_Receive_st_t
stCANFrameReceive
;
RSCAN0CFSTS8
&=
0xFFFFFFF7UL
;
while
((
RSCAN0CFSTS8
&
0x01UL
)
==
0U
)
u32RSCANTimeCount
=
0UL
;
while
((
(
RSCAN0CFSTS8
&
0x01UL
)
==
0U
)
&&
(
u32RSCANTimeCount
<
128U
)
)
{
u32RSCANTimeCount
++
;
stCANFrameReceive
.
stReceiveContent
.
u32CANID
=
(
uint32_t
)(
RSCAN0CFID8
&
0x1FFFFFFFUL
);
stCANFrameReceive
.
stReceiveContent
.
u8CANLEN
=
(
uint8_t
)(
RSCAN0CFPTR8
>>
28U
);
stCANFrameReceive
.
stReceiveContent
.
u8CANFrameIDE
=
(
uint8_t
)((
RSCAN0CFID8
>>
31U
));
...
...
source/Driver/Clock/Clock.c
View file @
6a901326
...
...
@@ -222,9 +222,9 @@ void Sys_Enter_Sleep_Mode(void)
__DI
();
SYSWUFC0
=
0x7FFFFU
;
/*---------------------------------------------*/
GPIO_Wakeup_PIN_Set
(
GPIO_WAKEUP_PIN_P0_5
,
GPIO_WAKEUP_FALLING_EDGE
);
/*CAN唤醒*/
GPIO_Wakeup_PIN_Set
(
GPIO_WAKEUP_PIN_P0_0
,
GPIO_WAKEUP_HIGH_LEVEL
);
/*15电唤醒*/
GPIO_Wakeup_PIN_Set
(
GPIO_WAKEUP_PIN_P0_7
,
GPIO_WAKEUP_HIGH_LEVEL
);
/*硬线唤醒*/
GPIO_Wakeup_PIN_Set
(
GPIO_WAKEUP_PIN_P0_5
,
GPIO_WAKEUP_FALLING_EDGE
);
/*CAN唤醒*/
GPIO_Wakeup_PIN_Set
(
GPIO_WAKEUP_PIN_P0_0
,
GPIO_WAKEUP_HIGH_LEVEL
);
/*15电唤醒*/
GPIO_Wakeup_PIN_Set
(
GPIO_WAKEUP_PIN_P0_7
,
GPIO_WAKEUP_HIGH_LEVEL
);
/*硬线唤醒*/
/*----------------------------------------------*/
SYSWUFMSK0
&=
0x7FFFEU
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment