大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全家桶1年46,售后保障稳定
1、在配置Linux 编译选项时,开启相应的SPI 选项,如下所示
-> Device Drivers
-> SPI support
SPI support
*** SPI Master Controller Drivers ***
-*- Bitbanging SPI master
Samsung S3C24XX series SPI
< > Samsung S3C24XX series SPI by GPIO
*** SPI Protocol Masters ***
< > SPI EEPROMs from most vendors
User mode SPI device driver support
< > Infineon TLE62X0 (for power switching)设置完成保存。
2.驱动文件mcp251x.c mcp251x.h can.h
文件mcp251x.c放在目录drivers/net/can/下;
文件mcp251x.h放在目录include/linux/can/platform/下;
文件can.h放在目录include/linux/can/下
3.添加配置文件drivers/net/can/Kconfig
在文件中添加
config CAN_MCP251X
tristate “Microchip 251x series SPI CAN Controller”
depends on CAN && SPI
default N
—help—
Say Y here if you want support for the Microchip 251x series of
SPI based CAN controllers.
4.在drivers/net/can/Makefile文件中添加编译文件obj-$(CONFIG_CAN_MCP251X) += mcp251x.o
5. 修改文件arch/arm/mach-s3c2410/mach-smdk2410.c中添加spi板级启动信息#include #include //包含s3c2410_spi_info结构体
#include //包含struct mcp251x_platform_data结构体
static struct mcp251x_platform_data mcp251x_info = {
.f_osc = 16000000,
//.oscillator_frequency = 19000000,
//.board_specific_setup = myboard_mcp251x_initfunc,
//.device_reset = myboard_mcp251x_reset,
//.transceiver_enable = NULL,
};
static struct spi_board_info spi_board_info[] __initdata = {
[0]=
{
.modalias = “mcp251x”, //这个名称一定要与mcp251x.c驱动中
//proc函数中的.name要一致
.platform_data = &mcp251x_info, //上面的结构体
.irq = IRQ_EINT3, 中断端口号
.max_speed_hz = 8000000, //spi最大的速度
.bus_num = 0, //spi0,1中选择spi0口
.chip_select = 0, //多个芯片选择
},
};
static struct s3c2410_spi_info s3c2410_spi0_platdata = {
.pin_cs = S3C2410_GPG2, //片选端口指定
.num_cs = 1, //总共端口数
// .bus_num = 0,
};
smdk2410_devices数组中添加&s3c_device_spi0,
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/230615.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...