From 04270b5fc9db99aeb6be0ad00dab7d3245287c34 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 5 Mar 2014 14:25:49 -0600 Subject: [PATCH] Add configuration ettings for the on-demand paging option --- configs/ea3131/Kconfig | 28 +++++++++++++++- configs/ea3131/src/up_fillpage.c | 56 ++++++++++++++++---------------- configs/ea3152/Kconfig | 28 +++++++++++++++- configs/ea3152/src/up_fillpage.c | 56 ++++++++++++++++---------------- 4 files changed, 110 insertions(+), 58 deletions(-) diff --git a/configs/ea3131/Kconfig b/configs/ea3131/Kconfig index ee64802ddf..6db78472b1 100644 --- a/configs/ea3131/Kconfig +++ b/configs/ea3131/Kconfig @@ -4,4 +4,30 @@ # if ARCH_BOARD_EA3131 -endif + +if PAGING + +config EA3131_PAGING_MINOR + int "Page device minor number" + default 0 + +config EA3131_PAGING_MOUNTPT + string "Page device mount point" + default "/mnt/pgsrc" + +config EA3131_PAGING_BINOFFSET + int "Volume offset" + default 0 + +config EA3131_PAGING_SDSLOT + int "SD page device slot number" + default 0 + depends on MMCSD + +config EA3131_PAGING_SPIPORT + int "SD SPI port number" + default 0 + depends on SPI + +endif # PAGING +endif # ARCH_BOARD_EA3131 diff --git a/configs/ea3131/src/up_fillpage.c b/configs/ea3131/src/up_fillpage.c index 35ba206567..43660ad18d 100644 --- a/configs/ea3131/src/up_fillpage.c +++ b/configs/ea3131/src/up_fillpage.c @@ -53,7 +53,7 @@ # include # include # include -# ifdef CONFIG_PAGING_SDSLOT +# ifdef CONFIG_EA3131_PAGING_SDSLOT # include # include # include @@ -80,14 +80,14 @@ #ifdef CONFIG_ARCH_BOARD_EA3131 # define HAVE_SD 1 # define HAVE_SPINOR 1 -# if defined(CONFIG_PAGING_SDSLOT) && CONFIG_PAGING_SDSLOT != 0 +# if defined(CONFIG_EA3131_PAGING_SDSLOT) && CONFIG_EA3131_PAGING_SDSLOT != 0 # error "Only one SD slot" -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3131_PAGING_SDSLOT # endif #else /* Add configuration for new LPC31XX boards here */ # error "Unrecognized LPC31XX board" -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3131_PAGING_SDSLOT # undef HAVE_SD # undef HAVE_SPINOR #endif @@ -113,9 +113,9 @@ /* Can't support SD if the board does not support SD (duh) */ -# if defined(CONFIG_PAGING_SDSLOT) && !defined(HAVE_SD) +# if defined(CONFIG_EA3131_PAGING_SDSLOT) && !defined(HAVE_SD) # error "This board does not support SD" -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3131_PAGING_SDSLOT # endif /* Can't support SD if mountpoints are disabled or if SDIO support @@ -123,25 +123,25 @@ */ # if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI) -# ifdef CONFIG_PAGING_SDSLOT +# ifdef CONFIG_EA3131_PAGING_SDSLOT # error "Mountpoints and/or MCI disabled" # endif -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3131_PAGING_SDSLOT # undef HAVE_SD # endif /* A mountpoint for the FAT file system must be provided */ -# if !defined(CONFIG_PAGING_MOUNTPT) && defined(CONFIG_PAGING_SDSLOT) -# error "No CONFIG_PAGING_MOUNTPT provided" -# undef CONFIG_PAGING_SDSLOT +# if !defined(CONFIG_EA3131_PAGING_MOUNTPT) && defined(CONFIG_EA3131_PAGING_SDSLOT) +# error "No CONFIG_EA3131_PAGING_MOUNTPT provided" +# undef CONFIG_EA3131_PAGING_SDSLOT # undef HAVE_SD # endif /* If no minor number is provided, default to zero */ -# ifndef CONFIG_PAGING_MINOR -# define CONFIG_PAGING_MINOR 0 +# ifndef CONFIG_EA3131_PAGING_MINOR +# define CONFIG_EA3131_PAGING_MINOR 0 # endif #endif /* CONFIG_PAGING_BINPATH */ @@ -160,14 +160,14 @@ * of the NuttX binary image. */ -# ifndef CONFIG_PAGING_BINOFFSET -# define CONFIG_PAGING_BINOFFSET 0 +# ifndef CONFIG_EA3131_PAGING_BINOFFSET +# define CONFIG_EA3131_PAGING_BINOFFSET 0 # endif /* Make sure that some value is defined for the SPI port number */ -# ifndef CONFIG_PAGING_SPIPORT -# define CONFIG_PAGING_SPIPORT 0 +# ifndef CONFIG_EA3131_PAGING_SPIPORT +# define CONFIG_EA3131_PAGING_SPIPORT 0 # endif #endif @@ -232,7 +232,7 @@ static struct pg_source_s g_pgsrc; #if defined(CONFIG_PAGING_BINPATH) static inline void lpc31_initsrc(void) { -#ifdef CONFIG_PAGING_SDSLOT +#ifdef CONFIG_EA3131_PAGING_SDSLOT FAR struct sdio_dev_s *sdio; int ret; #endif @@ -241,7 +241,7 @@ static inline void lpc31_initsrc(void) if (!g_pgsrc.initialized) { -#ifdef CONFIG_PAGING_SDSLOT +#ifdef CONFIG_EA3131_PAGING_SDSLOT char devname[16]; #endif @@ -249,16 +249,16 @@ static inline void lpc31_initsrc(void) /* No, do we need to mount an SD device? */ -#ifdef CONFIG_PAGING_SDSLOT +#ifdef CONFIG_EA3131_PAGING_SDSLOT /* Yes.. First, get an instance of the SDIO interface */ - sdio = sdio_initialize(CONFIG_PAGING_SDSLOT); + sdio = sdio_initialize(CONFIG_EA3131_PAGING_SDSLOT); DEBUGASSERT(sdio != NULL); /* Then bind the SDIO interface to the SD driver */ - ret = mmcsd_slotinitialize(CONFIG_PAGING_MINOR, sdio); + ret = mmcsd_slotinitialize(CONFIG_EA3131_PAGING_MINOR, sdio); DEBUGASSERT(ret == OK); /* Then let's guess and say that there is a card in the slot. @@ -269,11 +269,11 @@ static inline void lpc31_initsrc(void) /* Now mount the file system */ - snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_PAGING_MINOR); - ret = mount(devname, CONFIG_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL); + snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3131_PAGING_MINOR); + ret = mount(devname, CONFIG_EA3131_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL); DEBUGASSERT(ret == OK); -#endif /* CONFIG_PAGING_SDSLOT */ +#endif /* CONFIG_EA3131_PAGING_SDSLOT */ /* Open the selected path for read-only access */ @@ -305,7 +305,7 @@ static inline void lpc31_initsrc(void) /* First get an instance of the SPI device interface */ - spi = up_spiinitialize(CONFIG_PAGING_SPIPORT); + spi = up_spiinitialize(CONFIG_EA3131_PAGING_SPIPORT); DEBUGASSERT(spi != NULL); /* Then bind the SPI interface to the MTD driver */ @@ -329,7 +329,7 @@ static inline void lpc31_initsrc(void) DEBUGASSERT(ret >= 0); capacity = g_pgsrc.geo.erasesize*g_pgsrc.geo.neraseblocks; pgllvdbg("capacity: %d\n", capacity); - DEBUGASSERT(capacity >= (CONFIG_PAGING_BINOFFSET + PG_TEXT_VSIZE)); + DEBUGASSERT(capacity >= (CONFIG_EA3131_PAGING_BINOFFSET + PG_TEXT_VSIZE)); #endif /* We are now initialized */ @@ -454,7 +454,7 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage) * virtual address. File offset 0 corresponds to PG_LOCKED_VBASE. */ - offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_PAGING_BINOFFSET; + offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_EA3131_PAGING_BINOFFSET; /* Read the page at the correct offset into the SPI FLASH device */ diff --git a/configs/ea3152/Kconfig b/configs/ea3152/Kconfig index c23751a3d2..38108f9240 100644 --- a/configs/ea3152/Kconfig +++ b/configs/ea3152/Kconfig @@ -4,4 +4,30 @@ # if ARCH_BOARD_EA3152 -endif + +if PAGING + +config EA3152_PAGING_MINOR + int "Page device minor number" + default 0 + +config EA3152_PAGING_MOUNTPT + string "Page device mount point" + default "/mnt/pgsrc" + +config EA3152_PAGING_BINOFFSET + int "Volume offset" + default 0 + +config EA3152_PAGING_SDSLOT + int "SD page device slot number" + default 0 + depends on MMCSD + +config EA3152_PAGING_SPIPORT + int "SD SPI port number" + default 0 + depends on SPI + +endif # PAGING +endif # ARCH_BOARD_EA3152 diff --git a/configs/ea3152/src/up_fillpage.c b/configs/ea3152/src/up_fillpage.c index 3b9f02a884..23a19b8496 100644 --- a/configs/ea3152/src/up_fillpage.c +++ b/configs/ea3152/src/up_fillpage.c @@ -53,7 +53,7 @@ # include # include # include -# ifdef CONFIG_PAGING_SDSLOT +# ifdef CONFIG_EA3152_PAGING_SDSLOT # include # include # include @@ -80,14 +80,14 @@ #ifdef CONFIG_ARCH_BOARD_EA3152 # define HAVE_SD 1 # define HAVE_SPINOR 1 -# if defined(CONFIG_PAGING_SDSLOT) && CONFIG_PAGING_SDSLOT != 0 +# if defined(CONFIG_EA3152_PAGING_SDSLOT) && CONFIG_EA3152_PAGING_SDSLOT != 0 # error "Only one SD slot" -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3152_PAGING_SDSLOT # endif #else /* Add configuration for new LPC31XX boards here */ # error "Unrecognized LPC31XX board" -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3152_PAGING_SDSLOT # undef HAVE_SD # undef HAVE_SPINOR #endif @@ -113,9 +113,9 @@ /* Can't support SD if the board does not support SD (duh) */ -# if defined(CONFIG_PAGING_SDSLOT) && !defined(HAVE_SD) +# if defined(CONFIG_EA3152_PAGING_SDSLOT) && !defined(HAVE_SD) # error "This board does not support SD" -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3152_PAGING_SDSLOT # endif /* Can't support SD if mountpoints are disabled or if SDIO support @@ -123,25 +123,25 @@ */ # if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI) -# ifdef CONFIG_PAGING_SDSLOT +# ifdef CONFIG_EA3152_PAGING_SDSLOT # error "Mountpoints and/or MCI disabled" # endif -# undef CONFIG_PAGING_SDSLOT +# undef CONFIG_EA3152_PAGING_SDSLOT # undef HAVE_SD # endif /* A mountpoint for the FAT file system must be provided */ -# if !defined(CONFIG_PAGING_MOUNTPT) && defined(CONFIG_PAGING_SDSLOT) -# error "No CONFIG_PAGING_MOUNTPT provided" -# undef CONFIG_PAGING_SDSLOT +# if !defined(CONFIG_EA3152_PAGING_MOUNTPT) && defined(CONFIG_EA3152_PAGING_SDSLOT) +# error "No CONFIG_EA3152_PAGING_MOUNTPT provided" +# undef CONFIG_EA3152_PAGING_SDSLOT # undef HAVE_SD # endif /* If no minor number is provided, default to zero */ -# ifndef CONFIG_PAGING_MINOR -# define CONFIG_PAGING_MINOR 0 +# ifndef CONFIG_EA3152_PAGING_MINOR +# define CONFIG_EA3152_PAGING_MINOR 0 # endif #endif /* CONFIG_PAGING_BINPATH */ @@ -160,14 +160,14 @@ * of the NuttX binary image. */ -# ifndef CONFIG_PAGING_BINOFFSET -# define CONFIG_PAGING_BINOFFSET 0 +# ifndef CONFIG_EA3152_PAGING_BINOFFSET +# define CONFIG_EA3152_PAGING_BINOFFSET 0 # endif /* Make sure that some value is defined for the SPI port number */ -# ifndef CONFIG_PAGING_SPIPORT -# define CONFIG_PAGING_SPIPORT 0 +# ifndef CONFIG_EA3152_PAGING_SPIPORT +# define CONFIG_EA3152_PAGING_SPIPORT 0 # endif #endif @@ -232,7 +232,7 @@ static struct pg_source_s g_pgsrc; #if defined(CONFIG_PAGING_BINPATH) static inline void lpc31_initsrc(void) { -#ifdef CONFIG_PAGING_SDSLOT +#ifdef CONFIG_EA3152_PAGING_SDSLOT FAR struct sdio_dev_s *sdio; int ret; #endif @@ -241,7 +241,7 @@ static inline void lpc31_initsrc(void) if (!g_pgsrc.initialized) { -#ifdef CONFIG_PAGING_SDSLOT +#ifdef CONFIG_EA3152_PAGING_SDSLOT char devname[16]; #endif @@ -249,16 +249,16 @@ static inline void lpc31_initsrc(void) /* No, do we need to mount an SD device? */ -#ifdef CONFIG_PAGING_SDSLOT +#ifdef CONFIG_EA3152_PAGING_SDSLOT /* Yes.. First, get an instance of the SDIO interface */ - sdio = sdio_initialize(CONFIG_PAGING_SDSLOT); + sdio = sdio_initialize(CONFIG_EA3152_PAGING_SDSLOT); DEBUGASSERT(sdio != NULL); /* Then bind the SDIO interface to the SD driver */ - ret = mmcsd_slotinitialize(CONFIG_PAGING_MINOR, sdio); + ret = mmcsd_slotinitialize(CONFIG_EA3152_PAGING_MINOR, sdio); DEBUGASSERT(ret == OK); /* Then let's guess and say that there is a card in the slot. @@ -269,11 +269,11 @@ static inline void lpc31_initsrc(void) /* Now mount the file system */ - snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_PAGING_MINOR); - ret = mount(devname, CONFIG_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL); + snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3152_PAGING_MINOR); + ret = mount(devname, CONFIG_EA3152_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL); DEBUGASSERT(ret == OK); -#endif /* CONFIG_PAGING_SDSLOT */ +#endif /* CONFIG_EA3152_PAGING_SDSLOT */ /* Open the selected path for read-only access */ @@ -305,7 +305,7 @@ static inline void lpc31_initsrc(void) /* First get an instance of the SPI device interface */ - spi = up_spiinitialize(CONFIG_PAGING_SPIPORT); + spi = up_spiinitialize(CONFIG_EA3152_PAGING_SPIPORT); DEBUGASSERT(spi != NULL); /* Then bind the SPI interface to the MTD driver */ @@ -329,7 +329,7 @@ static inline void lpc31_initsrc(void) DEBUGASSERT(ret >= 0); capacity = g_pgsrc.geo.erasesize*g_pgsrc.geo.neraseblocks; pgllvdbg("capacity: %d\n", capacity); - DEBUGASSERT(capacity >= (CONFIG_PAGING_BINOFFSET + PG_TEXT_VSIZE)); + DEBUGASSERT(capacity >= (CONFIG_EA3152_PAGING_BINOFFSET + PG_TEXT_VSIZE)); #endif /* We are now initialized */ @@ -454,7 +454,7 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage) * virtual address. File offset 0 corresponds to PG_LOCKED_VBASE. */ - offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_PAGING_BINOFFSET; + offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_EA3152_PAGING_BINOFFSET; /* Read the page at the correct offset into the SPI FLASH device */