Re: What's wrong with this code? I cannot compile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


just so
2008/11/26, Russell King - ARM Linux <linux@xxxxxxxxxxxxxxxx>:>> On Tue, Nov 25, 2008 at 11:36:19PM +0100, viper@xxxxxxxxxxx wrote:> > I'm trying to write a small function to reset the CPU ( eg. some> learning),> > but I cannot compile it with my toolchain.> >> > The code:> >> > #define ARCH "AT91RM9200"> > #define CONFIG_ARCH "AT91RM9200"> > #define CONFIG_ARCH_AT91RM9200 1> > #include <stdlib.h>> > #include <asm/hardware.h>> > #include <stdio.h>> > #include <asm/arch-at91/io.h>> > #include <asm/arch-at91/at91rm9200.h>> > //#include <asm/mach/arch.h>> > //#include <asm/mach/map.h>> >> > //#include "generic.h"> > //#include "clock.h"> >> >> > static void at91rm9200_reset(void)> > {> >         /*> >          * Perform a hardware reset with the use of the Watchdog timer.> >          */> >          at91_sys_write(AT91_ST_WDMR,AT91_ST_RSTEN | AT91_ST_EXTEN | 1);> >         __raw_writel(AT91_ST_WDRST,AT91_ST_CR);> > }> >> > int main() {> >     printf("Resetting board via Watchdog - by Viper\n");> >     at91rm9200_reset();> >     return 0;> > }> >> > If I provide the includes by hand, I'm getting errors on io.h's viod> > __iomem. What's wrong?>> You're mixing kernel programming with user space programming.  The two> don't mix.  You either write code for user space, and use user space> headers, or you write code for kernel space using kernel headers only.>> If you want to reboot the machine, then use the system call to do it -> sys_reboot().>> -------------------------------------------------------------------> List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm> FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php> Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php>


-- ***************************Blog:http://eveson.cublog.cn
文章:http://www.chinaunix.net/index.php?uid=753873&url=http://linux.chinaunix.net/bbs/viewthread.php?tid=1046164
phone:http://www.rd3721.com/bbs/display.asp?UserID=45692-------------------------------------------------------------------List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-armFAQ:        http://www.arm.linux.org.uk/mailinglists/faq.phpEtiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php


[Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

Add to Google Follow linuxarm on Twitter