Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
33de63fb
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
33de63fb
编写于
10月 28, 2015
作者:
A
Aubr.Cool
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
correct compile error when using can
上级
405a1849
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
117 addition
and
18 deletion
+117
-18
bsp/stm32f10x/applications/canapp.c
bsp/stm32f10x/applications/canapp.c
+3
-2
bsp/stm32f10x/drivers/board.h
bsp/stm32f10x/drivers/board.h
+1
-0
bsp/stm32f10x/drivers/bxcan.c
bsp/stm32f10x/drivers/bxcan.c
+12
-0
bsp/stm32f10x/drivers/bxcan.h
bsp/stm32f10x/drivers/bxcan.h
+37
-0
bsp/stm32f10x/drivers/gpio.c
bsp/stm32f10x/drivers/gpio.c
+1
-0
bsp/stm32f10x/drivers/gpio.h
bsp/stm32f10x/drivers/gpio.h
+11
-0
bsp/stm32f10x/project.uvprojx
bsp/stm32f10x/project.uvprojx
+45
-16
bsp/stm32f10x/rtconfig.h
bsp/stm32f10x/rtconfig.h
+7
-0
未找到文件。
bsp/stm32f10x/applications/canapp.c
浏览文件 @
33de63fb
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include <board.h>
#include <board.h>
#include <rtthread.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <rtdevice.h>
#include "gpio.h"
#ifdef RT_USING_CAN
#ifdef RT_USING_CAN
#define CANRT1 8
#define CANRT1 8
#define CANERR1 9
#define CANERR1 9
...
@@ -28,8 +29,8 @@ static struct canledtype
...
@@ -28,8 +29,8 @@ static struct canledtype
{
{
#ifdef USING_BXCAN1
#ifdef USING_BXCAN1
{
{
{
CANRT1
,
PIN_MODE_OUTPUT
_OD
,},
{
CANRT1
,
PIN_MODE_OUTPUT
,},
{
CANERR1
,
PIN_MODE_OUTPUT
_OD
,},
{
CANERR1
,
PIN_MODE_OUTPUT
,},
},
},
#endif
/*USING_BXCAN1*/
#endif
/*USING_BXCAN1*/
#ifdef USING_BXCAN2
#ifdef USING_BXCAN2
...
...
bsp/stm32f10x/drivers/board.h
浏览文件 @
33de63fb
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
#define RT_USING_UART1
#define RT_USING_UART1
#define RT_USING_UART2
#define RT_USING_UART2
#define RT_USING_UART3
#define RT_USING_UART3
#define USING_BXCAN1
void
rt_hw_board_init
(
void
);
void
rt_hw_board_init
(
void
);
...
...
bsp/stm32f10x/drivers/bxcan.c
浏览文件 @
33de63fb
...
@@ -27,7 +27,12 @@
...
@@ -27,7 +27,12 @@
#define BX_CAN_FMRNUMBER 28
#define BX_CAN_FMRNUMBER 28
#define BX_CAN2_FMRSTART 14
#define BX_CAN2_FMRSTART 14
#endif
#endif
#ifdef STM32F10X_HD
#undef USING_BXCAN2
#define CAN1_RX0_IRQn USB_LP_CAN1_RX0_IRQn
#define CAN1_TX_IRQn USB_HP_CAN1_TX_IRQn
#endif
#define BX_CAN_MAX_FILTERS (BX_CAN_FMRNUMBER * 4)
#define BX_CAN_MAX_FILTERS (BX_CAN_FMRNUMBER * 4)
#define BX_CAN_MAX_FILTER_MASKS BX_CAN_MAX_FILTERS
#define BX_CAN_MAX_FILTER_MASKS BX_CAN_MAX_FILTERS
#define BX_CAN_FILTER_MAX_ARRAY_SIZE ((BX_CAN_MAX_FILTERS + 32 - 1) / 32)
#define BX_CAN_FILTER_MAX_ARRAY_SIZE ((BX_CAN_MAX_FILTERS + 32 - 1) / 32)
...
@@ -148,6 +153,7 @@ static void bxcan1_filter_init(struct rt_can_device *can)
...
@@ -148,6 +153,7 @@ static void bxcan1_filter_init(struct rt_can_device *can)
}
}
calcfiltermasks
(
pbxcan
);
calcfiltermasks
(
pbxcan
);
}
}
#ifdef USING_BXCAN2
static
void
bxcan2_filter_init
(
struct
rt_can_device
*
can
)
static
void
bxcan2_filter_init
(
struct
rt_can_device
*
can
)
{
{
rt_uint32_t
i
;
rt_uint32_t
i
;
...
@@ -234,6 +240,8 @@ static void bxcan2_filter_init(struct rt_can_device *can)
...
@@ -234,6 +240,8 @@ static void bxcan2_filter_init(struct rt_can_device *can)
}
}
calcfiltermasks
(
pbxcan
);
calcfiltermasks
(
pbxcan
);
}
}
#endif
#define BS1SHIFT 16
#define BS1SHIFT 16
#define BS2SHIFT 20
#define BS2SHIFT 20
#define RRESCLSHIFT 0
#define RRESCLSHIFT 0
...
@@ -320,6 +328,7 @@ static void bxcan1_hw_init(void)
...
@@ -320,6 +328,7 @@ static void bxcan1_hw_init(void)
NVIC_InitStructure
.
NVIC_IRQChannel
=
CAN1_TX_IRQn
;
NVIC_InitStructure
.
NVIC_IRQChannel
=
CAN1_TX_IRQn
;
NVIC_Init
(
&
NVIC_InitStructure
);
NVIC_Init
(
&
NVIC_InitStructure
);
}
}
#ifdef USING_BXCAN2
static
void
bxcan2_hw_init
(
void
)
static
void
bxcan2_hw_init
(
void
)
{
{
GPIO_InitTypeDef
GPIO_InitStructure
;
GPIO_InitTypeDef
GPIO_InitStructure
;
...
@@ -345,6 +354,7 @@ static void bxcan2_hw_init(void)
...
@@ -345,6 +354,7 @@ static void bxcan2_hw_init(void)
NVIC_InitStructure
.
NVIC_IRQChannel
=
CAN2_TX_IRQn
;
NVIC_InitStructure
.
NVIC_IRQChannel
=
CAN2_TX_IRQn
;
NVIC_Init
(
&
NVIC_InitStructure
);
NVIC_Init
(
&
NVIC_InitStructure
);
}
}
#endif
static
inline
rt_err_t
bxcan_enter_init
(
CAN_TypeDef
*
pcan
)
static
inline
rt_err_t
bxcan_enter_init
(
CAN_TypeDef
*
pcan
)
{
{
uint32_t
wait_ack
=
0x00000000
;
uint32_t
wait_ack
=
0x00000000
;
...
@@ -1010,9 +1020,11 @@ static rt_err_t configure(struct rt_can_device *can, struct can_configure *cfg)
...
@@ -1010,9 +1020,11 @@ static rt_err_t configure(struct rt_can_device *can, struct can_configure *cfg)
}
}
else
else
{
{
#ifdef USING_BXCAN2
bxcan2_hw_init
();
bxcan2_hw_init
();
bxcan_init
(
pbxcan
,
cfg
->
baud_rate
,
can
->
config
.
mode
);
bxcan_init
(
pbxcan
,
cfg
->
baud_rate
,
can
->
config
.
mode
);
bxcan2_filter_init
(
can
);
bxcan2_filter_init
(
can
);
#endif
}
}
return
RT_EOK
;
return
RT_EOK
;
}
}
...
...
bsp/stm32f10x/drivers/bxcan.h
浏览文件 @
33de63fb
...
@@ -14,4 +14,41 @@
...
@@ -14,4 +14,41 @@
#ifndef BXCAN_H_
#ifndef BXCAN_H_
#define BXCAN_H_
#define BXCAN_H_
/* CAN Master Control Register bits */
#define MCR_DBF ((uint32_t)0x00010000)
/* software master reset */
/* CAN Mailbox Transmit Request */
#define TMIDxR_TXRQ ((uint32_t)0x00000001)
/* Transmit mailbox request */
/* CAN Filter Master Register bits */
#define FMR_FINIT ((uint32_t)0x00000001)
/* Filter init mode */
/* Time out for INAK bit */
#define INAK_TIMEOUT ((uint32_t)0x0000FFFF)
/* Time out for SLAK bit */
#define SLAK_TIMEOUT ((uint32_t)0x0000FFFF)
/* Flags in TSR register */
#define CAN_FLAGS_TSR ((uint32_t)0x08000000)
/* Flags in RF1R register */
#define CAN_FLAGS_RF1R ((uint32_t)0x04000000)
/* Flags in RF0R register */
#define CAN_FLAGS_RF0R ((uint32_t)0x02000000)
/* Flags in MSR register */
#define CAN_FLAGS_MSR ((uint32_t)0x01000000)
/* Flags in ESR register */
#define CAN_FLAGS_ESR ((uint32_t)0x00F00000)
/* Mailboxes definition */
#define CAN_TXMAILBOX_0 ((uint8_t)0x00)
#define CAN_TXMAILBOX_1 ((uint8_t)0x01)
#define CAN_TXMAILBOX_2 ((uint8_t)0x02)
#define CAN_MODE_MASK ((uint32_t) 0x00000003)
#endif
/*BXCAN_H_*/
#endif
/*BXCAN_H_*/
bsp/stm32f10x/drivers/gpio.c
浏览文件 @
33de63fb
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include <rthw.h>
#include <rthw.h>
#include <rtdevice.h>
#include <rtdevice.h>
#include <board.h>
#include <board.h>
#include <gpio.h>
#ifdef RT_USING_PIN
#ifdef RT_USING_PIN
...
...
bsp/stm32f10x/drivers/gpio.h
浏览文件 @
33de63fb
...
@@ -14,6 +14,17 @@
...
@@ -14,6 +14,17 @@
#ifndef GPIO_H__
#ifndef GPIO_H__
#define GPIO_H__
#define GPIO_H__
struct
stm32_hw_pin_userdata
{
int
pin
;
uint32_t
mode
;
};
#define PIN_USERDATA_END {-1,0}
extern
struct
stm32_hw_pin_userdata
stm32_pins
[];
int
stm32_hw_pin_init
(
void
);
int
stm32_hw_pin_init
(
void
);
#endif
#endif
bsp/stm32f10x/project.uvprojx
浏览文件 @
33de63fb
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<TargetCommonOption>
<TargetCommonOption>
<Device>
STM32F103ZE
</Device>
<Device>
STM32F103ZE
</Device>
<Vendor>
STMicroelectronics
</Vendor>
<Vendor>
STMicroelectronics
</Vendor>
<PackID>
Keil.STM32F1xx_DFP.1.
0.5
</PackID>
<PackID>
Keil.STM32F1xx_DFP.1.
1.0
</PackID>
<PackURL>
http://www.keil.com/pack/
</PackURL>
<PackURL>
http://www.keil.com/pack/
</PackURL>
<Cpu>
IROM(0x08000000,0x80000) IRAM(0x20000000,0x10000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
</Cpu>
<Cpu>
IROM(0x08000000,0x80000) IRAM(0x20000000,0x10000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<FlashUtilSpec></FlashUtilSpec>
...
@@ -37,8 +37,8 @@
...
@@ -37,8 +37,8 @@
<BinPath></BinPath>
<BinPath></BinPath>
<IncludePath></IncludePath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<LibPath></LibPath>
<RegisterFilePath>
ST\STM32F10x\
</RegisterFilePath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath>
ST\STM32F10x\
</DBRegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<TargetStatus>
<Error>
0
</Error>
<Error>
0
</Error>
<ExitCodeStop>
0
</ExitCodeStop>
<ExitCodeStop>
0
</ExitCodeStop>
...
@@ -84,6 +84,8 @@
...
@@ -84,6 +84,8 @@
<UserProg2Name></UserProg2Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>
0
</UserProg1Dos16Mode>
<UserProg1Dos16Mode>
0
</UserProg1Dos16Mode>
<UserProg2Dos16Mode>
0
</UserProg2Dos16Mode>
<UserProg2Dos16Mode>
0
</UserProg2Dos16Mode>
<nStopA1X>
0
</nStopA1X>
<nStopA2X>
0
</nStopA2X>
</AfterMake>
</AfterMake>
<SelectedForBatchBuild>
0
</SelectedForBatchBuild>
<SelectedForBatchBuild>
0
</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
<SVCSIdString></SVCSIdString>
...
@@ -106,13 +108,13 @@
...
@@ -106,13 +108,13 @@
</CommonProperty>
</CommonProperty>
<DllOption>
<DllOption>
<SimDllName>
SARMCM3.DLL
</SimDllName>
<SimDllName>
SARMCM3.DLL
</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDllArguments>
-REMAP
</SimDllArguments>
<SimDlgDll>
D
ARMST
M.DLL
</SimDlgDll>
<SimDlgDll>
D
C
M.DLL
</SimDlgDll>
<SimDlgDllArguments>
-p
STM32F103ZE
</SimDlgDllArguments>
<SimDlgDllArguments>
-p
CM3
</SimDlgDllArguments>
<TargetDllName>
SARMCM3.DLL
</TargetDllName>
<TargetDllName>
SARMCM3.DLL
</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>
T
ARMST
M.DLL
</TargetDlgDll>
<TargetDlgDll>
T
C
M.DLL
</TargetDlgDll>
<TargetDlgDllArguments>
-p
STM32F103ZE
</TargetDlgDllArguments>
<TargetDlgDllArguments>
-p
CM3
</TargetDlgDllArguments>
</DllOption>
</DllOption>
<DebugOption>
<DebugOption>
<OPTHX>
<OPTHX>
...
@@ -147,7 +149,7 @@
...
@@ -147,7 +149,7 @@
<RestoreSysVw>
1
</RestoreSysVw>
<RestoreSysVw>
1
</RestoreSysVw>
</Target>
</Target>
<RunDebugAfterBuild>
0
</RunDebugAfterBuild>
<RunDebugAfterBuild>
0
</RunDebugAfterBuild>
<TargetSelection>
6
</TargetSelection>
<TargetSelection>
1
</TargetSelection>
<SimDlls>
<SimDlls>
<CpuDll></CpuDll>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<CpuDllArguments></CpuDllArguments>
...
@@ -161,7 +163,7 @@
...
@@ -161,7 +163,7 @@
<PeripheralDll></PeripheralDll>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
<InitializationFile></InitializationFile>
<Driver>
Segger\JL2CM3.dll
</Driver>
<Driver>
BIN\UL2CM3.DLL
</Driver>
</TargetDlls>
</TargetDlls>
</DebugOption>
</DebugOption>
<Utilities>
<Utilities>
...
@@ -171,10 +173,10 @@
...
@@ -171,10 +173,10 @@
<RunIndependent>
0
</RunIndependent>
<RunIndependent>
0
</RunIndependent>
<UpdateFlashBeforeDebugging>
1
</UpdateFlashBeforeDebugging>
<UpdateFlashBeforeDebugging>
1
</UpdateFlashBeforeDebugging>
<Capability>
1
</Capability>
<Capability>
1
</Capability>
<DriverSelection>
409
9
</DriverSelection>
<DriverSelection>
409
6
</DriverSelection>
</Flash1>
</Flash1>
<bUseTDR>
1
</bUseTDR>
<bUseTDR>
1
</bUseTDR>
<Flash2>
Segger\JL2CM3.dll
</Flash2>
<Flash2>
BIN\UL2CM3.DLL
</Flash2>
<Flash3>
"" ()
</Flash3>
<Flash3>
"" ()
</Flash3>
<Flash4></Flash4>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmOut></pFcarmOut>
...
@@ -359,11 +361,13 @@
...
@@ -359,11 +361,13 @@
<wLevel>
0
</wLevel>
<wLevel>
0
</wLevel>
<uThumb>
0
</uThumb>
<uThumb>
0
</uThumb>
<uSurpInc>
0
</uSurpInc>
<uSurpInc>
0
</uSurpInc>
<uC99>
0
</uC99>
<uC99>
1
</uC99>
<useXO>
0
</useXO>
<useXO>
0
</useXO>
<v6Lang>
0
</v6Lang>
<v6LangP>
0
</v6LangP>
<VariousControls>
<VariousControls>
<MiscControls></MiscControls>
<MiscControls></MiscControls>
<Define>
STM32F10X_HD,
USE_STDPERIPH_DRIVER
</Define>
<Define>
USE_STDPERIPH_DRIVER
</Define>
<Undefine></Undefine>
<Undefine></Undefine>
<IncludePath>
.;..\..\components\CMSIS\Include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\init;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;Libraries\STM32F10x_StdPeriph_Driver\inc;applications;drivers
</IncludePath>
<IncludePath>
.;..\..\components\CMSIS\Include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\init;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;Libraries\STM32F10x_StdPeriph_Driver\inc;applications;drivers
</IncludePath>
</VariousControls>
</VariousControls>
...
@@ -398,7 +402,7 @@
...
@@ -398,7 +402,7 @@
<ScatterFile></ScatterFile>
<ScatterFile></ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<IncludeLibsPath></IncludeLibsPath>
<Misc>
--keep __fsym_* --keep __vsym_* --keep __rt_init*
</Misc>
<Misc>
--keep __fsym_* --keep __vsym_* --keep __rt_init*
</Misc>
<LinkerInputFile></LinkerInputFile>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
<DisabledWarnings></DisabledWarnings>
</LDads>
</LDads>
...
@@ -418,6 +422,11 @@
...
@@ -418,6 +422,11 @@
<FileType>
1
</FileType>
<FileType>
1
</FileType>
<FilePath>
applications\startup.c
</FilePath>
<FilePath>
applications\startup.c
</FilePath>
</File>
</File>
<File>
<FileName>
canapp.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
.\applications\canapp.c
</FilePath>
</File>
</Files>
</Files>
</Group>
</Group>
<Group>
<Group>
...
@@ -443,6 +452,16 @@
...
@@ -443,6 +452,16 @@
<FileType>
1
</FileType>
<FileType>
1
</FileType>
<FilePath>
drivers\usart.c
</FilePath>
<FilePath>
drivers\usart.c
</FilePath>
</File>
</File>
<File>
<FileName>
bxcan.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
.\drivers\bxcan.c
</FilePath>
</File>
<File>
<FileName>
gpio.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
.\drivers\gpio.c
</FilePath>
</File>
</Files>
</Files>
</Group>
</Group>
<Group>
<Group>
...
@@ -708,6 +727,16 @@
...
@@ -708,6 +727,16 @@
<FileType>
1
</FileType>
<FileType>
1
</FileType>
<FilePath>
..\..\components\drivers\src\workqueue.c
</FilePath>
<FilePath>
..\..\components\drivers\src\workqueue.c
</FilePath>
</File>
</File>
<File>
<FileName>
pin.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
..\..\components\drivers\misc\pin.c
</FilePath>
</File>
<File>
<FileName>
can.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
..\..\components\drivers\can\can.c
</FilePath>
</File>
</Files>
</Files>
</Group>
</Group>
<Group>
<Group>
...
@@ -786,7 +815,7 @@
...
@@ -786,7 +815,7 @@
<File>
<File>
<FileName>
components.c
</FileName>
<FileName>
components.c
</FileName>
<FileType>
1
</FileType>
<FileType>
1
</FileType>
<FilePath>
..\..\
components\init
\components.c
</FilePath>
<FilePath>
..\..\
src
\components.c
</FilePath>
</File>
</File>
</Files>
</Files>
</Group>
</Group>
...
...
bsp/stm32f10x/rtconfig.h
浏览文件 @
33de63fb
...
@@ -80,6 +80,13 @@
...
@@ -80,6 +80,13 @@
#define FINSH_USING_SYMTAB
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_USING_DESCRIPTION
#define RT_USING_PIN
#define RT_USING_CAN
#define RT_CAN_USING_BUS_HOOK
#define RT_CAN_USING_HDR
/* SECTION: device filesystem */
/* SECTION: device filesystem */
/* #define RT_USING_DFS */
/* #define RT_USING_DFS */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录