diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-17 21:15:31 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-17 21:15:31 +0000 |
commit | 5a0722f9d657233ed85bdcf75a9a14ea321a1a28 (patch) | |
tree | 3ce9d8153ebbd5259472394eca8ef369cfcfd455 /nuttx/arch | |
parent | d8ee4cfaf8afacfe8ff455900ed391af4f642888 (diff) | |
download | px4-nuttx-5a0722f9d657233ed85bdcf75a9a14ea321a1a28.tar.gz px4-nuttx-5a0722f9d657233ed85bdcf75a9a14ea321a1a28.tar.bz2 px4-nuttx-5a0722f9d657233ed85bdcf75a9a14ea321a1a28.zip |
Straighten out conditional compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1896 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r-- | nuttx/arch/arm/include/arch.h | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/nuttx/arch/arm/include/arch.h b/nuttx/arch/arm/include/arch.h index d97353ba1..88c0706db 100644 --- a/nuttx/arch/arm/include/arch.h +++ b/nuttx/arch/arm/include/arch.h @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/include/arch.h * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,41 @@ * Definitions ****************************************************************************/ +/* This identifies the register the is used by the processor as the PIC base + * register. It is usually r9 or r10 + */ + +#define PIC_REG r10 +#define PIC_REG_STRING "r10" + +/* Macros to get and set the PIC base register. picbase is assumed to be + * of type (void*) and that it will fit into a uint32. These must be + * inline so that they will be compatible with the ABIs rules for + * preserving the PIC register + */ + +#define up_getpicbase(ppicbase) \ +do { \ + uint32 picbase; \ + __asm__ \ + ( \ + "\tmov %0, " PIC_REG_STRING "\n\t" \ + : "=r"(picbase) \ + ); \ + *ppicbase = (FAR void*)picbase; \ +} while (0) + +#define up_setpicbase(picbase) \ +do { \ + uint32 _picbase = (uint32)picbase; \ + __asm__ \ + ( \ + "\tmov " PIC_REG_STRING ", %0\n\t" \ + : : "r"(_picbase) : PIC_REG_STRING \ + ); \ +} while (0) + + /**************************************************************************** * Inline functions ****************************************************************************/ |