我最近学习编写驱动,在裸机的led灯程序想写成驱动,我发现在linux下不能对寄存器直接赋值;
例如 :#define GPBCON (*(volatile unsigned long *)0x56000010)
#define GPB5_out (1<<(5*2))
#define GPB6_out (1<<(6*2))
#define GPB7_out (1<<(7*2))
#define GPB8_out (1<<(8*2))
GPBCON = GPB5_out|GPB6_out|GPB7_out|GPB8_out;
当测试我写的驱动的时候就会出现段错误,是不是不能这样赋值啊?
但是在linux内核中可以这么赋值啊!!!请问下怎么解决啊??