mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-07-06 20:00:45 +08:00
Delete the apps/vsn directory (moved commands to apps/system)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5208 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
5aff42304b
commit
2bb1ecab3c
@ -350,3 +350,6 @@
|
|||||||
feature of the NxWidgets/NxWM unit tests.
|
feature of the NxWidgets/NxWM unit tests.
|
||||||
|
|
||||||
6.23 2012-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
6.23 2012-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
|
||||||
|
* vsn: Moved all NSH commands from vsn/ to system/. Deleted the vsn/
|
||||||
|
directory.
|
||||||
|
4
Kconfig
4
Kconfig
@ -34,7 +34,3 @@ endmenu
|
|||||||
menu "System NSH Add-Ons"
|
menu "System NSH Add-Ons"
|
||||||
source "$APPSDIR/system/Kconfig"
|
source "$APPSDIR/system/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "VSN board Add-Ons"
|
|
||||||
source "$APPSDIR/vsn/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
3
Makefile
3
Makefile
@ -49,7 +49,7 @@ APPDIR = ${shell pwd}
|
|||||||
# list can be extended by the .config file as well
|
# list can be extended by the .config file as well
|
||||||
|
|
||||||
CONFIGURED_APPS =
|
CONFIGURED_APPS =
|
||||||
SUBDIRS = examples graphics interpreters modbus namedapp nshlib netutils system vsn
|
SUBDIRS = examples graphics interpreters modbus namedapp nshlib netutils system
|
||||||
|
|
||||||
# There are two different mechanisms for obtaining the list of configured
|
# There are two different mechanisms for obtaining the list of configured
|
||||||
# directories:
|
# directories:
|
||||||
@ -78,7 +78,6 @@ include namedapp/Make.defs
|
|||||||
include netutils/Make.defs
|
include netutils/Make.defs
|
||||||
include nshlib/Make.defs
|
include nshlib/Make.defs
|
||||||
include system/Make.defs
|
include system/Make.defs
|
||||||
include vsn/Make.defs
|
|
||||||
|
|
||||||
# INSTALLED_APPS is the list of currently available application directories. It
|
# INSTALLED_APPS is the list of currently available application directories. It
|
||||||
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent
|
# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent
|
||||||
|
@ -107,7 +107,7 @@ NuttX is configured. .config is included in the toplevel apps/Makefile.
|
|||||||
As a minimum, this configuration file must define files to add to the
|
As a minimum, this configuration file must define files to add to the
|
||||||
CONFIGURED_APPS list like:
|
CONFIGURED_APPS list like:
|
||||||
|
|
||||||
CONFIGURED_APPS += examples/hello vsn/poweroff
|
CONFIGURED_APPS += examples/hello system/poweroff
|
||||||
|
|
||||||
Named Start-Up main() function
|
Named Start-Up main() function
|
||||||
------------------------------
|
------------------------------
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
menu "Custom free memory command"
|
menu "Custom Free Memory Command"
|
||||||
source "$APPSDIR/system/free/Kconfig"
|
source "$APPSDIR/system/free/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
@ -15,6 +15,22 @@ menu "FLASH Program Installation"
|
|||||||
source "$APPSDIR/system/install/Kconfig"
|
source "$APPSDIR/system/install/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "readline() support"
|
menu "readline()"
|
||||||
source "$APPSDIR/system/readline/Kconfig"
|
source "$APPSDIR/system/readline/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
menu "Power Off"
|
||||||
|
source "$APPSDIR/system/poweroff/Kconfig"
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
menu "RAMTRON"
|
||||||
|
source "$APPSDIR/system/ramtron/Kconfig"
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
menu "SD Card"
|
||||||
|
source "$APPSDIR/system/sdcard/Kconfig"
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
menu "Sysinfo"
|
||||||
|
source "$APPSDIR/system/sysinfo/Kconfig"
|
||||||
|
endmenu
|
||||||
|
@ -49,3 +49,20 @@ endif
|
|||||||
ifeq ($(CONFIG_SYSTEM_READLINE),y)
|
ifeq ($(CONFIG_SYSTEM_READLINE),y)
|
||||||
CONFIGURED_APPS += system/readline
|
CONFIGURED_APPS += system/readline
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SYSTEM_POWEROFF),y)
|
||||||
|
CONFIGURED_APPS += system/poweroff
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SYSTEM_RAMTRON),y)
|
||||||
|
CONFIGURED_APPS += system/ramtron
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SYSTEM_SDCARD),y)
|
||||||
|
CONFIGURED_APPS += system/sdcard
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SYSTEM_SYSINFO),y)
|
||||||
|
CONFIGURED_APPS += system/sysinfo
|
||||||
|
endif
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
# Sub-directories containing system task
|
# Sub-directories containing system task
|
||||||
|
|
||||||
SUBDIRS = free i2c install readline
|
SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo
|
||||||
|
|
||||||
# Create the list of installed runtime modules (INSTALLED_DIRS)
|
# Create the list of installed runtime modules (INSTALLED_DIRS)
|
||||||
|
|
||||||
|
@ -33,20 +33,23 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/progmem.h>
|
#include <nuttx/progmem.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* \todo Max block size only works on uniform prog mem */
|
/* TODO Max block size only works on uniform prog mem */
|
||||||
|
|
||||||
void free_getprogmeminfo(struct mallinfo * mem)
|
static void free_getprogmeminfo(struct mallinfo * mem)
|
||||||
{
|
{
|
||||||
uint16_t page = 0, stpage = 0xFFFF;
|
uint16_t page = 0, stpage = 0xFFFF;
|
||||||
uint16_t pagesize = 0;
|
uint16_t pagesize = 0;
|
||||||
@ -57,25 +60,31 @@ void free_getprogmeminfo(struct mallinfo * mem)
|
|||||||
mem->uordblks = 0;
|
mem->uordblks = 0;
|
||||||
mem->mxordblk = 0;
|
mem->mxordblk = 0;
|
||||||
|
|
||||||
for (status=0, page=0; status >= 0; page++) {
|
for (status=0, page=0; status >= 0; page++)
|
||||||
|
{
|
||||||
status = up_progmem_ispageerased(page);
|
status = up_progmem_ispageerased(page);
|
||||||
pagesize = up_progmem_pagesize(page);
|
pagesize = up_progmem_pagesize(page);
|
||||||
|
|
||||||
mem->arena += pagesize;
|
mem->arena += pagesize;
|
||||||
|
|
||||||
/* Is this beginning of new free space section */
|
/* Is this beginning of new free space section */
|
||||||
if (status == 0) {
|
|
||||||
|
if (status == 0)
|
||||||
|
{
|
||||||
if (stpage == 0xFFFF) stpage = page;
|
if (stpage == 0xFFFF) stpage = page;
|
||||||
mem->fordblks += pagesize;
|
mem->fordblks += pagesize;
|
||||||
}
|
}
|
||||||
else if (status != 0) {
|
else if (status != 0)
|
||||||
|
{
|
||||||
mem->uordblks += pagesize;
|
mem->uordblks += pagesize;
|
||||||
|
|
||||||
if (stpage != 0xFFFF && up_progmem_isuniform()) {
|
if (stpage != 0xFFFF && up_progmem_isuniform())
|
||||||
|
{
|
||||||
stpage = page - stpage;
|
stpage = page - stpage;
|
||||||
if (stpage > mem->mxordblk)
|
if (stpage > mem->mxordblk)
|
||||||
|
{
|
||||||
mem->mxordblk = stpage;
|
mem->mxordblk = stpage;
|
||||||
|
}
|
||||||
stpage = 0xFFFF;
|
stpage = 0xFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +93,6 @@ void free_getprogmeminfo(struct mallinfo * mem)
|
|||||||
mem->mxordblk *= pagesize;
|
mem->mxordblk *= pagesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/progmem.h>
|
#include <nuttx/progmem.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -43,9 +47,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define ACTION_INSTALL 0x01
|
#define ACTION_INSTALL 0x01
|
||||||
@ -55,12 +58,11 @@
|
|||||||
|
|
||||||
#define INSTALL_PROGRAMBLOCKSIZE 1024
|
#define INSTALL_PROGRAMBLOCKSIZE 1024
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private data
|
* Private data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
const char *install_help =
|
static const char *install_help =
|
||||||
"Installs XIP program into flash and creates a start-up script in the\n"
|
"Installs XIP program into flash and creates a start-up script in the\n"
|
||||||
"destination directory.\n\n"
|
"destination directory.\n\n"
|
||||||
"Usage:\t%s [options] source-file.xip destination-directory\n\n"
|
"Usage:\t%s [options] source-file.xip destination-directory\n\n"
|
||||||
@ -73,60 +75,68 @@ const char *install_help =
|
|||||||
"\t--start <page>\t\tInstalls application at or after <page>\n"
|
"\t--start <page>\t\tInstalls application at or after <page>\n"
|
||||||
"\t--margin <pages>\tLeave some free space after the kernel (default 16)\n";
|
"\t--margin <pages>\tLeave some free space after the kernel (default 16)\n";
|
||||||
|
|
||||||
const char *install_script_text =
|
static const char *install_script_text =
|
||||||
"# XIP stacksize=%x priority=%x size=%x\n";
|
"# XIP stacksize=%x priority=%x size=%x\n";
|
||||||
|
|
||||||
const char *install_script_exec =
|
static const char *install_script_exec =
|
||||||
"exec 0x%x\n";
|
"exec 0x%x\n";
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private functions
|
* Private functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int install_getstartpage(int startpage, int pagemargin, int desiredsize)
|
static int install_getstartpage(int startpage, int pagemargin, int desiredsize)
|
||||||
{
|
{
|
||||||
uint16_t page = 0, stpage = 0xFFFF;
|
uint16_t page = 0, stpage = 0xffff;
|
||||||
uint16_t pagesize = 0;
|
uint16_t pagesize = 0;
|
||||||
int maxlen = -1;
|
int maxlen = -1;
|
||||||
int maxlen_start = 0xFFFF;
|
int maxlen_start = 0xffff;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
for (status=0, page=0; status >= 0; page++) {
|
for (status=0, page=0; status >= 0; page++)
|
||||||
|
{
|
||||||
status = up_progmem_ispageerased(page);
|
status = up_progmem_ispageerased(page);
|
||||||
pagesize = up_progmem_pagesize(page);
|
pagesize = up_progmem_pagesize(page);
|
||||||
|
|
||||||
/* Is this beginning of new free space section */
|
/* Is this beginning of new free space section */
|
||||||
if (status == 0) {
|
|
||||||
if (stpage == 0xFFFF) stpage = page;
|
if (status == 0)
|
||||||
|
{
|
||||||
|
if (stpage == 0xffff) stpage = page;
|
||||||
}
|
}
|
||||||
else if (status != 0) {
|
else if (status != 0)
|
||||||
|
{
|
||||||
|
if (stpage != 0xffff)
|
||||||
|
{
|
||||||
|
if ((page - stpage) > maxlen)
|
||||||
|
{
|
||||||
|
if (maxlen==-1)
|
||||||
|
{
|
||||||
|
/* First time found sth? */
|
||||||
|
|
||||||
if (stpage != 0xFFFF) {
|
|
||||||
|
|
||||||
if ( (page - stpage) > maxlen) {
|
|
||||||
|
|
||||||
if (maxlen==-1) { /* First time found sth? */
|
|
||||||
stpage += pagemargin;
|
stpage += pagemargin;
|
||||||
maxlen = 0;
|
maxlen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stpage < startpage)
|
if(stpage < startpage)
|
||||||
|
{
|
||||||
stpage = startpage;
|
stpage = startpage;
|
||||||
|
}
|
||||||
|
|
||||||
if (page > stpage) {
|
if (page > stpage)
|
||||||
|
{
|
||||||
maxlen = page - stpage;
|
maxlen = page - stpage;
|
||||||
maxlen_start = stpage;
|
maxlen_start = stpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxlen*pagesize >= desiredsize) {
|
if (maxlen*pagesize >= desiredsize)
|
||||||
|
{
|
||||||
/* printf("Found page at %d ... %d\n", stpage, page); */
|
/* printf("Found page at %d ... %d\n", stpage, page); */
|
||||||
return maxlen_start*pagesize;
|
return maxlen_start*pagesize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stpage = 0xFFFF;
|
stpage = 0xffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,8 +146,7 @@ int install_getstartpage(int startpage, int pagemargin, int desiredsize)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int install_programflash(int startaddr, const char *source)
|
||||||
int install_programflash(int startaddr, const char *source)
|
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int count;
|
int count;
|
||||||
@ -146,13 +155,18 @@ int install_programflash(int startaddr, const char *source)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if ((buf = malloc(INSTALL_PROGRAMBLOCKSIZE)) == NULL)
|
if ((buf = malloc(INSTALL_PROGRAMBLOCKSIZE)) == NULL)
|
||||||
return -errno;
|
{
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
if ( (fp=fopen(source, "r")) ) {
|
if ((fp = fopen(source, "r")))
|
||||||
do {
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
count = fread(buf, 1, INSTALL_PROGRAMBLOCKSIZE, fp);
|
count = fread(buf, 1, INSTALL_PROGRAMBLOCKSIZE, fp);
|
||||||
|
|
||||||
if ( (status = up_progmem_write(startaddr, buf, count)) < 0) {
|
if ((status = up_progmem_write(startaddr, buf, count)) < 0)
|
||||||
|
{
|
||||||
totalsize = status;
|
totalsize = status;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -162,7 +176,10 @@ int install_programflash(int startaddr, const char *source)
|
|||||||
}
|
}
|
||||||
while(count);
|
while(count);
|
||||||
}
|
}
|
||||||
else totalsize = -errno;
|
else
|
||||||
|
{
|
||||||
|
totalsize = -errno;
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(buf);
|
free(buf);
|
||||||
@ -170,50 +187,54 @@ int install_programflash(int startaddr, const char *source)
|
|||||||
return totalsize;
|
return totalsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void install_getscriptname(char *scriptname, const char *progname, const char *destdir)
|
||||||
void install_getscriptname(char *scriptname, const char *progname, const char *destdir)
|
|
||||||
{
|
{
|
||||||
const char * progonly;
|
const char * progonly;
|
||||||
|
|
||||||
/* I.e. as /usr/bin */
|
/* I.e. as /usr/bin */
|
||||||
|
|
||||||
strcpy(scriptname, destdir);
|
strcpy(scriptname, destdir);
|
||||||
|
|
||||||
/* extract from i.e. /sdcard/demo -> /demo, together with / */
|
/* extract from i.e. /sdcard/demo -> /demo, together with / */
|
||||||
|
|
||||||
progonly = strrchr(progname, '/');
|
progonly = strrchr(progname, '/');
|
||||||
strcat(scriptname, progonly);
|
strcat(scriptname, progonly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int install_getprogsize(const char *progname)
|
||||||
int install_getprogsize(const char *progname)
|
|
||||||
{
|
{
|
||||||
struct stat fileinfo;
|
struct stat fileinfo;
|
||||||
|
|
||||||
if (stat(progname, &fileinfo) < 0)
|
if (stat(progname, &fileinfo) < 0)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return fileinfo.st_size;
|
return fileinfo.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int install_alreadyexists(const char *scriptname)
|
||||||
int install_alreadyexists(const char *scriptname)
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if ((fp = fopen(scriptname, "r")) == NULL)
|
if ((fp = fopen(scriptname, "r")) == NULL)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int install_createscript(int addr, int stacksize, int progsize,
|
||||||
int install_createscript(int addr, int stacksize, int progsize,
|
|
||||||
int priority, const char *scriptname)
|
int priority, const char *scriptname)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if ((fp = fopen(scriptname, "w+")) == NULL)
|
if ((fp = fopen(scriptname, "w+")) == NULL)
|
||||||
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(fp, install_script_text, stacksize, priority, progsize);
|
fprintf(fp, install_script_text, stacksize, priority, progsize);
|
||||||
fprintf(fp, install_script_exec, addr);
|
fprintf(fp, install_script_exec, addr);
|
||||||
@ -224,22 +245,23 @@ int install_createscript(int addr, int stacksize, int progsize,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int install_getlasthexvalue(FILE *fp, char delimiter)
|
||||||
int install_getlasthexvalue(FILE *fp, char delimiter)
|
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (fgets(buf, 127, fp)) {
|
if (fgets(buf, 127, fp))
|
||||||
if ( (p = strrchr(buf, delimiter)) ) {
|
{
|
||||||
|
if ((p = strrchr(buf, delimiter)))
|
||||||
|
{
|
||||||
return strtol(p+1, NULL, 16);
|
return strtol(p+1, NULL, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int install_remove(const char *scriptname)
|
||||||
int install_remove(const char *scriptname)
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int progsize, addr, freedsize;
|
int progsize, addr, freedsize;
|
||||||
@ -248,27 +270,36 @@ int install_remove(const char *scriptname)
|
|||||||
|
|
||||||
/* Parse script */
|
/* Parse script */
|
||||||
|
|
||||||
if ( (fp=fopen(scriptname, "r")) ) {
|
if ((fp = fopen(scriptname, "r")))
|
||||||
|
{
|
||||||
progsize = install_getlasthexvalue(fp,'=');
|
progsize = install_getlasthexvalue(fp,'=');
|
||||||
addr = install_getlasthexvalue(fp,' ');
|
addr = install_getlasthexvalue(fp,' ');
|
||||||
freedsize = progsize;
|
freedsize = progsize;
|
||||||
}
|
}
|
||||||
else return -errno;
|
else
|
||||||
|
{
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* Remove pages */
|
/* Remove pages */
|
||||||
|
|
||||||
if (progsize <= 0 || addr <= 0)
|
if (progsize <= 0 || addr <= 0)
|
||||||
|
{
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do
|
||||||
if ((page = up_progmem_getpage(addr)) < 0) {
|
{
|
||||||
|
if ((page = up_progmem_getpage(addr)) < 0)
|
||||||
|
{
|
||||||
status = -page;
|
status = -page;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( up_progmem_erasepage(page) < 0) {
|
if (up_progmem_erasepage(page) < 0)
|
||||||
|
{
|
||||||
status = -page;
|
status = -page;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -276,20 +307,27 @@ int install_remove(const char *scriptname)
|
|||||||
addr += up_progmem_pagesize(page);
|
addr += up_progmem_pagesize(page);
|
||||||
progsize -= up_progmem_pagesize(page);
|
progsize -= up_progmem_pagesize(page);
|
||||||
|
|
||||||
} while(progsize > 0);
|
}
|
||||||
|
while(progsize > 0);
|
||||||
|
|
||||||
if (status < 0) return status;
|
if (status < 0)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove script file */
|
/* Remove script file */
|
||||||
|
|
||||||
if (unlink(scriptname) < 0) return -errno;
|
if (unlink(scriptname) < 0)
|
||||||
|
{
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
return freedsize;
|
return freedsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Start
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int install_main(int argc, char *argv[])
|
int install_main(int argc, char *argv[])
|
||||||
@ -307,73 +345,91 @@ int install_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Supported? */
|
/* Supported? */
|
||||||
|
|
||||||
if ( !up_progmem_isuniform() ) {
|
if (!up_progmem_isuniform())
|
||||||
|
{
|
||||||
fprintf(stderr, "Error: install supports uniform organization only.\n");
|
fprintf(stderr, "Error: install supports uniform organization only.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse arguments */
|
/* Parse arguments */
|
||||||
|
|
||||||
for (i=1; i<argc; i++) {
|
for (i=1; i<argc; i++)
|
||||||
if (argv[i][0]=='-' && argv[i][1]=='-' && i<=argc) {
|
{
|
||||||
|
if (argv[i][0]=='-' && argv[i][1]=='-' && i<=argc)
|
||||||
if (strcmp(argv[i]+2, "stack")==0) {
|
{
|
||||||
|
if (strcmp(argv[i]+2, "stack")==0)
|
||||||
|
{
|
||||||
stacksize = atoi(argv[++i]);
|
stacksize = atoi(argv[++i]);
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i]+2, "priority")==0) {
|
else if (strcmp(argv[i]+2, "priority")==0)
|
||||||
|
{
|
||||||
priority = atoi(argv[++i]);
|
priority = atoi(argv[++i]);
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i]+2, "start")==0) {
|
else if (strcmp(argv[i]+2, "start")==0)
|
||||||
|
{
|
||||||
startpage = atoi(argv[++i]);
|
startpage = atoi(argv[++i]);
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i]+2, "margin")==0) {
|
else if (strcmp(argv[i]+2, "margin")==0)
|
||||||
|
{
|
||||||
pagemargin = atoi(argv[++i]);
|
pagemargin = atoi(argv[++i]);
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i]+2, "remove")==0) {
|
else if (strcmp(argv[i]+2, "remove")==0)
|
||||||
|
{
|
||||||
action = ACTION_REMOVE;
|
action = ACTION_REMOVE;
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i]+2, "force")==0) {
|
else if (strcmp(argv[i]+2, "force")==0)
|
||||||
|
{
|
||||||
action = ACTION_REINSTALL;
|
action = ACTION_REINSTALL;
|
||||||
}
|
}
|
||||||
else fprintf(stderr, "Unknown option: %s\n", argv[i]);
|
else fprintf(stderr, "Unknown option: %s\n", argv[i]);
|
||||||
}
|
}
|
||||||
else break;
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the job */
|
/* Do the job */
|
||||||
|
|
||||||
switch(action & 1) {
|
switch(action & 1)
|
||||||
|
{
|
||||||
case ACTION_REMOVE:
|
case ACTION_REMOVE:
|
||||||
if (i > argc-1) {
|
if (i > argc-1)
|
||||||
|
{
|
||||||
action = ACTION_INSUFPARAM;
|
action = ACTION_INSUFPARAM;
|
||||||
break; /* are there sufficient parameters */
|
break; /* are there sufficient parameters */
|
||||||
}
|
}
|
||||||
if ( (scrsta=install_remove(argv[i])) < 0) {
|
|
||||||
|
if ((scrsta=install_remove(argv[i])) < 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "Could not remove program: %s\n", strerror(-scrsta));
|
fprintf(stderr, "Could not remove program: %s\n", strerror(-scrsta));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Removed %s and freed %d bytes\n", argv[i], scrsta);
|
printf("Removed %s and freed %d bytes\n", argv[i], scrsta);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
case ACTION_INSTALL:
|
case ACTION_INSTALL:
|
||||||
if (i > argc-2) {
|
if (i > argc-2)
|
||||||
|
{
|
||||||
action = ACTION_INSUFPARAM;
|
action = ACTION_INSUFPARAM;
|
||||||
break; /* are there sufficient parameters */
|
break; /* are there sufficient parameters */
|
||||||
}
|
}
|
||||||
|
|
||||||
install_getscriptname(scriptname, argv[i], argv[i+1]);
|
install_getscriptname(scriptname, argv[i], argv[i+1]);
|
||||||
|
|
||||||
// script-exists?
|
/* script-exists? */
|
||||||
if (install_alreadyexists(scriptname)==1) {
|
|
||||||
|
|
||||||
if (action != ACTION_REINSTALL) {
|
if (install_alreadyexists(scriptname) == 1)
|
||||||
|
{
|
||||||
|
if (action != ACTION_REINSTALL)
|
||||||
|
{
|
||||||
fprintf(stderr, "Program with that name already exists.\n");
|
fprintf(stderr, "Program with that name already exists.\n");
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (scrsta=install_remove(scriptname)) < 0) {
|
if ((scrsta = install_remove(scriptname)) < 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "Could not remove program: %s\n", strerror(-scrsta));
|
fprintf(stderr, "Could not remove program: %s\n", strerror(-scrsta));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -382,20 +438,23 @@ int install_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
startaddr = install_getstartpage(startpage, pagemargin, install_getprogsize(argv[i]));
|
startaddr = install_getstartpage(startpage, pagemargin, install_getprogsize(argv[i]));
|
||||||
if (startpage < 0) {
|
if (startpage < 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "Not enough memory\n");
|
fprintf(stderr, "Not enough memory\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (progsize = install_programflash(startaddr, argv[i])) <= 0) {
|
if ((progsize = install_programflash(startaddr, argv[i])) <= 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "Error writing program memory: %s\n"
|
fprintf(stderr, "Error writing program memory: %s\n"
|
||||||
"Note: Flash pages are not released, so you may try again and program will be\n"
|
"Note: Flash pages are not released, so you may try again and program will be\n"
|
||||||
" written in other pages.\n", strerror(-progsize));
|
" written in other pages.\n", strerror(-progsize));
|
||||||
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((scrsta = install_createscript(startaddr, stacksize, progsize,
|
if ((scrsta = install_createscript(startaddr, stacksize, progsize,
|
||||||
priority, scriptname)) < 0) {
|
priority, scriptname)) < 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "Error writing program script at %s: %s\n",
|
fprintf(stderr, "Error writing program script at %s: %s\n",
|
||||||
argv[i+1], strerror(-scrsta));
|
argv[i+1], strerror(-scrsta));
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@ -403,7 +462,6 @@ int install_main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("Installed application of size %d bytes to program memory [%xh - %xh].\n",
|
printf("Installed application of size %d bytes to program memory [%xh - %xh].\n",
|
||||||
progsize, startaddr, startaddr + progsize);
|
progsize, startaddr, startaddr + progsize);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
system/poweroff/Kconfig
Normal file
16
system/poweroff/Kconfig
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see misc/tools/kconfig-language.txt.
|
||||||
|
#
|
||||||
|
|
||||||
|
config SYSTEM_POWEROFF
|
||||||
|
bool "Power-Off command"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable support for the NSH poweroff command. NOTE: This option
|
||||||
|
provides the NSH power-off command only. It requires board-specific
|
||||||
|
support to actually implement the power-off.
|
||||||
|
|
||||||
|
if SYSTEM_POWEROFF
|
||||||
|
endif
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# Makefile
|
# apps/system/poweroff/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
# Author: Uros Platise <uros.platise@isotel.eu>
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* poweroff/poweroff.c
|
* apps/system/poweroff/poweroff.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
* Author: Uros Platise <uros.platise@isotel.eu>
|
* Author: Uros Platise <uros.platise@isotel.eu>
|
||||||
@ -33,8 +33,16 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <arch/board/power.h>
|
#include <arch/board/power.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
int poweroff_main(int argc, char *argv[])
|
int poweroff_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
/* TODO:
|
/* TODO:
|
||||||
@ -49,6 +57,7 @@ int poweroff_main(int argc, char *argv[])
|
|||||||
* (to get rid of bad mounts of the sdcard etc.) this could be handled in the
|
* (to get rid of bad mounts of the sdcard etc.) this could be handled in the
|
||||||
* button driver immediately on system boot
|
* button driver immediately on system boot
|
||||||
*/
|
*/
|
||||||
|
|
||||||
board_power_off();
|
board_power_off();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -3,12 +3,12 @@
|
|||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
config VSN_RAMTRON
|
config SYSTEM_RAMTRON
|
||||||
bool "NSH ramtron command"
|
bool "RAMTRON command"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Enable support for the NSH ramtron command.
|
Enable support for the NSH RAMTRON command.
|
||||||
|
|
||||||
if VSN_RAMTRON
|
if SYSTEM_RAMTRON
|
||||||
endif
|
endif
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# Makefile
|
# apps/system/ramtron/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
# Author: Uros Platise <uros.platise@isotel.eu>
|
@ -63,6 +63,7 @@ int ramtron_start(int spino)
|
|||||||
printf("RAMTRON: Failed to initialize SPI%d\n", spino);
|
printf("RAMTRON: Failed to initialize SPI%d\n", spino);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("RAMTRON: Initialized SPI%d\n", spino);
|
printf("RAMTRON: Initialized SPI%d\n", spino);
|
||||||
|
|
||||||
mtd = (struct mtd_dev_s *)ramtron_initialize(spi);
|
mtd = (struct mtd_dev_s *)ramtron_initialize(spi);
|
||||||
@ -71,6 +72,7 @@ int ramtron_start(int spino)
|
|||||||
printf("RAMTRON: Device not found\n");
|
printf("RAMTRON: Device not found\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("RAMTRON: FM25V10 of size 128 kB\n");
|
printf("RAMTRON: FM25V10 of size 128 kB\n");
|
||||||
//printf("RAMTRON: %s of size %d B\n", ramtron_getpart(mtd), ramtron_getsize(mtd) );
|
//printf("RAMTRON: %s of size %d B\n", ramtron_getpart(mtd), ramtron_getsize(mtd) );
|
||||||
|
|
||||||
@ -85,15 +87,18 @@ int ramtron_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int spino;
|
int spino;
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3)
|
||||||
|
{
|
||||||
spino = atoi(argv[2]);
|
spino = atoi(argv[2]);
|
||||||
|
|
||||||
if (!strcmp(argv[1], "start")) {
|
if (!strcmp(argv[1], "start"))
|
||||||
|
{
|
||||||
return ramtron_start(spino);
|
return ramtron_start(spino);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: write protect
|
/* todo: write protect */
|
||||||
|
|
||||||
printf("%s: <start> <spino>\n", argv[0]);
|
printf("%s: <start> <spino>\n", argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
@ -3,12 +3,12 @@
|
|||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
config VSN_SDCARD
|
config SYSTEM_SDCARD
|
||||||
bool "NSH sdcard command"
|
bool "NSH sdcard command"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Enable support for the NSH sdcard command.
|
Enable support for the NSH sdcard command.
|
||||||
|
|
||||||
if VSN_SDCARD
|
if SYSTEM_SDCARD
|
||||||
endif
|
endif
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# Makefile
|
# apps/system/sdcard/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
# Author: Uros Platise <uros.platise@isotel.eu>
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sdcard/sdcard.c
|
* apps/system/sdcard/sdcard.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
@ -36,6 +36,10 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -48,15 +52,23 @@
|
|||||||
# include <nuttx/mmcsd.h>
|
# include <nuttx/mmcsd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct sdio_dev_s *sdio_initialize(int slotno);
|
FAR struct sdio_dev_s *sdio_initialize(int slotno);
|
||||||
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot);
|
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot);
|
||||||
|
|
||||||
// TODO get the structure out from the slot number
|
// TODO get the structure out from the slot number
|
||||||
static FAR struct sdio_dev_s *sdio = NULL;
|
static FAR struct sdio_dev_s *sdio = NULL;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
/* Create device device for the SDIO-based MMC/SD block driver */
|
/* Create device device for the SDIO-based MMC/SD block driver */
|
||||||
|
|
||||||
int sdcard_start(int slotno)
|
static int sdcard_start(int slotno)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -68,6 +80,7 @@ int sdcard_start(int slotno)
|
|||||||
printf("SDIO: Failed to initialize slot %d\n", slotno);
|
printf("SDIO: Failed to initialize slot %d\n", slotno);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("SDIO: Initialized slot %d\n", slotno);
|
printf("SDIO: Initialized slot %d\n", slotno);
|
||||||
|
|
||||||
/* Now bind the SPI interface to the MMC/SD driver */
|
/* Now bind the SPI interface to the MMC/SD driver */
|
||||||
@ -78,6 +91,7 @@ int sdcard_start(int slotno)
|
|||||||
printf("SDIO: Failed to bind to the MMC/SD driver: %d\n", ret);
|
printf("SDIO: Failed to bind to the MMC/SD driver: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("SDIO: Successfully bound to the MMC/SD driver\n");
|
printf("SDIO: Successfully bound to the MMC/SD driver\n");
|
||||||
|
|
||||||
/* Then let's guess and say that there is a card in the slot. I need to check to
|
/* Then let's guess and say that there is a card in the slot. I need to check to
|
||||||
@ -89,6 +103,9 @@ int sdcard_start(int slotno)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
int sdcard_main(int argc, char *argv[])
|
int sdcard_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -97,30 +114,40 @@ int sdcard_main(int argc, char *argv[])
|
|||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
|
|
||||||
/* The 3rd argument is expected to be a slot number, if given */
|
/* The 3rd argument is expected to be a slot number, if given */
|
||||||
|
|
||||||
if (argc==3)
|
if (argc==3)
|
||||||
|
{
|
||||||
slotno = atoi(argv[2]);
|
slotno = atoi(argv[2]);
|
||||||
|
}
|
||||||
|
|
||||||
/* Commands */
|
/* Commands */
|
||||||
|
|
||||||
if (!strcmp(argv[1], "start")) {
|
if (!strcmp(argv[1], "start"))
|
||||||
|
{
|
||||||
return sdcard_start(slotno);
|
return sdcard_start(slotno);
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "stop")) {
|
else if (!strcmp(argv[1], "stop"))
|
||||||
|
{
|
||||||
fprintf(stderr, "Not implemented yet\n");
|
fprintf(stderr, "Not implemented yet\n");
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "insert")) {
|
else if (!strcmp(argv[1], "insert"))
|
||||||
if (sdio) {
|
{
|
||||||
|
if (sdio)
|
||||||
|
{
|
||||||
sdio_mediachange(sdio, true);
|
sdio_mediachange(sdio, true);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "eject")) {
|
else if (!strcmp(argv[1], "eject"))
|
||||||
if (sdio) {
|
{
|
||||||
|
if (sdio)
|
||||||
|
{
|
||||||
sdio_mediachange(sdio, false);
|
sdio_mediachange(sdio, false);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "status")) {
|
else if (!strcmp(argv[1], "status"))
|
||||||
|
{
|
||||||
printf("SDcard #%d Status:\n", slotno);
|
printf("SDcard #%d Status:\n", slotno);
|
||||||
#ifndef CONFIG_MMCSD_HAVECARDDETECT
|
#ifndef CONFIG_MMCSD_HAVECARDDETECT
|
||||||
printf("\t - Without SDcard detect capability\n");
|
printf("\t - Without SDcard detect capability\n");
|
@ -3,12 +3,11 @@
|
|||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
config VSN_SYSINFO
|
config SYSTEM_SYSINFO
|
||||||
bool "NSH sysinfo command"
|
bool "NSH sysinfo command"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Enable support for the NSH sysinfo command.
|
Enable support for the NSH sysinfo command.
|
||||||
|
|
||||||
if VSN_SYSINFO
|
if SYSTEM_SYSINFO
|
||||||
endif
|
endif
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# Makefile
|
# apps/system/sysinfo/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
# Author: Uros Platise <uros.platise@isotel.eu>
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sysinfo/sysinfo.c
|
* apps/system/sysinfo/sysinfo.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
* Author: Uros Platise <uros.platise@isotel.eu>
|
* Author: Uros Platise <uros.platise@isotel.eu>
|
||||||
@ -33,17 +33,16 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/** \file
|
/* Collects and reports system information.
|
||||||
* \brief System Information
|
|
||||||
* \author Uros Platise
|
|
||||||
*
|
*
|
||||||
* Collects and reports system information.
|
* TODO: Gather information also from low-level devices, kernel/sched, clock,
|
||||||
*
|
|
||||||
* \todo Gather information also from low-level devices, kernel/sched, clock,
|
|
||||||
* and further reporting as: sysinfo rtc, or sysinfo sched, ... with
|
* and further reporting as: sysinfo rtc, or sysinfo sched, ... with
|
||||||
* sysinfo help to report all of the options.
|
* sysinfo help to report all of the options.
|
||||||
*
|
*/
|
||||||
**/
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/version.h>
|
#include <nuttx/version.h>
|
||||||
@ -52,18 +51,19 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
int sysinfo_main(int argc, char *argv[])
|
int sysinfo_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("System Information:\n");
|
printf("System Information:\n");
|
||||||
|
printf("\tNuttX Version:\t" CONFIG_VERSION_STRING
|
||||||
printf("\tNuttX Version:\t" CONFIG_VERSION_STRING " Build: %d\n", CONFIG_VERSION_BUILD);
|
" Build: %d\n", CONFIG_VERSION_BUILD);
|
||||||
|
|
||||||
printf("\tSystem Time:\t%d [s] UTC "
|
printf("\tSystem Time:\t%d [s] UTC "
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
"Hardware RTC Support"
|
"Hardware RTC Support"
|
||||||
#endif
|
#endif
|
||||||
"\n", time(NULL) );
|
"\n", time(NULL) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
11
vsn/Kconfig
11
vsn/Kconfig
@ -1,11 +0,0 @@
|
|||||||
#
|
|
||||||
# For a description of the syntax of this configuration file,
|
|
||||||
# see misc/tools/kconfig-language.txt.
|
|
||||||
#
|
|
||||||
|
|
||||||
comment "VSN board add-ons"
|
|
||||||
|
|
||||||
source "$APPSDIR/vsn/poweroff/Kconfig"
|
|
||||||
source "$APPSDIR/vsn/ramtron/Kconfig"
|
|
||||||
source "$APPSDIR/vsn/sdcard/Kconfig"
|
|
||||||
source "$APPSDIR/vsn/sysinfo/Kconfig"
|
|
@ -1,51 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
# apps/vsn/Make.defs
|
|
||||||
# Adds selected applications to apps/ build
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_VSN_POWEROFF),y)
|
|
||||||
CONFIGURED_APPS += vsn/poweroff
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_VSN_RAMTRON),y)
|
|
||||||
CONFIGURED_APPS += vsn/ramtron
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_VSN_SDCARD),y)
|
|
||||||
CONFIGURED_APPS += vsn/sdcard
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_VSN_SYSINFO),y)
|
|
||||||
CONFIGURED_APPS += vsn/sysinfo
|
|
||||||
endif
|
|
71
vsn/Makefile
71
vsn/Makefile
@ -1,71 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
# apps/vsn/Makefile
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
-include $(TOPDIR)/.config # Current configuration
|
|
||||||
|
|
||||||
# Sub-directories
|
|
||||||
|
|
||||||
SUBDIRS = poweroff ramtron sdcard sysinfo
|
|
||||||
|
|
||||||
all: nothing
|
|
||||||
.PHONY: nothing context depend clean distclean
|
|
||||||
|
|
||||||
nothing:
|
|
||||||
|
|
||||||
.context:
|
|
||||||
@for dir in $(SUBDIRS) ; do \
|
|
||||||
$(MAKE) -C $$dir context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
|
||||||
done
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
context: .context
|
|
||||||
|
|
||||||
depend:
|
|
||||||
@for dir in $(SUBDIRS) ; do \
|
|
||||||
$(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@for dir in $(SUBDIRS) ; do \
|
|
||||||
$(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
@for dir in $(SUBDIRS) ; do \
|
|
||||||
$(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \
|
|
||||||
done
|
|
||||||
|
|
||||||
-include Make.dep
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
#
|
|
||||||
# For a description of the syntax of this configuration file,
|
|
||||||
# see misc/tools/kconfig-language.txt.
|
|
||||||
#
|
|
||||||
|
|
||||||
config VSN_POWEROFF
|
|
||||||
bool "NSH poweroff command"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
Enable support for the NSH poweroff command.
|
|
||||||
|
|
||||||
if VSN_POWEROFF
|
|
||||||
endif
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user