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

View File

@ -3361,3 +3361,10 @@
way it was. The really interrupt related problem was in stm32_spi.c:
When SPI3 is not enabled, then the irqrestore() falls in the
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).

View File

@ -1,7 +1,7 @@
/************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -65,7 +65,7 @@
* 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? */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -48,6 +48,7 @@
#include <nuttx/irq.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h>
#endif
@ -131,7 +132,7 @@ struct xcptcontext
/* Disable IRQs */
static inline void irqdisable(void) __attribute__((always_inline));
static inline void irqdisable(void) inline_function;
static inline void irqdisable(void)
{
__asm__ __volatile__ ("\tcpsid i\n");
@ -139,7 +140,7 @@ static inline void irqdisable(void)
/* 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)
{
unsigned short primask;
@ -161,7 +162,7 @@ static inline irqstate_t irqsave(void)
/* Enable IRQs */
static inline void irqenable(void) __attribute__((always_inline));
static inline void irqenable(void) inline_function;
static inline void irqenable(void)
{
__asm__ __volatile__ ("\tcpsie i\n");
@ -169,7 +170,7 @@ static inline void irqenable(void)
/* 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)
{
/* 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 */
static inline uint8_t getprimask(void) __attribute__((always_inline));
static inline uint8_t getprimask(void) inline_function;
static inline uint8_t getprimask(void)
{
uint32_t primask;
@ -203,7 +204,7 @@ static inline uint8_t getprimask(void)
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)
{
__asm__ __volatile__
@ -216,7 +217,7 @@ static inline void setprimask(uint32_t primask)
/* 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)
{
uint32_t basepri;
@ -231,7 +232,7 @@ static inline uint8_t getbasepri(void)
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)
{
__asm__ __volatile__
@ -244,7 +245,7 @@ static inline void setbasepri(uint32_t basepri)
/* 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)
{
uint32_t ipsr;
@ -258,7 +259,7 @@ static inline uint32_t getipsr(void)
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)
{
__asm__ __volatile__
@ -271,7 +272,7 @@ static inline void setipsr(uint32_t ipsr)
/* 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)
{
uint32_t control;
@ -285,7 +286,7 @@ static inline uint32_t getcontrol(void)
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)
{
__asm__ __volatile__

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -252,7 +252,7 @@ static void up_dumpstate(void)
* 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? */

View File

@ -74,7 +74,7 @@
/* SYS call 1:
*
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn));
* void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
*/
#define SYS_restore_context (1)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -262,7 +262,7 @@ static void up_dumpstate(void)
* 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? */

View File

@ -69,7 +69,7 @@
* Description:
* 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:
* None

View File

@ -280,7 +280,7 @@ int up_svcall(int irq, FAR void *context)
/* 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:
*

View File

@ -40,7 +40,10 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <sys/types.h>
# include <stdint.h>
#endif
@ -223,7 +226,7 @@ extern void up_boot(void);
extern void up_copystate(uint32_t *dest, uint32_t *src);
extern void up_decodeirq(uint32_t *regs);
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);
/* Signal handling **********************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -40,7 +40,10 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <sys/types.h>
# include <stdint.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

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -40,7 +40,10 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h>
#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

View File

@ -90,7 +90,7 @@
* 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? */

View File

@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h>
#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_irqinitialize(void);
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);
/* Interrupt handling */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -247,7 +247,7 @@ static void up_dumpstate(void)
* 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? */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -150,7 +150,7 @@
/* SYS call 1:
*
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn));
* void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
*/
#define SYS_restore_context (1)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -90,7 +90,7 @@
* 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? */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* 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:
*
* 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:
*

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -76,7 +76,7 @@
* 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? */

View File

@ -40,7 +40,10 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h>
#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_decodeirq(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_prefetchabort(uint32_t *regs);
extern int up_saveusercontext(uint32_t *regs);

View File

@ -41,6 +41,7 @@
**************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <nuttx/irq.h>
@ -150,7 +151,7 @@ extern volatile int g_eventloop;
/* up_setjmp.S ************************************************************/
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 ********************************************************/

View File

@ -45,7 +45,9 @@
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h>
#endif
@ -323,7 +325,7 @@ struct gdt_entry_s
uint8_t access; /* Access flags, determine ring segment can be used in */
uint8_t granularity;
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
* required by the lgdt instruction.
@ -333,7 +335,7 @@ struct gdt_ptr_s
{
uint16_t limit; /* The upper 16 bits of all selector limits */
uint32_t base; /* The address of the first GDT entry */
} __attribute__((packed));
} packed_struct;
/* IDT data structures ******************************************************
*
@ -349,7 +351,7 @@ struct idt_entry_s
uint8_t zero; /* This must always be zero */
uint8_t flags; /* (See documentation) */
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
* in a format suitable for giving to 'lidt'.
@ -359,7 +361,7 @@ struct idt_ptr_s
{
uint16_t limit;
uint32_t base; /* The address of the first GDT entry */
} __attribute__((packed));
} packed_struct;
/****************************************************************************
* Inline functions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -209,7 +209,7 @@ static void up_dumpstate(void)
* 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? */

View File

@ -40,7 +40,10 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/compiler.h>
# include <stdint.h>
#endif
@ -174,7 +177,7 @@ extern void up_irqinitialize(void);
extern void weak_function up_dmainitialize(void);
#endif
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_sigdeliver(void);
extern void up_lowputc(char ch);

View File

@ -39,6 +39,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
#include <string.h>
@ -62,7 +63,7 @@
* 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_idtentry(unsigned int index, uint32_t base, uint16_t sel,
uint8_t flags);

View File

@ -1,7 +1,7 @@
/**************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -89,7 +89,7 @@
* Name: up_fullcontextrestore
*
* Full C prototype:
* void up_fullcontextrestore(uint32_t *regs) __attribute__ ((noreturn));
* void up_fullcontextrestore(uint32_t *regs) noreturn_function;
*
**************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -38,6 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <nuttx/arch.h>
#include <arch/io.h>
@ -52,7 +53,7 @@
* 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

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -77,7 +77,7 @@
* 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? */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -77,7 +77,7 @@
* 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? */

View File

@ -36,19 +36,19 @@ config AT45DB_PWRSAVE
bool "enables power save"
default n
depends on MTD_AT45DB
config MTD_MP25P
bool "SPI-based M25P1 falsh"
bool "SPI-based M25P FLASH"
default n
select SPI
config MP25P_SPIMODE
int "mp25p spi mode"
int "MP25P SPI mode"
default 0
depends on MTD_MP25P
config MP25P_MANUFACTURER
hex "mp25p manufacturers ID"
hex "MP25P manufacturers ID"
default 0x20
depends on MTD_MP25P
---help---
@ -66,3 +66,68 @@ config MTD_RAMTRON
config MTD_RAM
bool "Memory bus ram"
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

View File

@ -47,6 +47,10 @@ ifeq ($(CONFIG_MTD_SST25),y)
CSRCS += sst25.c
endif
ifeq ($(CONFIG_MTD_W25),y)
CSRCS += w25.c
endif
# Include MTD driver support
DEPPATH += --dep-path mtd

1188
nuttx/drivers/mtd/w25.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,7 @@
************************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <stdint.h>
@ -78,7 +79,7 @@ struct adc_msg_s
{
uint8_t am_channel; /* The 8-bit ADC Channel */
int32_t am_data; /* ADC convert result (4 bytes) */
} __attribute__((__packed__));
} packed_struct;
struct adc_fifo_s
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -92,6 +92,14 @@
# define reentrant_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 */
# define FAR
@ -224,10 +232,15 @@
# define noreturn_function
# define packed_struct
/* SDCC does support "naked" function s*/
/* SDCC does support "naked" functions */
# define naked_function __naked
/* SDCC does not support forced inlining. */
# define inline_function
# define noinline_function
/* The reentrant attribute informs SDCC that the function
* must be reentrant. In this case, SDCC will store input
* arguments on the stack to support reentrancy.
@ -320,11 +333,13 @@
# define weak_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 packed_struct
# define naked_function
# define inline_function
# define noinline_function
/* The Zilog compiler does not support the reentrant attribute */
@ -406,7 +421,8 @@
# define packed_struct
# define reentrant_function
# define naked_function
# define inline_function
# define noinline_function
# define FAR
# define NEAR

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);
/****************************************************************************
* 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
#ifdef __cplusplus
}