Add W25 FLASH driver; Use attribute definitions in nuttx/compiler.h

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5161 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-09-16 15:46:54 +00:00
parent 62f6889f92
commit c09094ccfc
34 changed files with 1383 additions and 66 deletions
+7
View File
@@ -3361,3 +3361,10 @@
way it was. The really interrupt related problem was in stm32_spi.c: way it was. The really interrupt related problem was in stm32_spi.c:
When SPI3 is not enabled, then the irqrestore() falls in the When SPI3 is not enabled, then the irqrestore() falls in the
else clause. else clause.
* include/nuttx/compiler.h and other files: Moved always_inline
and noinline __attributes__ here. Also replaced all occurrences
of explicit __atributes__ in other files with definitions from
this header file.
* drivers/mtd/w25.c: The Windbond SPI FLASH W25 FLASH driver is
code complete (but still untested).
+2 -2
View File
@@ -1,7 +1,7 @@
/************************************************************************ /************************************************************************
* up_assert.c * up_assert.c
* *
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -65,7 +65,7 @@
* Name: _up_assert * Name: _up_assert
************************************************************************/ ************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+14 -13
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/include/armv7-m/irq.h * arch/arm/include/armv7-m/irq.h
* *
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,7 @@
#include <nuttx/irq.h> #include <nuttx/irq.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
@@ -131,7 +132,7 @@ struct xcptcontext
/* Disable IRQs */ /* Disable IRQs */
static inline void irqdisable(void) __attribute__((always_inline)); static inline void irqdisable(void) inline_function;
static inline void irqdisable(void) static inline void irqdisable(void)
{ {
__asm__ __volatile__ ("\tcpsid i\n"); __asm__ __volatile__ ("\tcpsid i\n");
@@ -139,7 +140,7 @@ static inline void irqdisable(void)
/* Save the current primask state & disable IRQs */ /* Save the current primask state & disable IRQs */
static inline irqstate_t irqsave(void) __attribute__((always_inline)); static inline irqstate_t irqsave(void) inline_function;
static inline irqstate_t irqsave(void) static inline irqstate_t irqsave(void)
{ {
unsigned short primask; unsigned short primask;
@@ -161,7 +162,7 @@ static inline irqstate_t irqsave(void)
/* Enable IRQs */ /* Enable IRQs */
static inline void irqenable(void) __attribute__((always_inline)); static inline void irqenable(void) inline_function;
static inline void irqenable(void) static inline void irqenable(void)
{ {
__asm__ __volatile__ ("\tcpsie i\n"); __asm__ __volatile__ ("\tcpsie i\n");
@@ -169,7 +170,7 @@ static inline void irqenable(void)
/* Restore saved primask state */ /* Restore saved primask state */
static inline void irqrestore(irqstate_t primask) __attribute__((always_inline)); static inline void irqrestore(irqstate_t primask) inline_function;
static inline void irqrestore(irqstate_t primask) static inline void irqrestore(irqstate_t primask)
{ {
/* If bit 0 of the primask is 0, then we need to restore /* If bit 0 of the primask is 0, then we need to restore
@@ -189,7 +190,7 @@ static inline void irqrestore(irqstate_t primask)
/* Get/set the primask register */ /* Get/set the primask register */
static inline uint8_t getprimask(void) __attribute__((always_inline)); static inline uint8_t getprimask(void) inline_function;
static inline uint8_t getprimask(void) static inline uint8_t getprimask(void)
{ {
uint32_t primask; uint32_t primask;
@@ -203,7 +204,7 @@ static inline uint8_t getprimask(void)
return (uint8_t)primask; return (uint8_t)primask;
} }
static inline void setprimask(uint32_t primask) __attribute__((always_inline)); static inline void setprimask(uint32_t primask) inline_function;
static inline void setprimask(uint32_t primask) static inline void setprimask(uint32_t primask)
{ {
__asm__ __volatile__ __asm__ __volatile__
@@ -216,7 +217,7 @@ static inline void setprimask(uint32_t primask)
/* Get/set the basepri register */ /* Get/set the basepri register */
static inline uint8_t getbasepri(void) __attribute__((always_inline)); static inline uint8_t getbasepri(void) inline_function;
static inline uint8_t getbasepri(void) static inline uint8_t getbasepri(void)
{ {
uint32_t basepri; uint32_t basepri;
@@ -231,7 +232,7 @@ static inline uint8_t getbasepri(void)
return (uint8_t)basepri; return (uint8_t)basepri;
} }
static inline void setbasepri(uint32_t basepri) __attribute__((always_inline)); static inline void setbasepri(uint32_t basepri) inline_function;
static inline void setbasepri(uint32_t basepri) static inline void setbasepri(uint32_t basepri)
{ {
__asm__ __volatile__ __asm__ __volatile__
@@ -244,7 +245,7 @@ static inline void setbasepri(uint32_t basepri)
/* Get/set IPSR */ /* Get/set IPSR */
static inline uint32_t getipsr(void) __attribute__((always_inline)); static inline uint32_t getipsr(void) inline_function;
static inline uint32_t getipsr(void) static inline uint32_t getipsr(void)
{ {
uint32_t ipsr; uint32_t ipsr;
@@ -258,7 +259,7 @@ static inline uint32_t getipsr(void)
return ipsr; return ipsr;
} }
static inline void setipsr(uint32_t ipsr) __attribute__((always_inline)); static inline void setipsr(uint32_t ipsr) inline_function;
static inline void setipsr(uint32_t ipsr) static inline void setipsr(uint32_t ipsr)
{ {
__asm__ __volatile__ __asm__ __volatile__
@@ -271,7 +272,7 @@ static inline void setipsr(uint32_t ipsr)
/* Get/set CONTROL */ /* Get/set CONTROL */
static inline uint32_t getcontrol(void) __attribute__((always_inline)); static inline uint32_t getcontrol(void) inline_function;
static inline uint32_t getcontrol(void) static inline uint32_t getcontrol(void)
{ {
uint32_t control; uint32_t control;
@@ -285,7 +286,7 @@ static inline uint32_t getcontrol(void)
return control; return control;
} }
static inline void setcontrol(uint32_t control) __attribute__((always_inline)); static inline void setcontrol(uint32_t control) inline_function;
static inline void setcontrol(uint32_t control) static inline void setcontrol(uint32_t control)
{ {
__asm__ __volatile__ __asm__ __volatile__
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/arm/up_assert.c * arch/arm/src/arm/up_assert.c
* *
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -252,7 +252,7 @@ static void up_dumpstate(void)
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+1 -1
View File
@@ -74,7 +74,7 @@
/* SYS call 1: /* SYS call 1:
* *
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
*/ */
#define SYS_restore_context (1) #define SYS_restore_context (1)
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/armv7-m/up_assert.c * arch/arm/src/armv7-m/up_assert.c
* *
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -262,7 +262,7 @@ static void up_dumpstate(void)
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
@@ -69,7 +69,7 @@
* Description: * Description:
* Restore the current thread context. Full prototype is: * Restore the current thread context. Full prototype is:
* *
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
* *
* Return: * Return:
* None * None
+1 -1
View File
@@ -280,7 +280,7 @@ int up_svcall(int irq, FAR void *context)
/* R0=SYS_restore_context: This a restore context command: /* R0=SYS_restore_context: This a restore context command:
* *
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
* *
* At this point, the following values are saved in context: * At this point, the following values are saved in context:
* *
+4 -1
View File
@@ -40,7 +40,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <sys/types.h> # include <sys/types.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
@@ -223,7 +226,7 @@ extern void up_boot(void);
extern void up_copystate(uint32_t *dest, uint32_t *src); extern void up_copystate(uint32_t *dest, uint32_t *src);
extern void up_decodeirq(uint32_t *regs); extern void up_decodeirq(uint32_t *regs);
extern int up_saveusercontext(uint32_t *saveregs); extern int up_saveusercontext(uint32_t *saveregs);
extern void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); extern void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
extern void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs); extern void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
/* Signal handling **********************************************************/ /* Signal handling **********************************************************/
+5 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/avr/src/avr/avr_internal.h * arch/avr/src/avr/avr_internal.h
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <sys/types.h> # include <sys/types.h>
# include <stdint.h> # include <stdint.h>
# include <stdbool.h> # include <stdbool.h>
@@ -111,7 +114,7 @@ extern void up_copystate(uint8_t *dest, uint8_t *src);
* *
************************************************************************************/ ************************************************************************************/
extern void up_fullcontextrestore(uint8_t *restoreregs) __attribute__ ((noreturn)); extern void up_fullcontextrestore(uint8_t *restoreregs) noreturn_function;
/************************************************************************************ /************************************************************************************
* Name: up_switchcontext * Name: up_switchcontext
+5 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/avr/src/avr32/up_internal.h * arch/avr/src/avr32/up_internal.h
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
@@ -109,7 +112,7 @@ extern void up_copystate(uint32_t *dest, uint32_t *src);
* *
************************************************************************************/ ************************************************************************************/
extern void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); extern void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
/************************************************************************************ /************************************************************************************
* Name: up_switchcontext * Name: up_switchcontext
+1 -1
View File
@@ -90,7 +90,7 @@
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+3 -1
View File
@@ -41,7 +41,9 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
@@ -152,7 +154,7 @@ extern void up_copystate(uint8_t *dest, uint8_t *src);
extern void up_decodeirq(uint8_t *regs); extern void up_decodeirq(uint8_t *regs);
extern void up_irqinitialize(void); extern void up_irqinitialize(void);
extern int up_saveusercontext(uint8_t *saveregs); extern int up_saveusercontext(uint8_t *saveregs);
extern void up_fullcontextrestore(uint8_t *restoreregs) __attribute__ ((noreturn)); extern void up_fullcontextrestore(uint8_t *restoreregs) noreturn_function;
extern void up_switchcontext(uint8_t *saveregs, uint8_t *restoreregs); extern void up_switchcontext(uint8_t *saveregs, uint8_t *restoreregs);
/* Interrupt handling */ /* Interrupt handling */
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/hc/src/m9s12/m9s12_assert.c * arch/hc/src/m9s12/m9s12_assert.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -247,7 +247,7 @@ static void up_dumpstate(void)
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/mips/include/mips32/syscall.h * arch/mips/include/mips32/syscall.h
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -150,7 +150,7 @@
/* SYS call 1: /* SYS call 1:
* *
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
*/ */
#define SYS_restore_context (1) #define SYS_restore_context (1)
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/mips/src/mips32/up_assert.c * arch/mips/src/mips32/up_assert.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -90,7 +90,7 @@
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/mips/src/mips32/up_swint0.c * arch/mips/src/mips32/up_swint0.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -290,7 +290,7 @@ int up_swint0(int irq, FAR void *context)
{ {
/* R4=SYS_restore_context: This a restore context command: /* R4=SYS_restore_context: This a restore context command:
* *
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
* *
* At this point, the following values are saved in context: * At this point, the following values are saved in context:
* *
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/sh/src/common/up_assert.c * arch/sh/src/common/up_assert.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -76,7 +76,7 @@
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+4 -1
View File
@@ -40,7 +40,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
@@ -144,7 +147,7 @@ extern void up_copystate(uint32_t *dest, uint32_t *src);
extern void up_dataabort(uint32_t *regs); extern void up_dataabort(uint32_t *regs);
extern void up_decodeirq(uint32_t *regs); extern void up_decodeirq(uint32_t *regs);
extern uint32_t *up_doirq(int irq, uint32_t *regs); extern uint32_t *up_doirq(int irq, uint32_t *regs);
extern void up_fullcontextrestore(uint32_t *regs) __attribute__ ((noreturn)); extern void up_fullcontextrestore(uint32_t *regs) noreturn_function;
extern void up_irqinitialize(void); extern void up_irqinitialize(void);
extern void up_prefetchabort(uint32_t *regs); extern void up_prefetchabort(uint32_t *regs);
extern int up_saveusercontext(uint32_t *regs); extern int up_saveusercontext(uint32_t *regs);
+2 -1
View File
@@ -41,6 +41,7 @@
**************************************************************************/ **************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h> #include <sys/types.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
@@ -150,7 +151,7 @@ extern volatile int g_eventloop;
/* up_setjmp.S ************************************************************/ /* up_setjmp.S ************************************************************/
extern int up_setjmp(int *jb); extern int up_setjmp(int *jb);
extern void up_longjmp(int *jb, int val) __attribute__ ((noreturn)); extern void up_longjmp(int *jb, int val) noreturn_function;
/* up_devconsole.c ********************************************************/ /* up_devconsole.c ********************************************************/
+6 -4
View File
@@ -45,7 +45,9 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
@@ -323,7 +325,7 @@ struct gdt_entry_s
uint8_t access; /* Access flags, determine ring segment can be used in */ uint8_t access; /* Access flags, determine ring segment can be used in */
uint8_t granularity; uint8_t granularity;
uint8_t hibase; /* The last 8 bits of the base */ uint8_t hibase; /* The last 8 bits of the base */
} __attribute__((packed)); } packed_struct;
/* This structure refers to the array of GDT entries, and is in the format /* This structure refers to the array of GDT entries, and is in the format
* required by the lgdt instruction. * required by the lgdt instruction.
@@ -333,7 +335,7 @@ struct gdt_ptr_s
{ {
uint16_t limit; /* The upper 16 bits of all selector limits */ uint16_t limit; /* The upper 16 bits of all selector limits */
uint32_t base; /* The address of the first GDT entry */ uint32_t base; /* The address of the first GDT entry */
} __attribute__((packed)); } packed_struct;
/* IDT data structures ****************************************************** /* IDT data structures ******************************************************
* *
@@ -349,7 +351,7 @@ struct idt_entry_s
uint8_t zero; /* This must always be zero */ uint8_t zero; /* This must always be zero */
uint8_t flags; /* (See documentation) */ uint8_t flags; /* (See documentation) */
uint16_t hibase; /* Upper 16-bits of vector address for interrupt */ uint16_t hibase; /* Upper 16-bits of vector address for interrupt */
} __attribute__((packed)); } packed_struct;
/* A struct describing a pointer to an array of interrupt handlers. This is /* A struct describing a pointer to an array of interrupt handlers. This is
* in a format suitable for giving to 'lidt'. * in a format suitable for giving to 'lidt'.
@@ -359,7 +361,7 @@ struct idt_ptr_s
{ {
uint16_t limit; uint16_t limit;
uint32_t base; /* The address of the first GDT entry */ uint32_t base; /* The address of the first GDT entry */
} __attribute__((packed)); } packed_struct;
/**************************************************************************** /****************************************************************************
* Inline functions * Inline functions
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/x86/src/common/up_assert.c * arch/x86/src/common/up_assert.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -209,7 +209,7 @@ static void up_dumpstate(void)
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+4 -1
View File
@@ -40,7 +40,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
@@ -174,7 +177,7 @@ extern void up_irqinitialize(void);
extern void weak_function up_dmainitialize(void); extern void weak_function up_dmainitialize(void);
#endif #endif
extern int up_saveusercontext(uint32_t *saveregs); extern int up_saveusercontext(uint32_t *saveregs);
extern void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn)); extern void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
extern void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs); extern void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
extern void up_sigdeliver(void); extern void up_sigdeliver(void);
extern void up_lowputc(char ch); extern void up_lowputc(char ch);
+2 -1
View File
@@ -39,6 +39,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@@ -62,7 +63,7 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static void idt_outb(uint8_t val, uint16_t addr) __attribute__((noinline)); static void idt_outb(uint8_t val, uint16_t addr) noinline_function;
static void up_remappic(void); static void up_remappic(void);
static void up_idtentry(unsigned int index, uint32_t base, uint16_t sel, static void up_idtentry(unsigned int index, uint32_t base, uint16_t sel,
uint8_t flags); uint8_t flags);
@@ -1,7 +1,7 @@
/************************************************************************** /**************************************************************************
* arch/x86/src/qemu/qemu_fullcontextrestore.S * arch/x86/src/qemu/qemu_fullcontextrestore.S
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -89,7 +89,7 @@
* Name: up_fullcontextrestore * Name: up_fullcontextrestore
* *
* Full C prototype: * Full C prototype:
* void up_fullcontextrestore(uint32_t *regs) __attribute__ ((noreturn)); * void up_fullcontextrestore(uint32_t *regs) noreturn_function;
* *
**************************************************************************/ **************************************************************************/
+3 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/x86/src/qemu/qemu_handlers.c * arch/x86/src/qemu/qemu_handlers.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <arch/io.h> #include <arch/io.h>
@@ -52,7 +53,7 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static void idt_outb(uint8_t val, uint16_t addr) __attribute__((noinline)); static void idt_outb(uint8_t val, uint16_t addr) noinline_function;
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* common/up_assert.c * common/up_assert.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -77,7 +77,7 @@
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* common/up_assert.c * common/up_assert.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -77,7 +77,7 @@
* Name: _up_assert * Name: _up_assert
****************************************************************************/ ****************************************************************************/
static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ static void _up_assert(int errorcode) /* noreturn_function */
{ {
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
+69 -4
View File
@@ -36,19 +36,19 @@ config AT45DB_PWRSAVE
bool "enables power save" bool "enables power save"
default n default n
depends on MTD_AT45DB depends on MTD_AT45DB
config MTD_MP25P config MTD_MP25P
bool "SPI-based M25P1 falsh" bool "SPI-based M25P FLASH"
default n default n
select SPI select SPI
config MP25P_SPIMODE config MP25P_SPIMODE
int "mp25p spi mode" int "MP25P SPI mode"
default 0 default 0
depends on MTD_MP25P depends on MTD_MP25P
config MP25P_MANUFACTURER config MP25P_MANUFACTURER
hex "mp25p manufacturers ID" hex "MP25P manufacturers ID"
default 0x20 default 0x20
depends on MTD_MP25P depends on MTD_MP25P
---help--- ---help---
@@ -66,3 +66,68 @@ config MTD_RAMTRON
config MTD_RAM config MTD_RAM
bool "Memory bus ram" bool "Memory bus ram"
default n default n
config MTD_SST25
bool "SPI-based SST25 FLASH"
default n
select SPI
config SST25_SPIMODE
int "SST25 SPI Mode"
default 0
depends on MTD_SST25
config SST25_SPIFREQUENCY
int "SST25 SPI Frequency"
default 20000000
depends on MTD_SST25
config SST25_READONLY
bool "SST25 Read-Only FLASH"
default n
depends on MTD_SST25
config SST25_SECTOR512
bool "Simulate 512 byte Erase Blocks"
default n
depends on MTD_SST25
config SST25_SLOWWRITE
bool
default y
depends on MTD_SST25
config SST25_SLOWREAD
bool
default n
depends on MTD_SST25
config MTD_W25
bool "SPI-based W25 FLASH"
default n
select SPI
config W25_SPIMODE
int "W25 SPI Mode"
default 0
depends on MTD_W25
config W25_SPIFREQUENCY
int "W25 SPI Frequency"
default 20000000
depends on MTD_W25
config W25_READONLY
bool "W25 Read-Only FLASH"
default n
depends on MTD_W25
config W25_SECTOR512
bool "Simulate 512 byte Erase Blocks"
default n
depends on MTD_W25
config W25_SLOWREAD
bool
default n
depends on MTD_W25
+4
View File
@@ -47,6 +47,10 @@ ifeq ($(CONFIG_MTD_SST25),y)
CSRCS += sst25.c CSRCS += sst25.c
endif endif
ifeq ($(CONFIG_MTD_W25),y)
CSRCS += w25.c
endif
# Include MTD driver support # Include MTD driver support
DEPPATH += --dep-path mtd DEPPATH += --dep-path mtd
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -47,6 +47,7 @@
************************************************************************************/ ************************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h> #include <stdint.h>
@@ -78,7 +79,7 @@ struct adc_msg_s
{ {
uint8_t am_channel; /* The 8-bit ADC Channel */ uint8_t am_channel; /* The 8-bit ADC Channel */
int32_t am_data; /* ADC convert result (4 bytes) */ int32_t am_data; /* ADC convert result (4 bytes) */
} __attribute__((__packed__)); } packed_struct;
struct adc_fifo_s struct adc_fifo_s
{ {
+20 -4
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* include/nuttx/compiler.h * include/nuttx/compiler.h
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -92,6 +92,14 @@
# define reentrant_function # define reentrant_function
# define naked_function # define naked_function
/* The inline_function attribute informs GCC that the function should always
* be inlined, regardless of the level of optimization. The noinline_function
* indicates that the function should never be inlined.
*/
# define inline_function __attribute__ ((always_inline))
# define noinline_function __attribute__ ((noinline))
/* GCC has does not use storage classes to qualify addressing */ /* GCC has does not use storage classes to qualify addressing */
# define FAR # define FAR
@@ -224,10 +232,15 @@
# define noreturn_function # define noreturn_function
# define packed_struct # define packed_struct
/* SDCC does support "naked" function s*/ /* SDCC does support "naked" functions */
# define naked_function __naked # define naked_function __naked
/* SDCC does not support forced inlining. */
# define inline_function
# define noinline_function
/* The reentrant attribute informs SDCC that the function /* The reentrant attribute informs SDCC that the function
* must be reentrant. In this case, SDCC will store input * must be reentrant. In this case, SDCC will store input
* arguments on the stack to support reentrancy. * arguments on the stack to support reentrancy.
@@ -320,11 +333,13 @@
# define weak_function # define weak_function
# define weak_const_function # define weak_const_function
/* The Zilog compiler does not support the noreturn, packed, or naked attributes */ /* The Zilog compiler does not support the noreturn, packed, naked attributes */
# define noreturn_function # define noreturn_function
# define packed_struct # define packed_struct
# define naked_function # define naked_function
# define inline_function
# define noinline_function
/* The Zilog compiler does not support the reentrant attribute */ /* The Zilog compiler does not support the reentrant attribute */
@@ -406,7 +421,8 @@
# define packed_struct # define packed_struct
# define reentrant_function # define reentrant_function
# define naked_function # define naked_function
# define inline_function
# define noinline_function
# define FAR # define FAR
# define NEAR # define NEAR
+13
View File
@@ -220,6 +220,19 @@ EXTERN FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev);
EXTERN FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev); EXTERN FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev);
/****************************************************************************
* Name: w25_initialize
*
* Description:
* Create an initialized MTD device instance. MTD devices are not registered
* in the file system, but are created as instances that can be bound to
* other functions (such as a block or character driver front end).
*
****************************************************************************/
EXTERN FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *dev);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }